Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6:
[SCSI] NCR5380: Fix bugs and canonicalize irq handler usage
[SCSI] zfcp: fix cleanup of dismissed error recovery actions
[SCSI] zfcp: fix dismissal of error recovery actions
[SCSI] qla1280: convert to use the data buffer accessors
[SCSI] iscsi: return data transfer residual for data-out commands
[SCSI] iscsi_tcp: fix potential lockup with write commands
[SCSI] aacraid: fix security weakness
[SCSI] aacraid: fix up le32 issues in BlinkLED
[SCSI] aacraid: fix potential panic in thread stop
[SCSI] aacraid: don't assign cpu_to_le32(constant) to u8

+292 -346
+9 -9
drivers/s390/scsi/zfcp_erp.c
··· 977 977 debug_text_event(adapter->erp_dbf, 2, "a_adis"); 978 978 debug_event(adapter->erp_dbf, 2, &erp_action->action, sizeof (int)); 979 979 980 - zfcp_erp_async_handler_nolock(erp_action, ZFCP_STATUS_ERP_DISMISSED); 980 + erp_action->status |= ZFCP_STATUS_ERP_DISMISSED; 981 + if (zfcp_erp_action_exists(erp_action) == ZFCP_ERP_ACTION_RUNNING) 982 + zfcp_erp_action_ready(erp_action); 981 983 } 982 984 983 985 int ··· 1065 1063 &adapter->status)) { 1066 1064 1067 1065 write_lock_irqsave(&adapter->erp_lock, flags); 1068 - next = adapter->erp_ready_head.prev; 1066 + next = adapter->erp_ready_head.next; 1069 1067 write_unlock_irqrestore(&adapter->erp_lock, flags); 1070 1068 1071 1069 if (next != &adapter->erp_ready_head) { ··· 1155 1153 1156 1154 /* 1157 1155 * check for dismissed status again to avoid follow-up actions, 1158 - * failing of targets and so on for dismissed actions 1156 + * failing of targets and so on for dismissed actions, 1157 + * we go through down() here because there has been an up() 1159 1158 */ 1160 - retval = zfcp_erp_strategy_check_action(erp_action, retval); 1159 + if (erp_action->status & ZFCP_STATUS_ERP_DISMISSED) 1160 + retval = ZFCP_ERP_CONTINUES; 1161 1161 1162 1162 switch (retval) { 1163 - case ZFCP_ERP_DISMISSED: 1164 - /* leave since this action has ridden to its ancestors */ 1165 - debug_text_event(adapter->erp_dbf, 6, "a_st_dis2"); 1166 - goto unlock; 1167 1163 case ZFCP_ERP_NOMEM: 1168 1164 /* no memory to continue immediately, let it sleep */ 1169 1165 if (!(erp_action->status & ZFCP_STATUS_ERP_LOWMEM)) { ··· 3089 3089 ++adapter->erp_total_count; 3090 3090 3091 3091 /* finally put it into 'ready' queue and kick erp thread */ 3092 - list_add(&erp_action->list, &adapter->erp_ready_head); 3092 + list_add_tail(&erp_action->list, &adapter->erp_ready_head); 3093 3093 up(&adapter->erp_ready_sem); 3094 3094 retval = 0; 3095 3095 out:
+4 -4
drivers/scsi/aacraid/commsup.c
··· 1339 1339 aif = (struct aac_aifcmd *)hw_fib->data; 1340 1340 aif->command = cpu_to_le32(AifCmdEventNotify); 1341 1341 aif->seqnum = cpu_to_le32(0xFFFFFFFF); 1342 - aif->data[0] = cpu_to_le32(AifEnExpEvent); 1343 - aif->data[1] = cpu_to_le32(AifExeFirmwarePanic); 1344 - aif->data[2] = cpu_to_le32(AifHighPriority); 1345 - aif->data[3] = cpu_to_le32(BlinkLED); 1342 + aif->data[0] = AifEnExpEvent; 1343 + aif->data[1] = AifExeFirmwarePanic; 1344 + aif->data[2] = AifHighPriority; 1345 + aif->data[3] = BlinkLED; 1346 1346 1347 1347 /* 1348 1348 * Put the FIB onto the
+4 -3
drivers/scsi/aacraid/linit.c
··· 636 636 static int aac_cfg_ioctl(struct inode *inode, struct file *file, 637 637 unsigned int cmd, unsigned long arg) 638 638 { 639 - if (!capable(CAP_SYS_ADMIN)) 639 + if (!capable(CAP_SYS_RAWIO)) 640 640 return -EPERM; 641 641 return aac_do_ioctl(file->private_data, cmd, (void __user *)arg); 642 642 } ··· 691 691 692 692 static long aac_compat_cfg_ioctl(struct file *file, unsigned cmd, unsigned long arg) 693 693 { 694 - if (!capable(CAP_SYS_ADMIN)) 694 + if (!capable(CAP_SYS_RAWIO)) 695 695 return -EPERM; 696 696 return aac_compat_do_ioctl((struct aac_dev *)file->private_data, cmd, arg); 697 697 } ··· 950 950 951 951 static void __aac_shutdown(struct aac_dev * aac) 952 952 { 953 - kthread_stop(aac->thread); 953 + if (aac->aif_thread) 954 + kthread_stop(aac->thread); 954 955 aac_send_shutdown(aac); 955 956 aac_adapter_disable_int(aac); 956 957 free_irq(aac->pdev->irq, aac);
+5 -5
drivers/scsi/atari_scsi.c
··· 393 393 394 394 #endif /* REAL_DMA */ 395 395 396 - NCR5380_intr(0, 0); 396 + NCR5380_intr(irq, dummy); 397 397 398 398 #if 0 399 399 /* To be sure the int is not masked */ ··· 458 458 459 459 #endif /* REAL_DMA */ 460 460 461 - NCR5380_intr(0, 0); 461 + NCR5380_intr(irq, dummy); 462 462 return IRQ_HANDLED; 463 463 } 464 464 ··· 684 684 * interrupt after having cleared the pending flag for the DMA 685 685 * interrupt. */ 686 686 if (request_irq(IRQ_TT_MFP_SCSI, scsi_tt_intr, IRQ_TYPE_SLOW, 687 - "SCSI NCR5380", scsi_tt_intr)) { 687 + "SCSI NCR5380", instance)) { 688 688 printk(KERN_ERR "atari_scsi_detect: cannot allocate irq %d, aborting",IRQ_TT_MFP_SCSI); 689 689 scsi_unregister(atari_scsi_host); 690 690 atari_stram_free(atari_dma_buffer); ··· 701 701 IRQ_TYPE_PRIO, "Hades DMA emulator", 702 702 hades_dma_emulator)) { 703 703 printk(KERN_ERR "atari_scsi_detect: cannot allocate irq %d, aborting (MACH_IS_HADES)",IRQ_AUTO_2); 704 - free_irq(IRQ_TT_MFP_SCSI, scsi_tt_intr); 704 + free_irq(IRQ_TT_MFP_SCSI, instance); 705 705 scsi_unregister(atari_scsi_host); 706 706 atari_stram_free(atari_dma_buffer); 707 707 atari_dma_buffer = 0; ··· 761 761 int atari_scsi_release(struct Scsi_Host *sh) 762 762 { 763 763 if (IS_A_TT()) 764 - free_irq(IRQ_TT_MFP_SCSI, scsi_tt_intr); 764 + free_irq(IRQ_TT_MFP_SCSI, sh); 765 765 if (atari_dma_buffer) 766 766 atari_stram_free(atari_dma_buffer); 767 767 return 1;
+3 -2
drivers/scsi/dtc.c
··· 277 277 /* With interrupts enabled, it will sometimes hang when doing heavy 278 278 * reads. So better not enable them until I finger it out. */ 279 279 if (instance->irq != SCSI_IRQ_NONE) 280 - if (request_irq(instance->irq, dtc_intr, IRQF_DISABLED, "dtc", instance)) { 280 + if (request_irq(instance->irq, dtc_intr, IRQF_DISABLED, 281 + "dtc", instance)) { 281 282 printk(KERN_ERR "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); 282 283 instance->irq = SCSI_IRQ_NONE; 283 284 } ··· 460 459 NCR5380_local_declare(); 461 460 NCR5380_setup(shost); 462 461 if (shost->irq) 463 - free_irq(shost->irq, NULL); 462 + free_irq(shost->irq, shost); 464 463 NCR5380_exit(shost); 465 464 if (shost->io_port && shost->n_io_port) 466 465 release_region(shost->io_port, shost->n_io_port);
+3 -2
drivers/scsi/g_NCR5380.c
··· 460 460 instance->irq = NCR5380_probe_irq(instance, 0xffff); 461 461 462 462 if (instance->irq != SCSI_IRQ_NONE) 463 - if (request_irq(instance->irq, generic_NCR5380_intr, IRQF_DISABLED, "NCR5380", instance)) { 463 + if (request_irq(instance->irq, generic_NCR5380_intr, 464 + IRQF_DISABLED, "NCR5380", instance)) { 464 465 printk(KERN_WARNING "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); 465 466 instance->irq = SCSI_IRQ_NONE; 466 467 } ··· 514 513 NCR5380_setup(instance); 515 514 516 515 if (instance->irq != SCSI_IRQ_NONE) 517 - free_irq(instance->irq, NULL); 516 + free_irq(instance->irq, instance); 518 517 NCR5380_exit(instance); 519 518 520 519 #ifndef CONFIG_SCSI_G_NCR5380_MEM
+69 -70
drivers/scsi/iscsi_tcp.c
··· 197 197 if (unlikely(!sc)) 198 198 return; 199 199 200 - tcp_ctask->xmstate = XMSTATE_IDLE; 200 + tcp_ctask->xmstate = XMSTATE_VALUE_IDLE; 201 201 tcp_ctask->r2t = NULL; 202 202 } 203 203 ··· 409 409 410 410 tcp_ctask->exp_datasn = r2tsn + 1; 411 411 __kfifo_put(tcp_ctask->r2tqueue, (void*)&r2t, sizeof(void*)); 412 - tcp_ctask->xmstate |= XMSTATE_SOL_HDR_INIT; 412 + set_bit(XMSTATE_BIT_SOL_HDR_INIT, &tcp_ctask->xmstate); 413 413 list_move_tail(&ctask->running, &conn->xmitqueue); 414 414 415 415 scsi_queue_work(session->host, &conn->xmitwork); ··· 1254 1254 1255 1255 tcp_ctask->pad_count = ISCSI_PAD_LEN - tcp_ctask->pad_count; 1256 1256 debug_scsi("write padding %d bytes\n", tcp_ctask->pad_count); 1257 - tcp_ctask->xmstate |= XMSTATE_W_PAD; 1257 + set_bit(XMSTATE_BIT_W_PAD, &tcp_ctask->xmstate); 1258 1258 } 1259 1259 1260 1260 /** ··· 1269 1269 struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data; 1270 1270 1271 1271 BUG_ON(__kfifo_len(tcp_ctask->r2tqueue)); 1272 - tcp_ctask->xmstate = XMSTATE_CMD_HDR_INIT; 1272 + tcp_ctask->xmstate = 1 << XMSTATE_BIT_CMD_HDR_INIT; 1273 1273 } 1274 1274 1275 1275 /** ··· 1283 1283 * xmit. 1284 1284 * 1285 1285 * Management xmit state machine consists of these states: 1286 - * XMSTATE_IMM_HDR_INIT - calculate digest of PDU Header 1287 - * XMSTATE_IMM_HDR - PDU Header xmit in progress 1288 - * XMSTATE_IMM_DATA - PDU Data xmit in progress 1289 - * XMSTATE_IDLE - management PDU is done 1286 + * XMSTATE_BIT_IMM_HDR_INIT - calculate digest of PDU Header 1287 + * XMSTATE_BIT_IMM_HDR - PDU Header xmit in progress 1288 + * XMSTATE_BIT_IMM_DATA - PDU Data xmit in progress 1289 + * XMSTATE_VALUE_IDLE - management PDU is done 1290 1290 **/ 1291 1291 static int 1292 1292 iscsi_tcp_mtask_xmit(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask) ··· 1297 1297 debug_scsi("mtask deq [cid %d state %x itt 0x%x]\n", 1298 1298 conn->id, tcp_mtask->xmstate, mtask->itt); 1299 1299 1300 - if (tcp_mtask->xmstate & XMSTATE_IMM_HDR_INIT) { 1300 + if (test_bit(XMSTATE_BIT_IMM_HDR_INIT, &tcp_mtask->xmstate)) { 1301 1301 iscsi_buf_init_iov(&tcp_mtask->headbuf, (char*)mtask->hdr, 1302 1302 sizeof(struct iscsi_hdr)); 1303 1303 1304 1304 if (mtask->data_count) { 1305 - tcp_mtask->xmstate |= XMSTATE_IMM_DATA; 1305 + set_bit(XMSTATE_BIT_IMM_DATA, &tcp_mtask->xmstate); 1306 1306 iscsi_buf_init_iov(&tcp_mtask->sendbuf, 1307 1307 (char*)mtask->data, 1308 1308 mtask->data_count); ··· 1315 1315 (u8*)tcp_mtask->hdrext); 1316 1316 1317 1317 tcp_mtask->sent = 0; 1318 - tcp_mtask->xmstate &= ~XMSTATE_IMM_HDR_INIT; 1319 - tcp_mtask->xmstate |= XMSTATE_IMM_HDR; 1318 + clear_bit(XMSTATE_BIT_IMM_HDR_INIT, &tcp_mtask->xmstate); 1319 + set_bit(XMSTATE_BIT_IMM_HDR, &tcp_mtask->xmstate); 1320 1320 } 1321 1321 1322 - if (tcp_mtask->xmstate & XMSTATE_IMM_HDR) { 1322 + if (test_bit(XMSTATE_BIT_IMM_HDR, &tcp_mtask->xmstate)) { 1323 1323 rc = iscsi_sendhdr(conn, &tcp_mtask->headbuf, 1324 1324 mtask->data_count); 1325 1325 if (rc) 1326 1326 return rc; 1327 - tcp_mtask->xmstate &= ~XMSTATE_IMM_HDR; 1327 + clear_bit(XMSTATE_BIT_IMM_HDR, &tcp_mtask->xmstate); 1328 1328 } 1329 1329 1330 - if (tcp_mtask->xmstate & XMSTATE_IMM_DATA) { 1330 + if (test_and_clear_bit(XMSTATE_BIT_IMM_DATA, &tcp_mtask->xmstate)) { 1331 1331 BUG_ON(!mtask->data_count); 1332 - tcp_mtask->xmstate &= ~XMSTATE_IMM_DATA; 1333 1332 /* FIXME: implement. 1334 1333 * Virtual buffer could be spreaded across multiple pages... 1335 1334 */ ··· 1338 1339 rc = iscsi_sendpage(conn, &tcp_mtask->sendbuf, 1339 1340 &mtask->data_count, &tcp_mtask->sent); 1340 1341 if (rc) { 1341 - tcp_mtask->xmstate |= XMSTATE_IMM_DATA; 1342 + set_bit(XMSTATE_BIT_IMM_DATA, &tcp_mtask->xmstate); 1342 1343 return rc; 1343 1344 } 1344 1345 } while (mtask->data_count); 1345 1346 } 1346 1347 1347 - BUG_ON(tcp_mtask->xmstate != XMSTATE_IDLE); 1348 + BUG_ON(tcp_mtask->xmstate != XMSTATE_VALUE_IDLE); 1348 1349 if (mtask->hdr->itt == RESERVED_ITT) { 1349 1350 struct iscsi_session *session = conn->session; 1350 1351 ··· 1364 1365 struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data; 1365 1366 int rc = 0; 1366 1367 1367 - if (tcp_ctask->xmstate & XMSTATE_CMD_HDR_INIT) { 1368 + if (test_bit(XMSTATE_BIT_CMD_HDR_INIT, &tcp_ctask->xmstate)) { 1368 1369 tcp_ctask->sent = 0; 1369 1370 tcp_ctask->sg_count = 0; 1370 1371 tcp_ctask->exp_datasn = 0; ··· 1389 1390 if (conn->hdrdgst_en) 1390 1391 iscsi_hdr_digest(conn, &tcp_ctask->headbuf, 1391 1392 (u8*)tcp_ctask->hdrext); 1392 - tcp_ctask->xmstate &= ~XMSTATE_CMD_HDR_INIT; 1393 - tcp_ctask->xmstate |= XMSTATE_CMD_HDR_XMIT; 1393 + clear_bit(XMSTATE_BIT_CMD_HDR_INIT, &tcp_ctask->xmstate); 1394 + set_bit(XMSTATE_BIT_CMD_HDR_XMIT, &tcp_ctask->xmstate); 1394 1395 } 1395 1396 1396 - if (tcp_ctask->xmstate & XMSTATE_CMD_HDR_XMIT) { 1397 + if (test_bit(XMSTATE_BIT_CMD_HDR_XMIT, &tcp_ctask->xmstate)) { 1397 1398 rc = iscsi_sendhdr(conn, &tcp_ctask->headbuf, ctask->imm_count); 1398 1399 if (rc) 1399 1400 return rc; 1400 - tcp_ctask->xmstate &= ~XMSTATE_CMD_HDR_XMIT; 1401 + clear_bit(XMSTATE_BIT_CMD_HDR_XMIT, &tcp_ctask->xmstate); 1401 1402 1402 1403 if (sc->sc_data_direction != DMA_TO_DEVICE) 1403 1404 return 0; 1404 1405 1405 1406 if (ctask->imm_count) { 1406 - tcp_ctask->xmstate |= XMSTATE_IMM_DATA; 1407 + set_bit(XMSTATE_BIT_IMM_DATA, &tcp_ctask->xmstate); 1407 1408 iscsi_set_padding(tcp_ctask, ctask->imm_count); 1408 1409 1409 1410 if (ctask->conn->datadgst_en) { ··· 1413 1414 } 1414 1415 } 1415 1416 1416 - if (ctask->unsol_count) 1417 - tcp_ctask->xmstate |= 1418 - XMSTATE_UNS_HDR | XMSTATE_UNS_INIT; 1417 + if (ctask->unsol_count) { 1418 + set_bit(XMSTATE_BIT_UNS_HDR, &tcp_ctask->xmstate); 1419 + set_bit(XMSTATE_BIT_UNS_INIT, &tcp_ctask->xmstate); 1420 + } 1419 1421 } 1420 1422 return rc; 1421 1423 } ··· 1428 1428 struct iscsi_tcp_conn *tcp_conn = conn->dd_data; 1429 1429 int sent = 0, rc; 1430 1430 1431 - if (tcp_ctask->xmstate & XMSTATE_W_PAD) { 1431 + if (test_bit(XMSTATE_BIT_W_PAD, &tcp_ctask->xmstate)) { 1432 1432 iscsi_buf_init_iov(&tcp_ctask->sendbuf, (char*)&tcp_ctask->pad, 1433 1433 tcp_ctask->pad_count); 1434 1434 if (conn->datadgst_en) 1435 1435 crypto_hash_update(&tcp_conn->tx_hash, 1436 1436 &tcp_ctask->sendbuf.sg, 1437 1437 tcp_ctask->sendbuf.sg.length); 1438 - } else if (!(tcp_ctask->xmstate & XMSTATE_W_RESEND_PAD)) 1438 + } else if (!test_bit(XMSTATE_BIT_W_RESEND_PAD, &tcp_ctask->xmstate)) 1439 1439 return 0; 1440 1440 1441 - tcp_ctask->xmstate &= ~XMSTATE_W_PAD; 1442 - tcp_ctask->xmstate &= ~XMSTATE_W_RESEND_PAD; 1441 + clear_bit(XMSTATE_BIT_W_PAD, &tcp_ctask->xmstate); 1442 + clear_bit(XMSTATE_BIT_W_RESEND_PAD, &tcp_ctask->xmstate); 1443 1443 debug_scsi("sending %d pad bytes for itt 0x%x\n", 1444 1444 tcp_ctask->pad_count, ctask->itt); 1445 1445 rc = iscsi_sendpage(conn, &tcp_ctask->sendbuf, &tcp_ctask->pad_count, 1446 1446 &sent); 1447 1447 if (rc) { 1448 1448 debug_scsi("padding send failed %d\n", rc); 1449 - tcp_ctask->xmstate |= XMSTATE_W_RESEND_PAD; 1449 + set_bit(XMSTATE_BIT_W_RESEND_PAD, &tcp_ctask->xmstate); 1450 1450 } 1451 1451 return rc; 1452 1452 } ··· 1465 1465 tcp_ctask = ctask->dd_data; 1466 1466 tcp_conn = conn->dd_data; 1467 1467 1468 - if (!(tcp_ctask->xmstate & XMSTATE_W_RESEND_DATA_DIGEST)) { 1468 + if (!test_bit(XMSTATE_BIT_W_RESEND_DATA_DIGEST, &tcp_ctask->xmstate)) { 1469 1469 crypto_hash_final(&tcp_conn->tx_hash, (u8*)digest); 1470 1470 iscsi_buf_init_iov(buf, (char*)digest, 4); 1471 1471 } 1472 - tcp_ctask->xmstate &= ~XMSTATE_W_RESEND_DATA_DIGEST; 1472 + clear_bit(XMSTATE_BIT_W_RESEND_DATA_DIGEST, &tcp_ctask->xmstate); 1473 1473 1474 1474 rc = iscsi_sendpage(conn, buf, &tcp_ctask->digest_count, &sent); 1475 1475 if (!rc) ··· 1478 1478 else { 1479 1479 debug_scsi("sending digest 0x%x failed for itt 0x%x!\n", 1480 1480 *digest, ctask->itt); 1481 - tcp_ctask->xmstate |= XMSTATE_W_RESEND_DATA_DIGEST; 1481 + set_bit(XMSTATE_BIT_W_RESEND_DATA_DIGEST, &tcp_ctask->xmstate); 1482 1482 } 1483 1483 return rc; 1484 1484 } ··· 1526 1526 struct iscsi_data_task *dtask; 1527 1527 int rc; 1528 1528 1529 - tcp_ctask->xmstate |= XMSTATE_UNS_DATA; 1530 - if (tcp_ctask->xmstate & XMSTATE_UNS_INIT) { 1529 + set_bit(XMSTATE_BIT_UNS_DATA, &tcp_ctask->xmstate); 1530 + if (test_bit(XMSTATE_BIT_UNS_INIT, &tcp_ctask->xmstate)) { 1531 1531 dtask = &tcp_ctask->unsol_dtask; 1532 1532 1533 1533 iscsi_prep_unsolicit_data_pdu(ctask, &dtask->hdr); ··· 1537 1537 iscsi_hdr_digest(conn, &tcp_ctask->headbuf, 1538 1538 (u8*)dtask->hdrext); 1539 1539 1540 - tcp_ctask->xmstate &= ~XMSTATE_UNS_INIT; 1540 + clear_bit(XMSTATE_BIT_UNS_INIT, &tcp_ctask->xmstate); 1541 1541 iscsi_set_padding(tcp_ctask, ctask->data_count); 1542 1542 } 1543 1543 1544 1544 rc = iscsi_sendhdr(conn, &tcp_ctask->headbuf, ctask->data_count); 1545 1545 if (rc) { 1546 - tcp_ctask->xmstate &= ~XMSTATE_UNS_DATA; 1547 - tcp_ctask->xmstate |= XMSTATE_UNS_HDR; 1546 + clear_bit(XMSTATE_BIT_UNS_DATA, &tcp_ctask->xmstate); 1547 + set_bit(XMSTATE_BIT_UNS_HDR, &tcp_ctask->xmstate); 1548 1548 return rc; 1549 1549 } 1550 1550 ··· 1565 1565 struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data; 1566 1566 int rc; 1567 1567 1568 - if (tcp_ctask->xmstate & XMSTATE_UNS_HDR) { 1568 + if (test_and_clear_bit(XMSTATE_BIT_UNS_HDR, &tcp_ctask->xmstate)) { 1569 1569 BUG_ON(!ctask->unsol_count); 1570 - tcp_ctask->xmstate &= ~XMSTATE_UNS_HDR; 1571 1570 send_hdr: 1572 1571 rc = iscsi_send_unsol_hdr(conn, ctask); 1573 1572 if (rc) 1574 1573 return rc; 1575 1574 } 1576 1575 1577 - if (tcp_ctask->xmstate & XMSTATE_UNS_DATA) { 1576 + if (test_bit(XMSTATE_BIT_UNS_DATA, &tcp_ctask->xmstate)) { 1578 1577 struct iscsi_data_task *dtask = &tcp_ctask->unsol_dtask; 1579 1578 int start = tcp_ctask->sent; 1580 1579 ··· 1583 1584 ctask->unsol_count -= tcp_ctask->sent - start; 1584 1585 if (rc) 1585 1586 return rc; 1586 - tcp_ctask->xmstate &= ~XMSTATE_UNS_DATA; 1587 + clear_bit(XMSTATE_BIT_UNS_DATA, &tcp_ctask->xmstate); 1587 1588 /* 1588 1589 * Done with the Data-Out. Next, check if we need 1589 1590 * to send another unsolicited Data-Out. 1590 1591 */ 1591 1592 if (ctask->unsol_count) { 1592 1593 debug_scsi("sending more uns\n"); 1593 - tcp_ctask->xmstate |= XMSTATE_UNS_INIT; 1594 + set_bit(XMSTATE_BIT_UNS_INIT, &tcp_ctask->xmstate); 1594 1595 goto send_hdr; 1595 1596 } 1596 1597 } ··· 1606 1607 struct iscsi_data_task *dtask; 1607 1608 int left, rc; 1608 1609 1609 - if (tcp_ctask->xmstate & XMSTATE_SOL_HDR_INIT) { 1610 + if (test_bit(XMSTATE_BIT_SOL_HDR_INIT, &tcp_ctask->xmstate)) { 1610 1611 if (!tcp_ctask->r2t) { 1611 1612 spin_lock_bh(&session->lock); 1612 1613 __kfifo_get(tcp_ctask->r2tqueue, (void*)&tcp_ctask->r2t, ··· 1620 1621 if (conn->hdrdgst_en) 1621 1622 iscsi_hdr_digest(conn, &r2t->headbuf, 1622 1623 (u8*)dtask->hdrext); 1623 - tcp_ctask->xmstate &= ~XMSTATE_SOL_HDR_INIT; 1624 - tcp_ctask->xmstate |= XMSTATE_SOL_HDR; 1624 + clear_bit(XMSTATE_BIT_SOL_HDR_INIT, &tcp_ctask->xmstate); 1625 + set_bit(XMSTATE_BIT_SOL_HDR, &tcp_ctask->xmstate); 1625 1626 } 1626 1627 1627 - if (tcp_ctask->xmstate & XMSTATE_SOL_HDR) { 1628 + if (test_bit(XMSTATE_BIT_SOL_HDR, &tcp_ctask->xmstate)) { 1628 1629 r2t = tcp_ctask->r2t; 1629 1630 dtask = &r2t->dtask; 1630 1631 1631 1632 rc = iscsi_sendhdr(conn, &r2t->headbuf, r2t->data_count); 1632 1633 if (rc) 1633 1634 return rc; 1634 - tcp_ctask->xmstate &= ~XMSTATE_SOL_HDR; 1635 - tcp_ctask->xmstate |= XMSTATE_SOL_DATA; 1635 + clear_bit(XMSTATE_BIT_SOL_HDR, &tcp_ctask->xmstate); 1636 + set_bit(XMSTATE_BIT_SOL_DATA, &tcp_ctask->xmstate); 1636 1637 1637 1638 if (conn->datadgst_en) { 1638 1639 iscsi_data_digest_init(conn->dd_data, tcp_ctask); ··· 1645 1646 r2t->sent); 1646 1647 } 1647 1648 1648 - if (tcp_ctask->xmstate & XMSTATE_SOL_DATA) { 1649 + if (test_bit(XMSTATE_BIT_SOL_DATA, &tcp_ctask->xmstate)) { 1649 1650 r2t = tcp_ctask->r2t; 1650 1651 dtask = &r2t->dtask; 1651 1652 ··· 1654 1655 &dtask->digestbuf, &dtask->digest); 1655 1656 if (rc) 1656 1657 return rc; 1657 - tcp_ctask->xmstate &= ~XMSTATE_SOL_DATA; 1658 + clear_bit(XMSTATE_BIT_SOL_DATA, &tcp_ctask->xmstate); 1658 1659 1659 1660 /* 1660 1661 * Done with this Data-Out. Next, check if we have ··· 1699 1700 * xmit stages. 1700 1701 * 1701 1702 *iscsi_send_cmd_hdr() 1702 - * XMSTATE_CMD_HDR_INIT - prepare Header and Data buffers Calculate 1703 - * Header Digest 1704 - * XMSTATE_CMD_HDR_XMIT - Transmit header in progress 1703 + * XMSTATE_BIT_CMD_HDR_INIT - prepare Header and Data buffers Calculate 1704 + * Header Digest 1705 + * XMSTATE_BIT_CMD_HDR_XMIT - Transmit header in progress 1705 1706 * 1706 1707 *iscsi_send_padding 1707 - * XMSTATE_W_PAD - Prepare and send pading 1708 - * XMSTATE_W_RESEND_PAD - retry send pading 1708 + * XMSTATE_BIT_W_PAD - Prepare and send pading 1709 + * XMSTATE_BIT_W_RESEND_PAD - retry send pading 1709 1710 * 1710 1711 *iscsi_send_digest 1711 - * XMSTATE_W_RESEND_DATA_DIGEST - Finalize and send Data Digest 1712 - * XMSTATE_W_RESEND_DATA_DIGEST - retry sending digest 1712 + * XMSTATE_BIT_W_RESEND_DATA_DIGEST - Finalize and send Data Digest 1713 + * XMSTATE_BIT_W_RESEND_DATA_DIGEST - retry sending digest 1713 1714 * 1714 1715 *iscsi_send_unsol_hdr 1715 - * XMSTATE_UNS_INIT - prepare un-solicit data header and digest 1716 - * XMSTATE_UNS_HDR - send un-solicit header 1716 + * XMSTATE_BIT_UNS_INIT - prepare un-solicit data header and digest 1717 + * XMSTATE_BIT_UNS_HDR - send un-solicit header 1717 1718 * 1718 1719 *iscsi_send_unsol_pdu 1719 - * XMSTATE_UNS_DATA - send un-solicit data in progress 1720 + * XMSTATE_BIT_UNS_DATA - send un-solicit data in progress 1720 1721 * 1721 1722 *iscsi_send_sol_pdu 1722 - * XMSTATE_SOL_HDR_INIT - solicit data header and digest initialize 1723 - * XMSTATE_SOL_HDR - send solicit header 1724 - * XMSTATE_SOL_DATA - send solicit data 1723 + * XMSTATE_BIT_SOL_HDR_INIT - solicit data header and digest initialize 1724 + * XMSTATE_BIT_SOL_HDR - send solicit header 1725 + * XMSTATE_BIT_SOL_DATA - send solicit data 1725 1726 * 1726 1727 *iscsi_tcp_ctask_xmit 1727 - * XMSTATE_IMM_DATA - xmit managment data (??) 1728 + * XMSTATE_BIT_IMM_DATA - xmit managment data (??) 1728 1729 **/ 1729 1730 static int 1730 1731 iscsi_tcp_ctask_xmit(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) ··· 1741 1742 if (ctask->sc->sc_data_direction != DMA_TO_DEVICE) 1742 1743 return 0; 1743 1744 1744 - if (tcp_ctask->xmstate & XMSTATE_IMM_DATA) { 1745 + if (test_bit(XMSTATE_BIT_IMM_DATA, &tcp_ctask->xmstate)) { 1745 1746 rc = iscsi_send_data(ctask, &tcp_ctask->sendbuf, &tcp_ctask->sg, 1746 1747 &tcp_ctask->sent, &ctask->imm_count, 1747 1748 &tcp_ctask->immbuf, &tcp_ctask->immdigest); 1748 1749 if (rc) 1749 1750 return rc; 1750 - tcp_ctask->xmstate &= ~XMSTATE_IMM_DATA; 1751 + clear_bit(XMSTATE_BIT_IMM_DATA, &tcp_ctask->xmstate); 1751 1752 } 1752 1753 1753 1754 rc = iscsi_send_unsol_pdu(conn, ctask); ··· 1980 1981 iscsi_tcp_mgmt_init(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask) 1981 1982 { 1982 1983 struct iscsi_tcp_mgmt_task *tcp_mtask = mtask->dd_data; 1983 - tcp_mtask->xmstate = XMSTATE_IMM_HDR_INIT; 1984 + tcp_mtask->xmstate = 1 << XMSTATE_BIT_IMM_HDR_INIT; 1984 1985 } 1985 1986 1986 1987 static int
+17 -17
drivers/scsi/iscsi_tcp.h
··· 32 32 #define IN_PROGRESS_PAD_RECV 0x4 33 33 34 34 /* xmit state machine */ 35 - #define XMSTATE_IDLE 0x0 36 - #define XMSTATE_CMD_HDR_INIT 0x1 37 - #define XMSTATE_CMD_HDR_XMIT 0x2 38 - #define XMSTATE_IMM_HDR 0x4 39 - #define XMSTATE_IMM_DATA 0x8 40 - #define XMSTATE_UNS_INIT 0x10 41 - #define XMSTATE_UNS_HDR 0x20 42 - #define XMSTATE_UNS_DATA 0x40 43 - #define XMSTATE_SOL_HDR 0x80 44 - #define XMSTATE_SOL_DATA 0x100 45 - #define XMSTATE_W_PAD 0x200 46 - #define XMSTATE_W_RESEND_PAD 0x400 47 - #define XMSTATE_W_RESEND_DATA_DIGEST 0x800 48 - #define XMSTATE_IMM_HDR_INIT 0x1000 49 - #define XMSTATE_SOL_HDR_INIT 0x2000 35 + #define XMSTATE_VALUE_IDLE 0 36 + #define XMSTATE_BIT_CMD_HDR_INIT 0 37 + #define XMSTATE_BIT_CMD_HDR_XMIT 1 38 + #define XMSTATE_BIT_IMM_HDR 2 39 + #define XMSTATE_BIT_IMM_DATA 3 40 + #define XMSTATE_BIT_UNS_INIT 4 41 + #define XMSTATE_BIT_UNS_HDR 5 42 + #define XMSTATE_BIT_UNS_DATA 6 43 + #define XMSTATE_BIT_SOL_HDR 7 44 + #define XMSTATE_BIT_SOL_DATA 8 45 + #define XMSTATE_BIT_W_PAD 9 46 + #define XMSTATE_BIT_W_RESEND_PAD 10 47 + #define XMSTATE_BIT_W_RESEND_DATA_DIGEST 11 48 + #define XMSTATE_BIT_IMM_HDR_INIT 12 49 + #define XMSTATE_BIT_SOL_HDR_INIT 13 50 50 51 51 #define ISCSI_PAD_LEN 4 52 52 #define ISCSI_SG_TABLESIZE SG_ALL ··· 122 122 struct iscsi_tcp_mgmt_task { 123 123 struct iscsi_hdr hdr; 124 124 char hdrext[sizeof(__u32)]; /* Header-Digest */ 125 - int xmstate; /* mgmt xmit progress */ 125 + unsigned long xmstate; /* mgmt xmit progress */ 126 126 struct iscsi_buf headbuf; /* header buffer */ 127 127 struct iscsi_buf sendbuf; /* in progress buffer */ 128 128 int sent; ··· 150 150 int pad_count; /* padded bytes */ 151 151 struct iscsi_buf headbuf; /* header buf (xmit) */ 152 152 struct iscsi_buf sendbuf; /* in progress buffer*/ 153 - int xmstate; /* xmit xtate machine */ 153 + unsigned long xmstate; /* xmit xtate machine */ 154 154 int sent; 155 155 struct scatterlist *sg; /* per-cmd SG list */ 156 156 struct scatterlist *bad_sg; /* assert statement */
-3
drivers/scsi/libiscsi.c
··· 291 291 min_t(uint16_t, senselen, SCSI_SENSE_BUFFERSIZE)); 292 292 } 293 293 294 - if (sc->sc_data_direction == DMA_TO_DEVICE) 295 - goto out; 296 - 297 294 if (rhdr->flags & ISCSI_FLAG_CMD_UNDERFLOW) { 298 295 int res_count = be32_to_cpu(rhdr->residual_count); 299 296
+2 -2
drivers/scsi/mac_scsi.c
··· 303 303 304 304 if (instance->irq != SCSI_IRQ_NONE) 305 305 if (request_irq(instance->irq, NCR5380_intr, IRQ_FLG_SLOW, 306 - "ncr5380", instance)) { 306 + "ncr5380", instance)) { 307 307 printk(KERN_WARNING "scsi%d: IRQ%d not free, interrupts disabled\n", 308 308 instance->host_no, instance->irq); 309 309 instance->irq = SCSI_IRQ_NONE; ··· 326 326 int macscsi_release (struct Scsi_Host *shpnt) 327 327 { 328 328 if (shpnt->irq != SCSI_IRQ_NONE) 329 - free_irq (shpnt->irq, NCR5380_intr); 329 + free_irq(shpnt->irq, shpnt); 330 330 NCR5380_exit(shpnt); 331 331 332 332 return 0;
+3 -2
drivers/scsi/pas16.c
··· 453 453 instance->irq = NCR5380_probe_irq(instance, PAS16_IRQS); 454 454 455 455 if (instance->irq != SCSI_IRQ_NONE) 456 - if (request_irq(instance->irq, pas16_intr, IRQF_DISABLED, "pas16", instance)) { 456 + if (request_irq(instance->irq, pas16_intr, IRQF_DISABLED, 457 + "pas16", instance)) { 457 458 printk("scsi%d : IRQ%d not free, interrupts disabled\n", 458 459 instance->host_no, instance->irq); 459 460 instance->irq = SCSI_IRQ_NONE; ··· 605 604 static int pas16_release(struct Scsi_Host *shost) 606 605 { 607 606 if (shost->irq) 608 - free_irq(shost->irq, NULL); 607 + free_irq(shost->irq, shost); 609 608 NCR5380_exit(shost); 610 609 if (shost->dma_channel != 0xff) 611 610 free_dma(shost->dma_channel);
+166 -221
drivers/scsi/qla1280.c
··· 1310 1310 } 1311 1311 1312 1312 /* Release memory used for this I/O */ 1313 - if (cmd->use_sg) { 1314 - pci_unmap_sg(ha->pdev, cmd->request_buffer, 1315 - cmd->use_sg, cmd->sc_data_direction); 1316 - } else if (cmd->request_bufflen) { 1317 - pci_unmap_single(ha->pdev, sp->saved_dma_handle, 1318 - cmd->request_bufflen, 1319 - cmd->sc_data_direction); 1320 - } 1313 + scsi_dma_unmap(cmd); 1321 1314 1322 1315 /* Call the mid-level driver interrupt handler */ 1323 1316 CMD_HANDLE(sp->cmd) = (unsigned char *)INVALID_HANDLE; ··· 1399 1406 break; 1400 1407 1401 1408 case CS_DATA_UNDERRUN: 1402 - if ((cp->request_bufflen - residual_length) < 1409 + if ((scsi_bufflen(cp) - residual_length) < 1403 1410 cp->underflow) { 1404 1411 printk(KERN_WARNING 1405 1412 "scsi: Underflow detected - retrying " 1406 1413 "command.\n"); 1407 1414 host_status = DID_ERROR; 1408 1415 } else { 1409 - cp->resid = residual_length; 1416 + scsi_set_resid(cp, residual_length); 1410 1417 host_status = DID_OK; 1411 1418 } 1412 1419 break; ··· 2768 2775 struct device_reg __iomem *reg = ha->iobase; 2769 2776 struct scsi_cmnd *cmd = sp->cmd; 2770 2777 cmd_a64_entry_t *pkt; 2771 - struct scatterlist *sg = NULL, *s; 2772 2778 __le32 *dword_ptr; 2773 2779 dma_addr_t dma_handle; 2774 2780 int status = 0; 2775 2781 int cnt; 2776 2782 int req_cnt; 2777 - u16 seg_cnt; 2783 + int seg_cnt; 2778 2784 u8 dir; 2779 2785 2780 2786 ENTER("qla1280_64bit_start_scsi:"); 2781 2787 2782 2788 /* Calculate number of entries and segments required. */ 2783 2789 req_cnt = 1; 2784 - if (cmd->use_sg) { 2785 - sg = (struct scatterlist *) cmd->request_buffer; 2786 - seg_cnt = pci_map_sg(ha->pdev, sg, cmd->use_sg, 2787 - cmd->sc_data_direction); 2788 - 2790 + seg_cnt = scsi_dma_map(cmd); 2791 + if (seg_cnt > 0) { 2789 2792 if (seg_cnt > 2) { 2790 2793 req_cnt += (seg_cnt - 2) / 5; 2791 2794 if ((seg_cnt - 2) % 5) 2792 2795 req_cnt++; 2793 2796 } 2794 - } else if (cmd->request_bufflen) { /* If data transfer. */ 2795 - seg_cnt = 1; 2796 - } else { 2797 - seg_cnt = 0; 2797 + } else if (seg_cnt < 0) { 2798 + status = 1; 2799 + goto out; 2798 2800 } 2799 2801 2800 2802 if ((req_cnt + 2) >= ha->req_q_cnt) { ··· 2877 2889 * Load data segments. 2878 2890 */ 2879 2891 if (seg_cnt) { /* If data transfer. */ 2892 + struct scatterlist *sg, *s; 2880 2893 int remseg = seg_cnt; 2894 + 2895 + sg = scsi_sglist(cmd); 2896 + 2881 2897 /* Setup packet address segment pointer. */ 2882 2898 dword_ptr = (u32 *)&pkt->dseg_0_address; 2883 2899 2884 - if (cmd->use_sg) { /* If scatter gather */ 2885 - /* Load command entry data segments. */ 2886 - for_each_sg(sg, s, seg_cnt, cnt) { 2887 - if (cnt == 2) 2900 + /* Load command entry data segments. */ 2901 + for_each_sg(sg, s, seg_cnt, cnt) { 2902 + if (cnt == 2) 2903 + break; 2904 + 2905 + dma_handle = sg_dma_address(s); 2906 + #if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_SGI_SN2) 2907 + if (ha->flags.use_pci_vchannel) 2908 + sn_pci_set_vchan(ha->pdev, 2909 + (unsigned long *)&dma_handle, 2910 + SCSI_BUS_32(cmd)); 2911 + #endif 2912 + *dword_ptr++ = 2913 + cpu_to_le32(pci_dma_lo32(dma_handle)); 2914 + *dword_ptr++ = 2915 + cpu_to_le32(pci_dma_hi32(dma_handle)); 2916 + *dword_ptr++ = cpu_to_le32(sg_dma_len(s)); 2917 + dprintk(3, "S/G Segment phys_addr=%x %x, len=0x%x\n", 2918 + cpu_to_le32(pci_dma_hi32(dma_handle)), 2919 + cpu_to_le32(pci_dma_lo32(dma_handle)), 2920 + cpu_to_le32(sg_dma_len(sg_next(s)))); 2921 + remseg--; 2922 + } 2923 + dprintk(5, "qla1280_64bit_start_scsi: Scatter/gather " 2924 + "command packet data - b %i, t %i, l %i \n", 2925 + SCSI_BUS_32(cmd), SCSI_TCN_32(cmd), 2926 + SCSI_LUN_32(cmd)); 2927 + qla1280_dump_buffer(5, (char *)pkt, 2928 + REQUEST_ENTRY_SIZE); 2929 + 2930 + /* 2931 + * Build continuation packets. 2932 + */ 2933 + dprintk(3, "S/G Building Continuation...seg_cnt=0x%x " 2934 + "remains\n", seg_cnt); 2935 + 2936 + while (remseg > 0) { 2937 + /* Update sg start */ 2938 + sg = s; 2939 + /* Adjust ring index. */ 2940 + ha->req_ring_index++; 2941 + if (ha->req_ring_index == REQUEST_ENTRY_CNT) { 2942 + ha->req_ring_index = 0; 2943 + ha->request_ring_ptr = 2944 + ha->request_ring; 2945 + } else 2946 + ha->request_ring_ptr++; 2947 + 2948 + pkt = (cmd_a64_entry_t *)ha->request_ring_ptr; 2949 + 2950 + /* Zero out packet. */ 2951 + memset(pkt, 0, REQUEST_ENTRY_SIZE); 2952 + 2953 + /* Load packet defaults. */ 2954 + ((struct cont_a64_entry *) pkt)->entry_type = 2955 + CONTINUE_A64_TYPE; 2956 + ((struct cont_a64_entry *) pkt)->entry_count = 1; 2957 + ((struct cont_a64_entry *) pkt)->sys_define = 2958 + (uint8_t)ha->req_ring_index; 2959 + /* Setup packet address segment pointer. */ 2960 + dword_ptr = 2961 + (u32 *)&((struct cont_a64_entry *) pkt)->dseg_0_address; 2962 + 2963 + /* Load continuation entry data segments. */ 2964 + for_each_sg(sg, s, remseg, cnt) { 2965 + if (cnt == 5) 2888 2966 break; 2889 2967 dma_handle = sg_dma_address(s); 2890 2968 #if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_SGI_SN2) 2891 2969 if (ha->flags.use_pci_vchannel) 2892 2970 sn_pci_set_vchan(ha->pdev, 2893 - (unsigned long *)&dma_handle, 2971 + (unsigned long *)&dma_handle, 2894 2972 SCSI_BUS_32(cmd)); 2895 2973 #endif 2896 2974 *dword_ptr++ = 2897 2975 cpu_to_le32(pci_dma_lo32(dma_handle)); 2898 2976 *dword_ptr++ = 2899 2977 cpu_to_le32(pci_dma_hi32(dma_handle)); 2900 - *dword_ptr++ = cpu_to_le32(sg_dma_len(s)); 2901 - dprintk(3, "S/G Segment phys_addr=%x %x, len=0x%x\n", 2978 + *dword_ptr++ = 2979 + cpu_to_le32(sg_dma_len(s)); 2980 + dprintk(3, "S/G Segment Cont. phys_addr=%x %x, len=0x%x\n", 2902 2981 cpu_to_le32(pci_dma_hi32(dma_handle)), 2903 2982 cpu_to_le32(pci_dma_lo32(dma_handle)), 2904 - cpu_to_le32(sg_dma_len(sg_next(s)))); 2905 - remseg--; 2983 + cpu_to_le32(sg_dma_len(s))); 2906 2984 } 2907 - dprintk(5, "qla1280_64bit_start_scsi: Scatter/gather " 2908 - "command packet data - b %i, t %i, l %i \n", 2909 - SCSI_BUS_32(cmd), SCSI_TCN_32(cmd), 2910 - SCSI_LUN_32(cmd)); 2911 - qla1280_dump_buffer(5, (char *)pkt, 2912 - REQUEST_ENTRY_SIZE); 2913 - 2914 - /* 2915 - * Build continuation packets. 2916 - */ 2917 - dprintk(3, "S/G Building Continuation...seg_cnt=0x%x " 2918 - "remains\n", seg_cnt); 2919 - 2920 - while (remseg > 0) { 2921 - /* Update sg start */ 2922 - sg = s; 2923 - /* Adjust ring index. */ 2924 - ha->req_ring_index++; 2925 - if (ha->req_ring_index == REQUEST_ENTRY_CNT) { 2926 - ha->req_ring_index = 0; 2927 - ha->request_ring_ptr = 2928 - ha->request_ring; 2929 - } else 2930 - ha->request_ring_ptr++; 2931 - 2932 - pkt = (cmd_a64_entry_t *)ha->request_ring_ptr; 2933 - 2934 - /* Zero out packet. */ 2935 - memset(pkt, 0, REQUEST_ENTRY_SIZE); 2936 - 2937 - /* Load packet defaults. */ 2938 - ((struct cont_a64_entry *) pkt)->entry_type = 2939 - CONTINUE_A64_TYPE; 2940 - ((struct cont_a64_entry *) pkt)->entry_count = 1; 2941 - ((struct cont_a64_entry *) pkt)->sys_define = 2942 - (uint8_t)ha->req_ring_index; 2943 - /* Setup packet address segment pointer. */ 2944 - dword_ptr = 2945 - (u32 *)&((struct cont_a64_entry *) pkt)->dseg_0_address; 2946 - 2947 - /* Load continuation entry data segments. */ 2948 - for_each_sg(sg, s, remseg, cnt) { 2949 - if (cnt == 5) 2950 - break; 2951 - dma_handle = sg_dma_address(s); 2952 - #if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_SGI_SN2) 2953 - if (ha->flags.use_pci_vchannel) 2954 - sn_pci_set_vchan(ha->pdev, 2955 - (unsigned long *)&dma_handle, 2956 - SCSI_BUS_32(cmd)); 2957 - #endif 2958 - *dword_ptr++ = 2959 - cpu_to_le32(pci_dma_lo32(dma_handle)); 2960 - *dword_ptr++ = 2961 - cpu_to_le32(pci_dma_hi32(dma_handle)); 2962 - *dword_ptr++ = 2963 - cpu_to_le32(sg_dma_len(s)); 2964 - dprintk(3, "S/G Segment Cont. phys_addr=%x %x, len=0x%x\n", 2965 - cpu_to_le32(pci_dma_hi32(dma_handle)), 2966 - cpu_to_le32(pci_dma_lo32(dma_handle)), 2967 - cpu_to_le32(sg_dma_len(s))); 2968 - } 2969 - remseg -= cnt; 2970 - dprintk(5, "qla1280_64bit_start_scsi: " 2971 - "continuation packet data - b %i, t " 2972 - "%i, l %i \n", SCSI_BUS_32(cmd), 2973 - SCSI_TCN_32(cmd), SCSI_LUN_32(cmd)); 2974 - qla1280_dump_buffer(5, (char *)pkt, 2975 - REQUEST_ENTRY_SIZE); 2976 - } 2977 - } else { /* No scatter gather data transfer */ 2978 - dma_handle = pci_map_single(ha->pdev, 2979 - cmd->request_buffer, 2980 - cmd->request_bufflen, 2981 - cmd->sc_data_direction); 2982 - 2983 - sp->saved_dma_handle = dma_handle; 2984 - #if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_SGI_SN2) 2985 - if (ha->flags.use_pci_vchannel) 2986 - sn_pci_set_vchan(ha->pdev, 2987 - (unsigned long *)&dma_handle, 2988 - SCSI_BUS_32(cmd)); 2989 - #endif 2990 - *dword_ptr++ = cpu_to_le32(pci_dma_lo32(dma_handle)); 2991 - *dword_ptr++ = cpu_to_le32(pci_dma_hi32(dma_handle)); 2992 - *dword_ptr = cpu_to_le32(cmd->request_bufflen); 2993 - 2994 - dprintk(5, "qla1280_64bit_start_scsi: No scatter/" 2995 - "gather command packet data - b %i, t %i, " 2996 - "l %i \n", SCSI_BUS_32(cmd), SCSI_TCN_32(cmd), 2997 - SCSI_LUN_32(cmd)); 2985 + remseg -= cnt; 2986 + dprintk(5, "qla1280_64bit_start_scsi: " 2987 + "continuation packet data - b %i, t " 2988 + "%i, l %i \n", SCSI_BUS_32(cmd), 2989 + SCSI_TCN_32(cmd), SCSI_LUN_32(cmd)); 2998 2990 qla1280_dump_buffer(5, (char *)pkt, 2999 2991 REQUEST_ENTRY_SIZE); 3000 2992 } ··· 3036 3068 struct device_reg __iomem *reg = ha->iobase; 3037 3069 struct scsi_cmnd *cmd = sp->cmd; 3038 3070 struct cmd_entry *pkt; 3039 - struct scatterlist *sg = NULL, *s; 3040 3071 __le32 *dword_ptr; 3041 3072 int status = 0; 3042 3073 int cnt; 3043 3074 int req_cnt; 3044 - uint16_t seg_cnt; 3075 + int seg_cnt; 3045 3076 dma_addr_t dma_handle; 3046 3077 u8 dir; 3047 3078 ··· 3050 3083 cmd->cmnd[0]); 3051 3084 3052 3085 /* Calculate number of entries and segments required. */ 3053 - req_cnt = 1; 3054 - if (cmd->use_sg) { 3055 - /* 3056 - * We must build an SG list in adapter format, as the kernel's 3057 - * SG list cannot be used directly because of data field size 3058 - * (__alpha__) differences and the kernel SG list uses virtual 3059 - * addresses where we need physical addresses. 3060 - */ 3061 - sg = (struct scatterlist *) cmd->request_buffer; 3062 - seg_cnt = pci_map_sg(ha->pdev, sg, cmd->use_sg, 3063 - cmd->sc_data_direction); 3064 - 3086 + seg_cnt = scsi_dma_map(cmd); 3087 + if (seg_cnt) { 3065 3088 /* 3066 3089 * if greater than four sg entries then we need to allocate 3067 3090 * continuation entries ··· 3063 3106 } 3064 3107 dprintk(3, "S/G Transfer cmd=%p seg_cnt=0x%x, req_cnt=%x\n", 3065 3108 cmd, seg_cnt, req_cnt); 3066 - } else if (cmd->request_bufflen) { /* If data transfer. */ 3067 - dprintk(3, "No S/G transfer t=%x cmd=%p len=%x CDB=%x\n", 3068 - SCSI_TCN_32(cmd), cmd, cmd->request_bufflen, 3069 - cmd->cmnd[0]); 3070 - seg_cnt = 1; 3071 - } else { 3072 - /* dprintk(1, "No data transfer \n"); */ 3073 - seg_cnt = 0; 3109 + } else if (seg_cnt < 0) { 3110 + status = 1; 3111 + goto out; 3074 3112 } 3075 3113 3076 3114 if ((req_cnt + 2) >= ha->req_q_cnt) { ··· 3146 3194 * Load data segments. 3147 3195 */ 3148 3196 if (seg_cnt) { 3197 + struct scatterlist *sg, *s; 3149 3198 int remseg = seg_cnt; 3199 + 3200 + sg = scsi_sglist(cmd); 3201 + 3150 3202 /* Setup packet address segment pointer. */ 3151 3203 dword_ptr = &pkt->dseg_0_address; 3152 3204 3153 - if (cmd->use_sg) { /* If scatter gather */ 3154 - dprintk(3, "Building S/G data segments..\n"); 3155 - qla1280_dump_buffer(1, (char *)sg, 4 * 16); 3205 + dprintk(3, "Building S/G data segments..\n"); 3206 + qla1280_dump_buffer(1, (char *)sg, 4 * 16); 3156 3207 3157 - /* Load command entry data segments. */ 3158 - for_each_sg(sg, s, seg_cnt, cnt) { 3159 - if (cnt == 4) 3208 + /* Load command entry data segments. */ 3209 + for_each_sg(sg, s, seg_cnt, cnt) { 3210 + if (cnt == 4) 3211 + break; 3212 + *dword_ptr++ = 3213 + cpu_to_le32(pci_dma_lo32(sg_dma_address(s))); 3214 + *dword_ptr++ = cpu_to_le32(sg_dma_len(s)); 3215 + dprintk(3, "S/G Segment phys_addr=0x%lx, len=0x%x\n", 3216 + (pci_dma_lo32(sg_dma_address(s))), 3217 + (sg_dma_len(s))); 3218 + remseg--; 3219 + } 3220 + /* 3221 + * Build continuation packets. 3222 + */ 3223 + dprintk(3, "S/G Building Continuation" 3224 + "...seg_cnt=0x%x remains\n", seg_cnt); 3225 + while (remseg > 0) { 3226 + /* Continue from end point */ 3227 + sg = s; 3228 + /* Adjust ring index. */ 3229 + ha->req_ring_index++; 3230 + if (ha->req_ring_index == REQUEST_ENTRY_CNT) { 3231 + ha->req_ring_index = 0; 3232 + ha->request_ring_ptr = 3233 + ha->request_ring; 3234 + } else 3235 + ha->request_ring_ptr++; 3236 + 3237 + pkt = (struct cmd_entry *)ha->request_ring_ptr; 3238 + 3239 + /* Zero out packet. */ 3240 + memset(pkt, 0, REQUEST_ENTRY_SIZE); 3241 + 3242 + /* Load packet defaults. */ 3243 + ((struct cont_entry *) pkt)-> 3244 + entry_type = CONTINUE_TYPE; 3245 + ((struct cont_entry *) pkt)->entry_count = 1; 3246 + 3247 + ((struct cont_entry *) pkt)->sys_define = 3248 + (uint8_t) ha->req_ring_index; 3249 + 3250 + /* Setup packet address segment pointer. */ 3251 + dword_ptr = 3252 + &((struct cont_entry *) pkt)->dseg_0_address; 3253 + 3254 + /* Load continuation entry data segments. */ 3255 + for_each_sg(sg, s, remseg, cnt) { 3256 + if (cnt == 7) 3160 3257 break; 3161 3258 *dword_ptr++ = 3162 3259 cpu_to_le32(pci_dma_lo32(sg_dma_address(s))); 3163 - *dword_ptr++ = cpu_to_le32(sg_dma_len(s)); 3164 - dprintk(3, "S/G Segment phys_addr=0x%lx, len=0x%x\n", 3165 - (pci_dma_lo32(sg_dma_address(s))), 3166 - (sg_dma_len(s))); 3167 - remseg--; 3260 + *dword_ptr++ = 3261 + cpu_to_le32(sg_dma_len(s)); 3262 + dprintk(1, 3263 + "S/G Segment Cont. phys_addr=0x%x, " 3264 + "len=0x%x\n", 3265 + cpu_to_le32(pci_dma_lo32(sg_dma_address(s))), 3266 + cpu_to_le32(sg_dma_len(s))); 3168 3267 } 3169 - /* 3170 - * Build continuation packets. 3171 - */ 3172 - dprintk(3, "S/G Building Continuation" 3173 - "...seg_cnt=0x%x remains\n", seg_cnt); 3174 - while (remseg > 0) { 3175 - /* Continue from end point */ 3176 - sg = s; 3177 - /* Adjust ring index. */ 3178 - ha->req_ring_index++; 3179 - if (ha->req_ring_index == REQUEST_ENTRY_CNT) { 3180 - ha->req_ring_index = 0; 3181 - ha->request_ring_ptr = 3182 - ha->request_ring; 3183 - } else 3184 - ha->request_ring_ptr++; 3185 - 3186 - pkt = (struct cmd_entry *)ha->request_ring_ptr; 3187 - 3188 - /* Zero out packet. */ 3189 - memset(pkt, 0, REQUEST_ENTRY_SIZE); 3190 - 3191 - /* Load packet defaults. */ 3192 - ((struct cont_entry *) pkt)-> 3193 - entry_type = CONTINUE_TYPE; 3194 - ((struct cont_entry *) pkt)->entry_count = 1; 3195 - 3196 - ((struct cont_entry *) pkt)->sys_define = 3197 - (uint8_t) ha->req_ring_index; 3198 - 3199 - /* Setup packet address segment pointer. */ 3200 - dword_ptr = 3201 - &((struct cont_entry *) pkt)->dseg_0_address; 3202 - 3203 - /* Load continuation entry data segments. */ 3204 - for_each_sg(sg, s, remseg, cnt) { 3205 - if (cnt == 7) 3206 - break; 3207 - *dword_ptr++ = 3208 - cpu_to_le32(pci_dma_lo32(sg_dma_address(s))); 3209 - *dword_ptr++ = 3210 - cpu_to_le32(sg_dma_len(s)); 3211 - dprintk(1, 3212 - "S/G Segment Cont. phys_addr=0x%x, " 3213 - "len=0x%x\n", 3214 - cpu_to_le32(pci_dma_lo32(sg_dma_address(s))), 3215 - cpu_to_le32(sg_dma_len(s))); 3216 - } 3217 - remseg -= cnt; 3218 - dprintk(5, "qla1280_32bit_start_scsi: " 3219 - "continuation packet data - " 3220 - "scsi(%i:%i:%i)\n", SCSI_BUS_32(cmd), 3221 - SCSI_TCN_32(cmd), SCSI_LUN_32(cmd)); 3222 - qla1280_dump_buffer(5, (char *)pkt, 3223 - REQUEST_ENTRY_SIZE); 3224 - } 3225 - } else { /* No S/G data transfer */ 3226 - dma_handle = pci_map_single(ha->pdev, 3227 - cmd->request_buffer, 3228 - cmd->request_bufflen, 3229 - cmd->sc_data_direction); 3230 - sp->saved_dma_handle = dma_handle; 3231 - 3232 - *dword_ptr++ = cpu_to_le32(pci_dma_lo32(dma_handle)); 3233 - *dword_ptr = cpu_to_le32(cmd->request_bufflen); 3268 + remseg -= cnt; 3269 + dprintk(5, "qla1280_32bit_start_scsi: " 3270 + "continuation packet data - " 3271 + "scsi(%i:%i:%i)\n", SCSI_BUS_32(cmd), 3272 + SCSI_TCN_32(cmd), SCSI_LUN_32(cmd)); 3273 + qla1280_dump_buffer(5, (char *)pkt, 3274 + REQUEST_ENTRY_SIZE); 3234 3275 } 3235 3276 } else { /* No data transfer at all */ 3236 3277 dprintk(5, "qla1280_32bit_start_scsi: No data, command " ··· 4031 4086 for (i = 0; i < cmd->cmd_len; i++) { 4032 4087 printk("0x%02x ", cmd->cmnd[i]); 4033 4088 } 4034 - printk(" seg_cnt =%d\n", cmd->use_sg); 4089 + printk(" seg_cnt =%d\n", scsi_sg_count(cmd)); 4035 4090 printk(" request buffer=0x%p, request buffer len=0x%x\n", 4036 - cmd->request_buffer, cmd->request_bufflen); 4091 + scsi_sglist(cmd), scsi_bufflen(cmd)); 4037 4092 /* if (cmd->use_sg) 4038 4093 { 4039 4094 sg = (struct scatterlist *) cmd->request_buffer;
+2 -2
drivers/scsi/sun3_scsi.c
··· 268 268 ((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0; 269 269 270 270 if (request_irq(instance->irq, scsi_sun3_intr, 271 - 0, "Sun3SCSI-5380", NULL)) { 271 + 0, "Sun3SCSI-5380", instance)) { 272 272 #ifndef REAL_DMA 273 273 printk("scsi%d: IRQ%d not free, interrupts disabled\n", 274 274 instance->host_no, instance->irq); ··· 310 310 int sun3scsi_release (struct Scsi_Host *shpnt) 311 311 { 312 312 if (shpnt->irq != SCSI_IRQ_NONE) 313 - free_irq (shpnt->irq, NULL); 313 + free_irq(shpnt->irq, shpnt); 314 314 315 315 iounmap((void *)sun3_scsi_regp); 316 316
+2 -2
drivers/scsi/sun3_scsi_vme.c
··· 230 230 ((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0; 231 231 232 232 if (request_irq(instance->irq, scsi_sun3_intr, 233 - 0, "Sun3SCSI-5380VME", NULL)) { 233 + 0, "Sun3SCSI-5380VME", instance)) { 234 234 #ifndef REAL_DMA 235 235 printk("scsi%d: IRQ%d not free, interrupts disabled\n", 236 236 instance->host_no, instance->irq); ··· 279 279 int sun3scsi_release (struct Scsi_Host *shpnt) 280 280 { 281 281 if (shpnt->irq != SCSI_IRQ_NONE) 282 - free_irq (shpnt->irq, NULL); 282 + free_irq(shpnt->irq, shpnt); 283 283 284 284 iounmap((void *)sun3_scsi_regp); 285 285
+3 -2
drivers/scsi/t128.c
··· 259 259 instance->irq = NCR5380_probe_irq(instance, T128_IRQS); 260 260 261 261 if (instance->irq != SCSI_IRQ_NONE) 262 - if (request_irq(instance->irq, t128_intr, IRQF_DISABLED, "t128", instance)) { 262 + if (request_irq(instance->irq, t128_intr, IRQF_DISABLED, "t128", 263 + instance)) { 263 264 printk("scsi%d : IRQ%d not free, interrupts disabled\n", 264 265 instance->host_no, instance->irq); 265 266 instance->irq = SCSI_IRQ_NONE; ··· 296 295 NCR5380_local_declare(); 297 296 NCR5380_setup(shost); 298 297 if (shost->irq) 299 - free_irq(shost->irq, NULL); 298 + free_irq(shost->irq, shost); 300 299 NCR5380_exit(shost); 301 300 if (shost->io_port && shost->n_io_port) 302 301 release_region(shost->io_port, shost->n_io_port);