aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/53c700.c6
-rw-r--r--drivers/scsi/NCR5380.c12
-rw-r--r--drivers/scsi/NCR53C9x.c16
-rw-r--r--drivers/scsi/NCR53c406a.c2
-rw-r--r--drivers/scsi/a100u2w.c2
-rw-r--r--drivers/scsi/aacraid/aachba.c8
-rw-r--r--drivers/scsi/aha1740.c2
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c11
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.c10
-rw-r--r--drivers/scsi/atp870u.c22
-rw-r--r--drivers/scsi/fd_mcs.c4
-rw-r--r--drivers/scsi/fdomain.c4
-rw-r--r--drivers/scsi/imm.c2
-rw-r--r--drivers/scsi/ips.c10
-rw-r--r--drivers/scsi/ncr53c8xx.c8
-rw-r--r--drivers/scsi/nsp32.c8
-rw-r--r--drivers/scsi/pcmcia/nsp_cs.c10
-rw-r--r--drivers/scsi/pcmcia/sym53c500_cs.c2
-rw-r--r--drivers/scsi/ppa.c2
-rw-r--r--drivers/scsi/psi240i.c2
-rw-r--r--drivers/scsi/qlogicfas408.c4
-rw-r--r--drivers/scsi/scsi_debug.c2
-rw-r--r--drivers/scsi/scsi_error.c16
-rw-r--r--drivers/scsi/sym53c416.c2
-rw-r--r--drivers/scsi/u14-34f.c15
25 files changed, 92 insertions, 90 deletions
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index 523d2a97fd27..e7ad269041a4 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -1427,7 +1427,7 @@ NCR_700_start_command(struct scsi_cmnd *SCp)
1427 * If a contingent allegiance condition exists, the device 1427 * If a contingent allegiance condition exists, the device
1428 * will refuse all tags, so send the request sense as untagged 1428 * will refuse all tags, so send the request sense as untagged
1429 * */ 1429 * */
1430 if((hostdata->tag_negotiated & (1<<SCp->device->id)) 1430 if((hostdata->tag_negotiated & (1<<scmd_id(SCp)))
1431 && (slot->tag != SCSI_NO_TAG && SCp->cmnd[0] != REQUEST_SENSE)) { 1431 && (slot->tag != SCSI_NO_TAG && SCp->cmnd[0] != REQUEST_SENSE)) {
1432 count += scsi_populate_tag_msg(SCp, &hostdata->msgout[count]); 1432 count += scsi_populate_tag_msg(SCp, &hostdata->msgout[count]);
1433 } 1433 }
@@ -1446,7 +1446,7 @@ NCR_700_start_command(struct scsi_cmnd *SCp)
1446 1446
1447 1447
1448 script_patch_ID(hostdata->script, 1448 script_patch_ID(hostdata->script,
1449 Device_ID, 1<<SCp->device->id); 1449 Device_ID, 1<<scmd_id(SCp));
1450 1450
1451 script_patch_32_abs(hostdata->script, CommandAddress, 1451 script_patch_32_abs(hostdata->script, CommandAddress,
1452 slot->pCmd); 1452 slot->pCmd);
@@ -2111,7 +2111,7 @@ static int NCR_700_change_queue_type(struct scsi_device *SDp, int tag_type)
2111 /* shift back to the default unqueued number of commands 2111 /* shift back to the default unqueued number of commands
2112 * (the user can still raise this) */ 2112 * (the user can still raise this) */
2113 scsi_deactivate_tcq(SDp, SDp->host->cmd_per_lun); 2113 scsi_deactivate_tcq(SDp, SDp->host->cmd_per_lun);
2114 hostdata->tag_negotiated &= ~(1 << SDp->id); 2114 hostdata->tag_negotiated &= ~(1 << sdev_id(SDp));
2115 } else { 2115 } else {
2116 /* Here, we cleared the negotiation flag above, so this 2116 /* Here, we cleared the negotiation flag above, so this
2117 * will force the driver to renegotiate */ 2117 * will force the driver to renegotiate */
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index 4368767929f6..cc9ecb35b412 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -1247,13 +1247,13 @@ static void collect_stats(struct NCR5380_hostdata *hostdata, Scsi_Cmnd * cmd)
1247 case WRITE: 1247 case WRITE:
1248 case WRITE_6: 1248 case WRITE_6:
1249 case WRITE_10: 1249 case WRITE_10:
1250 hostdata->time_write[cmd->device->id] += (jiffies - hostdata->timebase); 1250 hostdata->time_write[scmd_id(cmd)] += (jiffies - hostdata->timebase);
1251 hostdata->pendingw--; 1251 hostdata->pendingw--;
1252 break; 1252 break;
1253 case READ: 1253 case READ:
1254 case READ_6: 1254 case READ_6:
1255 case READ_10: 1255 case READ_10:
1256 hostdata->time_read[cmd->device->id] += (jiffies - hostdata->timebase); 1256 hostdata->time_read[scmd_id(cmd)] += (jiffies - hostdata->timebase);
1257 hostdata->pendingr--; 1257 hostdata->pendingr--;
1258 break; 1258 break;
1259 } 1259 }
@@ -1385,7 +1385,7 @@ static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag)
1385 * the host and target ID's on the SCSI bus. 1385 * the host and target ID's on the SCSI bus.
1386 */ 1386 */
1387 1387
1388 NCR5380_write(OUTPUT_DATA_REG, (hostdata->id_mask | (1 << cmd->device->id))); 1388 NCR5380_write(OUTPUT_DATA_REG, (hostdata->id_mask | (1 << scmd_id(cmd))));
1389 1389
1390 /* 1390 /*
1391 * Raise ATN while SEL is true before BSY goes false from arbitration, 1391 * Raise ATN while SEL is true before BSY goes false from arbitration,
@@ -1430,7 +1430,7 @@ static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag)
1430 1430
1431 udelay(1); 1431 udelay(1);
1432 1432
1433 dprintk(NDEBUG_SELECTION, ("scsi%d : selecting target %d\n", instance->host_no, cmd->device->id)); 1433 dprintk(NDEBUG_SELECTION, ("scsi%d : selecting target %d\n", instance->host_no, scmd_id(cmd)));
1434 1434
1435 /* 1435 /*
1436 * The SCSI specification calls for a 250 ms timeout for the actual 1436 * The SCSI specification calls for a 250 ms timeout for the actual
@@ -1483,7 +1483,7 @@ part2:
1483 1483
1484 if (!(NCR5380_read(STATUS_REG) & SR_BSY)) { 1484 if (!(NCR5380_read(STATUS_REG) & SR_BSY)) {
1485 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); 1485 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
1486 if (hostdata->targets_present & (1 << cmd->device->id)) { 1486 if (hostdata->targets_present & (1 << scmd_id(cmd))) {
1487 printk(KERN_DEBUG "scsi%d : weirdness\n", instance->host_no); 1487 printk(KERN_DEBUG "scsi%d : weirdness\n", instance->host_no);
1488 if (hostdata->restart_select) 1488 if (hostdata->restart_select)
1489 printk(KERN_DEBUG "\trestart select\n"); 1489 printk(KERN_DEBUG "\trestart select\n");
@@ -1499,7 +1499,7 @@ part2:
1499 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); 1499 NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
1500 return 0; 1500 return 0;
1501 } 1501 }
1502 hostdata->targets_present |= (1 << cmd->device->id); 1502 hostdata->targets_present |= (1 << scmd_id(cmd));
1503 1503
1504 /* 1504 /*
1505 * Since we followed the SCSI spec, and raised ATN while SEL 1505 * Since we followed the SCSI spec, and raised ATN while SEL
diff --git a/drivers/scsi/NCR53C9x.c b/drivers/scsi/NCR53C9x.c
index 6ceabbd42a3d..26146a4b67b8 100644
--- a/drivers/scsi/NCR53C9x.c
+++ b/drivers/scsi/NCR53C9x.c
@@ -936,7 +936,7 @@ static void esp_release_dmabufs(struct NCR_ESP *esp, Scsi_Cmnd *sp)
936 936
937static void esp_restore_pointers(struct NCR_ESP *esp, Scsi_Cmnd *sp) 937static void esp_restore_pointers(struct NCR_ESP *esp, Scsi_Cmnd *sp)
938{ 938{
939 struct esp_pointers *ep = &esp->data_pointers[sp->device->id]; 939 struct esp_pointers *ep = &esp->data_pointers[scmd_id(sp)];
940 940
941 sp->SCp.ptr = ep->saved_ptr; 941 sp->SCp.ptr = ep->saved_ptr;
942 sp->SCp.buffer = ep->saved_buffer; 942 sp->SCp.buffer = ep->saved_buffer;
@@ -946,7 +946,7 @@ static void esp_restore_pointers(struct NCR_ESP *esp, Scsi_Cmnd *sp)
946 946
947static void esp_save_pointers(struct NCR_ESP *esp, Scsi_Cmnd *sp) 947static void esp_save_pointers(struct NCR_ESP *esp, Scsi_Cmnd *sp)
948{ 948{
949 struct esp_pointers *ep = &esp->data_pointers[sp->device->id]; 949 struct esp_pointers *ep = &esp->data_pointers[scmd_id(sp)];
950 950
951 ep->saved_ptr = sp->SCp.ptr; 951 ep->saved_ptr = sp->SCp.ptr;
952 ep->saved_buffer = sp->SCp.buffer; 952 ep->saved_buffer = sp->SCp.buffer;
@@ -1693,13 +1693,13 @@ static inline void esp_connect(struct NCR_ESP *esp, struct ESP_regs *eregs,
1693 if(esp->prev_soff != esp_dev->sync_max_offset || 1693 if(esp->prev_soff != esp_dev->sync_max_offset ||
1694 esp->prev_stp != esp_dev->sync_min_period || 1694 esp->prev_stp != esp_dev->sync_min_period ||
1695 (esp->erev > esp100a && 1695 (esp->erev > esp100a &&
1696 esp->prev_cfg3 != esp->config3[sp->device->id])) { 1696 esp->prev_cfg3 != esp->config3[scmd_id(sp)])) {
1697 esp->prev_soff = esp_dev->sync_max_offset; 1697 esp->prev_soff = esp_dev->sync_max_offset;
1698 esp_write(eregs->esp_soff, esp->prev_soff); 1698 esp_write(eregs->esp_soff, esp->prev_soff);
1699 esp->prev_stp = esp_dev->sync_min_period; 1699 esp->prev_stp = esp_dev->sync_min_period;
1700 esp_write(eregs->esp_stp, esp->prev_stp); 1700 esp_write(eregs->esp_stp, esp->prev_stp);
1701 if(esp->erev > esp100a) { 1701 if(esp->erev > esp100a) {
1702 esp->prev_cfg3 = esp->config3[sp->device->id]; 1702 esp->prev_cfg3 = esp->config3[scmd_id(sp)];
1703 esp_write(eregs->esp_cfg3, esp->prev_cfg3); 1703 esp_write(eregs->esp_cfg3, esp->prev_cfg3);
1704 } 1704 }
1705 } 1705 }
@@ -2205,7 +2205,7 @@ static int esp_do_freebus(struct NCR_ESP *esp, struct ESP_regs *eregs)
2205 2205
2206 if(SCptr->SCp.Status != GOOD && 2206 if(SCptr->SCp.Status != GOOD &&
2207 SCptr->SCp.Status != CONDITION_GOOD && 2207 SCptr->SCp.Status != CONDITION_GOOD &&
2208 ((1<<SCptr->device->id) & esp->targets_present) && 2208 ((1<<scmd_id(SCptr)) & esp->targets_present) &&
2209 esp_dev->sync && esp_dev->sync_max_offset) { 2209 esp_dev->sync && esp_dev->sync_max_offset) {
2210 /* SCSI standard says that the synchronous capabilities 2210 /* SCSI standard says that the synchronous capabilities
2211 * should be renegotiated at this point. Most likely 2211 * should be renegotiated at this point. Most likely
@@ -2597,7 +2597,7 @@ static int esp_select_complete(struct NCR_ESP *esp, struct ESP_regs *eregs)
2597 */ 2597 */
2598 if(esp->ireg == (ESP_INTR_FDONE | ESP_INTR_BSERV)) { 2598 if(esp->ireg == (ESP_INTR_FDONE | ESP_INTR_BSERV)) {
2599 /* target speaks... */ 2599 /* target speaks... */
2600 esp->targets_present |= (1<<SCptr->device->id); 2600 esp->targets_present |= (1<<scmd_id(SCptr));
2601 2601
2602 /* What if the target ignores the sdtr? */ 2602 /* What if the target ignores the sdtr? */
2603 if(esp->snip) 2603 if(esp->snip)
@@ -3064,7 +3064,7 @@ static int check_multibyte_msg(struct NCR_ESP *esp,
3064 ESPSDTR(("soff=%2x stp=%2x cfg3=%2x\n", 3064 ESPSDTR(("soff=%2x stp=%2x cfg3=%2x\n",
3065 esp_dev->sync_max_offset, 3065 esp_dev->sync_max_offset,
3066 esp_dev->sync_min_period, 3066 esp_dev->sync_min_period,
3067 esp->config3[SCptr->device->id])); 3067 esp->config3[scmd_id(SCptr)]));
3068 3068
3069 esp->snip = 0; 3069 esp->snip = 0;
3070 } else if(esp_dev->sync_max_offset) { 3070 } else if(esp_dev->sync_max_offset) {
@@ -3621,7 +3621,7 @@ void esp_slave_destroy(Scsi_Device *SDptr)
3621{ 3621{
3622 struct NCR_ESP *esp = (struct NCR_ESP *) SDptr->host->hostdata; 3622 struct NCR_ESP *esp = (struct NCR_ESP *) SDptr->host->hostdata;
3623 3623
3624 esp->targets_present &= ~(1 << SDptr->id); 3624 esp->targets_present &= ~(1 << sdev_id(SDptr));
3625 kfree(SDptr->hostdata); 3625 kfree(SDptr->hostdata);
3626 SDptr->hostdata = NULL; 3626 SDptr->hostdata = NULL;
3627} 3627}
diff --git a/drivers/scsi/NCR53c406a.c b/drivers/scsi/NCR53c406a.c
index e1f2246ee7cd..135376992a57 100644
--- a/drivers/scsi/NCR53c406a.c
+++ b/drivers/scsi/NCR53c406a.c
@@ -710,7 +710,7 @@ static int NCR53c406a_queue(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))
710 710
711 /* We are locked here already by the mid layer */ 711 /* We are locked here already by the mid layer */
712 REG0; 712 REG0;
713 outb(SCpnt->device->id, DEST_ID); /* set destination */ 713 outb(scmd_id(SCpnt), DEST_ID); /* set destination */
714 outb(FLUSH_FIFO, CMD_REG); /* reset the fifos */ 714 outb(FLUSH_FIFO, CMD_REG); /* reset the fifos */
715 715
716 for (i = 0; i < SCpnt->cmd_len; i++) { 716 for (i = 0; i < SCpnt->cmd_len; i++) {
diff --git a/drivers/scsi/a100u2w.c b/drivers/scsi/a100u2w.c
index c34403c30483..9f45ae1745da 100644
--- a/drivers/scsi/a100u2w.c
+++ b/drivers/scsi/a100u2w.c
@@ -923,7 +923,7 @@ static int inia100_device_reset(struct scsi_cmnd * SCpnt)
923{ /* I need Host Control Block Information */ 923{ /* I need Host Control Block Information */
924 ORC_HCS *pHCB; 924 ORC_HCS *pHCB;
925 pHCB = (ORC_HCS *) SCpnt->device->host->hostdata; 925 pHCB = (ORC_HCS *) SCpnt->device->host->hostdata;
926 return orc_device_reset(pHCB, SCpnt, SCpnt->device->id); 926 return orc_device_reset(pHCB, SCpnt, scmd_id(SCpnt));
927 927
928} 928}
929 929
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index acc3d9209879..2a128a156aa1 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -1464,7 +1464,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1464 * Test does not apply to ID 16, the pseudo id for the controller 1464 * Test does not apply to ID 16, the pseudo id for the controller
1465 * itself. 1465 * itself.
1466 */ 1466 */
1467 if (scsicmd->device->id != host->this_id) { 1467 if (scmd_id(scsicmd) != host->this_id) {
1468 if ((scsicmd->device->channel == 0) ){ 1468 if ((scsicmd->device->channel == 0) ){
1469 if( (scsicmd->device->id >= dev->maximum_num_containers) || (scsicmd->device->lun != 0)){ 1469 if( (scsicmd->device->id >= dev->maximum_num_containers) || (scsicmd->device->lun != 0)){
1470 scsicmd->result = DID_NO_CONNECT << 16; 1470 scsicmd->result = DID_NO_CONNECT << 16;
@@ -1559,7 +1559,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1559 * Set the Vendor, Product, and Revision Level 1559 * Set the Vendor, Product, and Revision Level
1560 * see: <vendor>.c i.e. aac.c 1560 * see: <vendor>.c i.e. aac.c
1561 */ 1561 */
1562 if (scsicmd->device->id == host->this_id) { 1562 if (scmd_id(scsicmd) == host->this_id) {
1563 setinqstr(dev, (void *) (inq_data.inqd_vid), (sizeof(container_types)/sizeof(char *))); 1563 setinqstr(dev, (void *) (inq_data.inqd_vid), (sizeof(container_types)/sizeof(char *)));
1564 inq_data.inqd_pdt = INQD_PDT_PROC; /* Processor device */ 1564 inq_data.inqd_pdt = INQD_PDT_PROC; /* Processor device */
1565 aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data)); 1565 aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data));
@@ -1949,7 +1949,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
1949 * the channel is 2 1949 * the channel is 2
1950 */ 1950 */
1951 } else if ((dev->raid_scsi_mode) && 1951 } else if ((dev->raid_scsi_mode) &&
1952 (scsicmd->device->channel == 2)) { 1952 (scmd_channel(scsicmd) == 2)) {
1953 scsicmd->result = DID_OK << 16 | 1953 scsicmd->result = DID_OK << 16 |
1954 COMMAND_COMPLETE << 8; 1954 COMMAND_COMPLETE << 8;
1955 } else { 1955 } else {
@@ -1993,7 +1993,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
1993 * the channel is 2 1993 * the channel is 2
1994 */ 1994 */
1995 } else if ((dev->raid_scsi_mode) && 1995 } else if ((dev->raid_scsi_mode) &&
1996 (scsicmd->device->channel == 2)) { 1996 (scmd_channel(scsicmd) == 2)) {
1997 scsicmd->result = DID_OK << 16 | 1997 scsicmd->result = DID_OK << 16 |
1998 COMMAND_COMPLETE << 8; 1998 COMMAND_COMPLETE << 8;
1999 } else { 1999 } else {
diff --git a/drivers/scsi/aha1740.c b/drivers/scsi/aha1740.c
index 73f33e716a0c..8f85dcc0e7fa 100644
--- a/drivers/scsi/aha1740.c
+++ b/drivers/scsi/aha1740.c
@@ -347,7 +347,7 @@ static int aha1740_queuecommand(Scsi_Cmnd * SCpnt, void (*done)(Scsi_Cmnd *))
347{ 347{
348 unchar direction; 348 unchar direction;
349 unchar *cmd = (unchar *) SCpnt->cmnd; 349 unchar *cmd = (unchar *) SCpnt->cmnd;
350 unchar target = SCpnt->device->id; 350 unchar target = scmd_id(SCpnt);
351 struct aha1740_hostdata *host = HOSTDATA(SCpnt->device->host); 351 struct aha1740_hostdata *host = HOSTDATA(SCpnt->device->host);
352 unsigned long flags; 352 unsigned long flags;
353 void *buff = SCpnt->request_buffer; 353 void *buff = SCpnt->request_buffer;
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 5e023dca4e52..cfb46c241b38 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -398,7 +398,7 @@ ahd_linux_unmap_scb(struct ahd_softc *ahd, struct scb *scb)
398 398
399/******************************** Macros **************************************/ 399/******************************** Macros **************************************/
400#define BUILD_SCSIID(ahd, cmd) \ 400#define BUILD_SCSIID(ahd, cmd) \
401 ((((cmd)->device->id << TID_SHIFT) & TID) | (ahd)->our_id) 401 (((scmd_id(cmd) << TID_SHIFT) & TID) | (ahd)->our_id)
402 402
403/* 403/*
404 * Return a string describing the driver. 404 * Return a string describing the driver.
@@ -685,7 +685,7 @@ ahd_linux_bus_reset(struct scsi_cmnd *cmd)
685 ahd_name(ahd), cmd); 685 ahd_name(ahd), cmd);
686#endif 686#endif
687 ahd_lock(ahd, &s); 687 ahd_lock(ahd, &s);
688 found = ahd_reset_channel(ahd, cmd->device->channel + 'A', 688 found = ahd_reset_channel(ahd, scmd_channel(cmd) + 'A',
689 /*initiate reset*/TRUE); 689 /*initiate reset*/TRUE);
690 ahd_unlock(ahd, &s); 690 ahd_unlock(ahd, &s);
691 691
@@ -2110,8 +2110,9 @@ ahd_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag)
2110 2110
2111 /* Any SCB for this device will do for a target reset */ 2111 /* Any SCB for this device will do for a target reset */
2112 LIST_FOREACH(pending_scb, &ahd->pending_scbs, pending_links) { 2112 LIST_FOREACH(pending_scb, &ahd->pending_scbs, pending_links) {
2113 if (ahd_match_scb(ahd, pending_scb, cmd->device->id, 2113 if (ahd_match_scb(ahd, pending_scb,
2114 cmd->device->channel + 'A', 2114 scmd_id(cmd),
2115 scmd_channel(cmd) + 'A',
2115 CAM_LUN_WILDCARD, 2116 CAM_LUN_WILDCARD,
2116 SCB_LIST_NULL, ROLE_INITIATOR) == 0) 2117 SCB_LIST_NULL, ROLE_INITIATOR) == 0)
2117 break; 2118 break;
@@ -2198,7 +2199,7 @@ ahd_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag)
2198 if (last_phase != P_BUSFREE 2199 if (last_phase != P_BUSFREE
2199 && (SCB_GET_TAG(pending_scb) == active_scbptr 2200 && (SCB_GET_TAG(pending_scb) == active_scbptr
2200 || (flag == SCB_DEVICE_RESET 2201 || (flag == SCB_DEVICE_RESET
2201 && SCSIID_TARGET(ahd, saved_scsiid) == cmd->device->id))) { 2202 && SCSIID_TARGET(ahd, saved_scsiid) == scmd_id(cmd)))) {
2202 2203
2203 /* 2204 /*
2204 * We're active on the bus, so assert ATN 2205 * We're active on the bus, so assert ATN
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index 7074ab95d1cc..1861407422e4 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -686,7 +686,7 @@ ahc_linux_biosparam(struct scsi_device *sdev, struct block_device *bdev,
686 u_int channel; 686 u_int channel;
687 687
688 ahc = *((struct ahc_softc **)sdev->host->hostdata); 688 ahc = *((struct ahc_softc **)sdev->host->hostdata);
689 channel = sdev->channel; 689 channel = sdev_channel(sdev);
690 690
691 bh = scsi_bios_ptable(bdev); 691 bh = scsi_bios_ptable(bdev);
692 if (bh) { 692 if (bh) {
@@ -759,7 +759,7 @@ ahc_linux_bus_reset(struct scsi_cmnd *cmd)
759 ahc = *(struct ahc_softc **)cmd->device->host->hostdata; 759 ahc = *(struct ahc_softc **)cmd->device->host->hostdata;
760 760
761 ahc_lock(ahc, &flags); 761 ahc_lock(ahc, &flags);
762 found = ahc_reset_channel(ahc, cmd->device->channel + 'A', 762 found = ahc_reset_channel(ahc, scmd_channel(cmd) + 'A',
763 /*initiate reset*/TRUE); 763 /*initiate reset*/TRUE);
764 ahc_unlock(ahc, &flags); 764 ahc_unlock(ahc, &flags);
765 765
@@ -2172,8 +2172,8 @@ ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag)
2172 2172
2173 /* Any SCB for this device will do for a target reset */ 2173 /* Any SCB for this device will do for a target reset */
2174 LIST_FOREACH(pending_scb, &ahc->pending_scbs, pending_links) { 2174 LIST_FOREACH(pending_scb, &ahc->pending_scbs, pending_links) {
2175 if (ahc_match_scb(ahc, pending_scb, cmd->device->id, 2175 if (ahc_match_scb(ahc, pending_scb, scmd_id(cmd),
2176 cmd->device->channel + 'A', 2176 scmd_channel(cmd) + 'A',
2177 CAM_LUN_WILDCARD, 2177 CAM_LUN_WILDCARD,
2178 SCB_LIST_NULL, ROLE_INITIATOR) == 0) 2178 SCB_LIST_NULL, ROLE_INITIATOR) == 0)
2179 break; 2179 break;
@@ -2260,7 +2260,7 @@ ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag)
2260 if (last_phase != P_BUSFREE 2260 if (last_phase != P_BUSFREE
2261 && (pending_scb->hscb->tag == active_scb_index 2261 && (pending_scb->hscb->tag == active_scb_index
2262 || (flag == SCB_DEVICE_RESET 2262 || (flag == SCB_DEVICE_RESET
2263 && SCSIID_TARGET(ahc, saved_scsiid) == cmd->device->id))) { 2263 && SCSIID_TARGET(ahc, saved_scsiid) == scmd_id(cmd)))) {
2264 2264
2265 /* 2265 /*
2266 * We're active on the bus, so assert ATN 2266 * We're active on the bus, so assert ATN
diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c
index b150bd8e254a..5227a779c05c 100644
--- a/drivers/scsi/atp870u.c
+++ b/drivers/scsi/atp870u.c
@@ -621,10 +621,10 @@ static int atp870u_queuecommand(struct scsi_cmnd * req_p,
621 struct atp_unit *dev; 621 struct atp_unit *dev;
622 struct Scsi_Host *host; 622 struct Scsi_Host *host;
623 623
624 c = req_p->device->channel; 624 c = scmd_channel(req_p);
625 req_p->sense_buffer[0]=0; 625 req_p->sense_buffer[0]=0;
626 req_p->resid = 0; 626 req_p->resid = 0;
627 if (req_p->device->channel > 1) { 627 if (scmd_channel(req_p) > 1) {
628 req_p->result = 0x00040000; 628 req_p->result = 0x00040000;
629 done(req_p); 629 done(req_p);
630#ifdef ED_DBGP 630#ifdef ED_DBGP
@@ -639,7 +639,7 @@ static int atp870u_queuecommand(struct scsi_cmnd * req_p,
639 639
640 640
641 m = 1; 641 m = 1;
642 m = m << req_p->device->id; 642 m = m << scmd_id(req_p);
643 643
644 /* 644 /*
645 * Fake a timeout for missing targets 645 * Fake a timeout for missing targets
@@ -757,9 +757,9 @@ static void send_s870(struct atp_unit *dev,unsigned char c)
757 dev->quhd[c] = 0; 757 dev->quhd[c] = 0;
758 } 758 }
759 workreq = dev->quereq[c][dev->quhd[c]]; 759 workreq = dev->quereq[c][dev->quhd[c]];
760 if (dev->id[c][workreq->device->id].curr_req == 0) { 760 if (dev->id[c][scmd_id(workreq)].curr_req == 0) {
761 dev->id[c][workreq->device->id].curr_req = workreq; 761 dev->id[c][scmd_id(workreq)].curr_req = workreq;
762 dev->last_cmd[c] = workreq->device->id; 762 dev->last_cmd[c] = scmd_id(workreq);
763 goto cmd_subp; 763 goto cmd_subp;
764 } 764 }
765 dev->quhd[c] = j; 765 dev->quhd[c] = j;
@@ -786,16 +786,16 @@ abortsnd:
786oktosend: 786oktosend:
787#ifdef ED_DBGP 787#ifdef ED_DBGP
788 printk("OK to Send\n"); 788 printk("OK to Send\n");
789 printk("CDB"); 789 scmd_printk(KERN_DEBUG, workreq, "CDB");
790 for(i=0;i<workreq->cmd_len;i++) { 790 for(i=0;i<workreq->cmd_len;i++) {
791 printk(" %x",workreq->cmnd[i]); 791 printk(" %x",workreq->cmnd[i]);
792 } 792 }
793 printk("\nChannel = %d ID = %d LUN = %d\n",c,workreq->device->id,workreq->device->lun); 793 printk("\n");
794#endif 794#endif
795 if (dev->dev_id == ATP885_DEVID) { 795 if (dev->dev_id == ATP885_DEVID) {
796 j = inb(dev->baseport + 0x29) & 0xfe; 796 j = inb(dev->baseport + 0x29) & 0xfe;
797 outb(j, dev->baseport + 0x29); 797 outb(j, dev->baseport + 0x29);
798 dev->r1f[c][workreq->device->id] = 0; 798 dev->r1f[c][scmd_id(workreq)] = 0;
799 } 799 }
800 800
801 if (workreq->cmnd[0] == READ_CAPACITY) { 801 if (workreq->cmnd[0] == READ_CAPACITY) {
@@ -809,7 +809,7 @@ oktosend:
809 809
810 tmport = workport + 0x1b; 810 tmport = workport + 0x1b;
811 j = 0; 811 j = 0;
812 target_id = workreq->device->id; 812 target_id = scmd_id(workreq);
813 813
814 /* 814 /*
815 * Wide ? 815 * Wide ?
@@ -3108,7 +3108,7 @@ static int atp870u_abort(struct scsi_cmnd * SCpnt)
3108 host = SCpnt->device->host; 3108 host = SCpnt->device->host;
3109 3109
3110 dev = (struct atp_unit *)&host->hostdata; 3110 dev = (struct atp_unit *)&host->hostdata;
3111 c=SCpnt->device->channel; 3111 c = scmd_channel(SCpnt);
3112 printk(" atp870u: abort Channel = %x \n", c); 3112 printk(" atp870u: abort Channel = %x \n", c);
3113 printk("working=%x last_cmd=%x ", dev->working[c], dev->last_cmd[c]); 3113 printk("working=%x last_cmd=%x ", dev->working[c], dev->last_cmd[c]);
3114 printk(" quhdu=%x quendu=%x ", dev->quhd[c], dev->quend[c]); 3114 printk(" quhdu=%x quendu=%x ", dev->quhd[c], dev->quend[c]);
diff --git a/drivers/scsi/fd_mcs.c b/drivers/scsi/fd_mcs.c
index d59d449a9e4d..6d44602aae78 100644
--- a/drivers/scsi/fd_mcs.c
+++ b/drivers/scsi/fd_mcs.c
@@ -671,7 +671,7 @@ static irqreturn_t fd_mcs_intr(int irq, void *dev_id, struct pt_regs *regs)
671 outb(0x40 | FIFO_COUNT, Interrupt_Cntl_port); 671 outb(0x40 | FIFO_COUNT, Interrupt_Cntl_port);
672 672
673 outb(0x82, SCSI_Cntl_port); /* Bus Enable + Select */ 673 outb(0x82, SCSI_Cntl_port); /* Bus Enable + Select */
674 outb(adapter_mask | (1 << current_SC->device->id), SCSI_Data_NoACK_port); 674 outb(adapter_mask | (1 << scmd_id(current_SC)), SCSI_Data_NoACK_port);
675 675
676 /* Stop arbitration and enable parity */ 676 /* Stop arbitration and enable parity */
677 outb(0x10 | PARITY_MASK, TMC_Cntl_port); 677 outb(0x10 | PARITY_MASK, TMC_Cntl_port);
@@ -683,7 +683,7 @@ static irqreturn_t fd_mcs_intr(int irq, void *dev_id, struct pt_regs *regs)
683 status = inb(SCSI_Status_port); 683 status = inb(SCSI_Status_port);
684 if (!(status & 0x01)) { 684 if (!(status & 0x01)) {
685 /* Try again, for slow devices */ 685 /* Try again, for slow devices */
686 if (fd_mcs_select(shpnt, current_SC->device->id)) { 686 if (fd_mcs_select(shpnt, scmd_id(current_SC))) {
687#if EVERY_ACCESS 687#if EVERY_ACCESS
688 printk(" SFAIL "); 688 printk(" SFAIL ");
689#endif 689#endif
diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c
index 3b2a5bf5c43e..7334244397d1 100644
--- a/drivers/scsi/fdomain.c
+++ b/drivers/scsi/fdomain.c
@@ -1154,7 +1154,7 @@ static irqreturn_t do_fdomain_16x0_intr(int irq, void *dev_id,
1154 outb(0x40 | FIFO_COUNT, port_base + Interrupt_Cntl); 1154 outb(0x40 | FIFO_COUNT, port_base + Interrupt_Cntl);
1155 1155
1156 outb(0x82, port_base + SCSI_Cntl); /* Bus Enable + Select */ 1156 outb(0x82, port_base + SCSI_Cntl); /* Bus Enable + Select */
1157 outb(adapter_mask | (1 << current_SC->device->id), port_base + SCSI_Data_NoACK); 1157 outb(adapter_mask | (1 << scmd_id(current_SC)), port_base + SCSI_Data_NoACK);
1158 1158
1159 /* Stop arbitration and enable parity */ 1159 /* Stop arbitration and enable parity */
1160 outb(0x10 | PARITY_MASK, port_base + TMC_Cntl); 1160 outb(0x10 | PARITY_MASK, port_base + TMC_Cntl);
@@ -1166,7 +1166,7 @@ static irqreturn_t do_fdomain_16x0_intr(int irq, void *dev_id,
1166 status = inb(port_base + SCSI_Status); 1166 status = inb(port_base + SCSI_Status);
1167 if (!(status & 0x01)) { 1167 if (!(status & 0x01)) {
1168 /* Try again, for slow devices */ 1168 /* Try again, for slow devices */
1169 if (fdomain_select( current_SC->device->id )) { 1169 if (fdomain_select( scmd_id(current_SC) )) {
1170#if EVERY_ACCESS 1170#if EVERY_ACCESS
1171 printk( " SFAIL " ); 1171 printk( " SFAIL " );
1172#endif 1172#endif
diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c
index 65e845665b85..fc0f30ae0f77 100644
--- a/drivers/scsi/imm.c
+++ b/drivers/scsi/imm.c
@@ -830,7 +830,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
830 830
831 /* Phase 2 - We are now talking to the scsi bus */ 831 /* Phase 2 - We are now talking to the scsi bus */
832 case 2: 832 case 2:
833 if (!imm_select(dev, cmd->device->id)) { 833 if (!imm_select(dev, scmd_id(cmd))) {
834 imm_fail(dev, DID_NO_CONNECT); 834 imm_fail(dev, DID_NO_CONNECT);
835 return 0; 835 return 0;
836 } 836 }
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index 4cdd891781b1..eeae7ccb0dd2 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -1125,8 +1125,8 @@ ips_queue(Scsi_Cmnd * SC, void (*done) (Scsi_Cmnd *))
1125 SC->device->channel, SC->device->id, SC->device->lun); 1125 SC->device->channel, SC->device->id, SC->device->lun);
1126 1126
1127 /* Check for command to initiator IDs */ 1127 /* Check for command to initiator IDs */
1128 if ((SC->device->channel > 0) 1128 if ((scmd_channel(SC) > 0)
1129 && (SC->device->id == ha->ha_id[SC->device->channel])) { 1129 && (scmd_id(SC) == ha->ha_id[scmd_channel(SC)])) {
1130 SC->result = DID_NO_CONNECT << 16; 1130 SC->result = DID_NO_CONNECT << 16;
1131 done(SC); 1131 done(SC);
1132 1132
@@ -2830,10 +2830,10 @@ ips_next(ips_ha_t * ha, int intr)
2830 2830
2831 p = ha->scb_waitlist.head; 2831 p = ha->scb_waitlist.head;
2832 while ((p) && (scb = ips_getscb(ha))) { 2832 while ((p) && (scb = ips_getscb(ha))) {
2833 if ((p->device->channel > 0) 2833 if ((scmd_channel(p) > 0)
2834 && (ha-> 2834 && (ha->
2835 dcdb_active[p->device->channel - 2835 dcdb_active[scmd_channel(p) -
2836 1] & (1 << p->device->id))) { 2836 1] & (1 << scmd_id(p)))) {
2837 ips_freescb(ha, scb); 2837 ips_freescb(ha, scb);
2838 p = (Scsi_Cmnd *) p->host_scribble; 2838 p = (Scsi_Cmnd *) p->host_scribble;
2839 continue; 2839 continue;
diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c
index 9a4f576c0d5e..243470936fab 100644
--- a/drivers/scsi/ncr53c8xx.c
+++ b/drivers/scsi/ncr53c8xx.c
@@ -3669,7 +3669,7 @@ static int ncr_queue_command (struct ncb *np, struct scsi_cmnd *cmd)
3669 /* 3669 /*
3670 ** select 3670 ** select
3671 */ 3671 */
3672 cp->phys.select.sel_id = sdev->id; 3672 cp->phys.select.sel_id = sdev_id(sdev);
3673 cp->phys.select.sel_scntl3 = tp->wval; 3673 cp->phys.select.sel_scntl3 = tp->wval;
3674 cp->phys.select.sel_sxfer = tp->sval; 3674 cp->phys.select.sel_sxfer = tp->sval;
3675 /* 3675 /*
@@ -4820,7 +4820,7 @@ static void ncr_set_sync_wide_status (struct ncb *np, u_char target)
4820 */ 4820 */
4821 for (cp = np->ccb; cp; cp = cp->link_ccb) { 4821 for (cp = np->ccb; cp; cp = cp->link_ccb) {
4822 if (!cp->cmd) continue; 4822 if (!cp->cmd) continue;
4823 if (cp->cmd->device->id != target) continue; 4823 if (scmd_id(cp->cmd) != target) continue;
4824#if 0 4824#if 0
4825 cp->sync_status = tp->sval; 4825 cp->sync_status = tp->sval;
4826 cp->wide_status = tp->wval; 4826 cp->wide_status = tp->wval;
@@ -4844,7 +4844,7 @@ static void ncr_setsync (struct ncb *np, struct ccb *cp, u_char scntl3, u_char s
4844 u_char target = INB (nc_sdid) & 0x0f; 4844 u_char target = INB (nc_sdid) & 0x0f;
4845 u_char idiv; 4845 u_char idiv;
4846 4846
4847 BUG_ON(target != (cmd->device->id & 0xf)); 4847 BUG_ON(target != (scmd_id(cmd) & 0xf));
4848 4848
4849 tp = &np->target[target]; 4849 tp = &np->target[target];
4850 4850
@@ -4902,7 +4902,7 @@ static void ncr_setwide (struct ncb *np, struct ccb *cp, u_char wide, u_char ack
4902 u_char scntl3; 4902 u_char scntl3;
4903 u_char sxfer; 4903 u_char sxfer;
4904 4904
4905 BUG_ON(target != (cmd->device->id & 0xf)); 4905 BUG_ON(target != (scmd_id(cmd) & 0xf));
4906 4906
4907 tp = &np->target[target]; 4907 tp = &np->target[target];
4908 tp->widedone = wide+1; 4908 tp->widedone = wide+1;
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
index 6367f009cd74..e4ff4f00676d 100644
--- a/drivers/scsi/nsp32.c
+++ b/drivers/scsi/nsp32.c
@@ -481,7 +481,7 @@ static int nsp32_selection_autopara(struct scsi_cmnd *SCpnt)
481 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata; 481 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
482 unsigned int base = SCpnt->device->host->io_port; 482 unsigned int base = SCpnt->device->host->io_port;
483 unsigned int host_id = SCpnt->device->host->this_id; 483 unsigned int host_id = SCpnt->device->host->this_id;
484 unsigned char target = SCpnt->device->id; 484 unsigned char target = scmd_id(SCpnt);
485 nsp32_autoparam *param = data->autoparam; 485 nsp32_autoparam *param = data->autoparam;
486 unsigned char phase; 486 unsigned char phase;
487 int i, ret; 487 int i, ret;
@@ -612,7 +612,7 @@ static int nsp32_selection_autoscsi(struct scsi_cmnd *SCpnt)
612 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata; 612 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
613 unsigned int base = SCpnt->device->host->io_port; 613 unsigned int base = SCpnt->device->host->io_port;
614 unsigned int host_id = SCpnt->device->host->this_id; 614 unsigned int host_id = SCpnt->device->host->this_id;
615 unsigned char target = SCpnt->device->id; 615 unsigned char target = scmd_id(SCpnt);
616 unsigned char phase; 616 unsigned char phase;
617 int status; 617 int status;
618 unsigned short command = 0; 618 unsigned short command = 0;
@@ -973,7 +973,7 @@ static int nsp32_queuecommand(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_
973 } 973 }
974 974
975 /* check target ID is not same as this initiator ID */ 975 /* check target ID is not same as this initiator ID */
976 if (SCpnt->device->id == SCpnt->device->host->this_id) { 976 if (scmd_id(SCpnt) == SCpnt->device->host->this_id) {
977 nsp32_dbg(NSP32_DEBUG_QUEUECOMMAND, "terget==host???"); 977 nsp32_dbg(NSP32_DEBUG_QUEUECOMMAND, "terget==host???");
978 SCpnt->result = DID_BAD_TARGET << 16; 978 SCpnt->result = DID_BAD_TARGET << 16;
979 done(SCpnt); 979 done(SCpnt);
@@ -1028,7 +1028,7 @@ static int nsp32_queuecommand(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_
1028 * (target don't have SDTR_DONE and SDTR_INITIATOR), sync 1028 * (target don't have SDTR_DONE and SDTR_INITIATOR), sync
1029 * message SDTR is needed to do synchronous transfer. 1029 * message SDTR is needed to do synchronous transfer.
1030 */ 1030 */
1031 target = &data->target[SCpnt->device->id]; 1031 target = &data->target[scmd_id(SCpnt)];
1032 data->cur_target = target; 1032 data->cur_target = target;
1033 1033
1034 if (!(target->sync_flag & (SDTR_DONE | SDTR_INITIATOR | SDTR_TARGET))) { 1034 if (!(target->sync_flag & (SDTR_DONE | SDTR_INITIATOR | SDTR_TARGET))) {
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index 3cd3b40b1a4c..3d2f71051fe5 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -201,7 +201,7 @@ static int nsp_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
201#ifdef NSP_DEBUG 201#ifdef NSP_DEBUG
202 /*unsigned int host_id = SCpnt->device->host->this_id;*/ 202 /*unsigned int host_id = SCpnt->device->host->this_id;*/
203 /*unsigned int base = SCpnt->device->host->io_port;*/ 203 /*unsigned int base = SCpnt->device->host->io_port;*/
204 unsigned char target = SCpnt->device->id; 204 unsigned char target = scmd_id(SCpnt);
205#endif 205#endif
206 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; 206 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
207 207
@@ -373,7 +373,7 @@ static int nsphw_start_selection(Scsi_Cmnd *SCpnt)
373{ 373{
374 unsigned int host_id = SCpnt->device->host->this_id; 374 unsigned int host_id = SCpnt->device->host->this_id;
375 unsigned int base = SCpnt->device->host->io_port; 375 unsigned int base = SCpnt->device->host->io_port;
376 unsigned char target = SCpnt->device->id; 376 unsigned char target = scmd_id(SCpnt);
377 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; 377 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
378 int time_out; 378 int time_out;
379 unsigned char phase, arbit; 379 unsigned char phase, arbit;
@@ -452,7 +452,7 @@ static struct nsp_sync_table nsp_sync_table_20M[] = {
452 */ 452 */
453static int nsp_analyze_sdtr(Scsi_Cmnd *SCpnt) 453static int nsp_analyze_sdtr(Scsi_Cmnd *SCpnt)
454{ 454{
455 unsigned char target = SCpnt->device->id; 455 unsigned char target = scmd_id(SCpnt);
456// unsigned char lun = SCpnt->device->lun; 456// unsigned char lun = SCpnt->device->lun;
457 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; 457 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
458 sync_data *sync = &(data->Sync[target]); 458 sync_data *sync = &(data->Sync[target]);
@@ -677,7 +677,7 @@ static int nsp_reselected(Scsi_Cmnd *SCpnt)
677 target++; 677 target++;
678 } 678 }
679 679
680 if (SCpnt->device->id != target) { 680 if (scmd_id(SCpnt) != target) {
681 nsp_msg(KERN_ERR, "XXX: reselect ID must be %d in this implementation.", target); 681 nsp_msg(KERN_ERR, "XXX: reselect ID must be %d in this implementation.", target);
682 } 682 }
683 683
@@ -912,7 +912,7 @@ static void nsp_pio_write(Scsi_Cmnd *SCpnt)
912static int nsp_nexus(Scsi_Cmnd *SCpnt) 912static int nsp_nexus(Scsi_Cmnd *SCpnt)
913{ 913{
914 unsigned int base = SCpnt->device->host->io_port; 914 unsigned int base = SCpnt->device->host->io_port;
915 unsigned char target = SCpnt->device->id; 915 unsigned char target = scmd_id(SCpnt);
916// unsigned char lun = SCpnt->device->lun; 916// unsigned char lun = SCpnt->device->lun;
917 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; 917 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
918 sync_data *sync = &(data->Sync[target]); 918 sync_data *sync = &(data->Sync[target]);
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c
index b4b3a1a8a0c7..98b64b2aa8ee 100644
--- a/drivers/scsi/pcmcia/sym53c500_cs.c
+++ b/drivers/scsi/pcmcia/sym53c500_cs.c
@@ -610,7 +610,7 @@ SYM53C500_queue(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
610 610
611 /* We are locked here already by the mid layer */ 611 /* We are locked here already by the mid layer */
612 REG0(port_base); 612 REG0(port_base);
613 outb(SCpnt->device->id, port_base + DEST_ID); /* set destination */ 613 outb(scmd_id(SCpnt), port_base + DEST_ID); /* set destination */
614 outb(FLUSH_FIFO, port_base + CMD_REG); /* reset the fifos */ 614 outb(FLUSH_FIFO, port_base + CMD_REG); /* reset the fifos */
615 615
616 for (i = 0; i < SCpnt->cmd_len; i++) { 616 for (i = 0; i < SCpnt->cmd_len; i++) {
diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c
index fafcf5d185e7..05347eed9dd5 100644
--- a/drivers/scsi/ppa.c
+++ b/drivers/scsi/ppa.c
@@ -740,7 +740,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd)
740 } 740 }
741 741
742 case 2: /* Phase 2 - We are now talking to the scsi bus */ 742 case 2: /* Phase 2 - We are now talking to the scsi bus */
743 if (!ppa_select(dev, cmd->device->id)) { 743 if (!ppa_select(dev, scmd_id(cmd))) {
744 ppa_fail(dev, DID_NO_CONNECT); 744 ppa_fail(dev, DID_NO_CONNECT);
745 return 0; 745 return 0;
746 } 746 }
diff --git a/drivers/scsi/psi240i.c b/drivers/scsi/psi240i.c
index 0f576d4ad0dd..4322c95c995c 100644
--- a/drivers/scsi/psi240i.c
+++ b/drivers/scsi/psi240i.c
@@ -659,7 +659,7 @@ static int Psi240i_BiosParam (struct scsi_device *sdev, struct block_device *dev
659 { 659 {
660 POUR_DEVICE pdev; 660 POUR_DEVICE pdev;
661 661
662 pdev = &(HOSTDATA(sdev->host)->device[sdev->id]); 662 pdev = &(HOSTDATA(sdev->host)->device[sdev_id(sdev)]);
663 663
664 geom[0] = pdev->heads; 664 geom[0] = pdev->heads;
665 geom[1] = pdev->sectors; 665 geom[1] = pdev->sectors;
diff --git a/drivers/scsi/qlogicfas408.c b/drivers/scsi/qlogicfas408.c
index cb75e0b7baea..52fb2ec3da70 100644
--- a/drivers/scsi/qlogicfas408.c
+++ b/drivers/scsi/qlogicfas408.c
@@ -243,7 +243,7 @@ static void ql_icmd(Scsi_Cmnd * cmd)
243 /**/ outb(qlcfg5, qbase + 5); /* select timer */ 243 /**/ outb(qlcfg5, qbase + 5); /* select timer */
244 outb(qlcfg9 & 7, qbase + 9); /* prescaler */ 244 outb(qlcfg9 & 7, qbase + 9); /* prescaler */
245/* outb(0x99, qbase + 5); */ 245/* outb(0x99, qbase + 5); */
246 outb(cmd->device->id, qbase + 4); 246 outb(scmd_id(cmd), qbase + 4);
247 247
248 for (i = 0; i < cmd->cmd_len; i++) 248 for (i = 0; i < cmd->cmd_len; i++)
249 outb(cmd->cmnd[i], qbase + 2); 249 outb(cmd->cmnd[i], qbase + 2);
@@ -450,7 +450,7 @@ irqreturn_t qlogicfas408_ihandl(int irq, void *dev_id, struct pt_regs *regs)
450int qlogicfas408_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) 450int qlogicfas408_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
451{ 451{
452 struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd); 452 struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd);
453 if (cmd->device->id == priv->qinitid) { 453 if (scmd_id(cmd) == priv->qinitid) {
454 cmd->result = DID_BAD_TARGET << 16; 454 cmd->result = DID_BAD_TARGET << 16;
455 done(cmd); 455 done(cmd);
456 return 0; 456 return 0;
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index add190e22c0f..aadf051274fa 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -283,7 +283,7 @@ int scsi_debug_queuecommand(struct scsi_cmnd * SCpnt, done_funct_t done)
283 unsigned char *cmd = (unsigned char *) SCpnt->cmnd; 283 unsigned char *cmd = (unsigned char *) SCpnt->cmnd;
284 int block, upper_blk, num, k; 284 int block, upper_blk, num, k;
285 int errsts = 0; 285 int errsts = 0;
286 int target = SCpnt->device->id; 286 int target = scmd_id(SCpnt);
287 struct sdebug_dev_info * devip = NULL; 287 struct sdebug_dev_info * devip = NULL;
288 int inj_recovered = 0; 288 int inj_recovered = 0;
289 289
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index f4da56a79ff6..0c5b02d4c7f8 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1033,7 +1033,8 @@ static int scsi_try_bus_reset(struct scsi_cmnd *scmd)
1033 if (!scmd->device->host->hostt->skip_settle_delay) 1033 if (!scmd->device->host->hostt->skip_settle_delay)
1034 ssleep(BUS_RESET_SETTLE_TIME); 1034 ssleep(BUS_RESET_SETTLE_TIME);
1035 spin_lock_irqsave(scmd->device->host->host_lock, flags); 1035 spin_lock_irqsave(scmd->device->host->host_lock, flags);
1036 scsi_report_bus_reset(scmd->device->host, scmd->device->channel); 1036 scsi_report_bus_reset(scmd->device->host,
1037 scmd_channel(scmd));
1037 spin_unlock_irqrestore(scmd->device->host->host_lock, flags); 1038 spin_unlock_irqrestore(scmd->device->host->host_lock, flags);
1038 } 1039 }
1039 1040
@@ -1061,7 +1062,8 @@ static int scsi_try_host_reset(struct scsi_cmnd *scmd)
1061 if (!scmd->device->host->hostt->skip_settle_delay) 1062 if (!scmd->device->host->hostt->skip_settle_delay)
1062 ssleep(HOST_RESET_SETTLE_TIME); 1063 ssleep(HOST_RESET_SETTLE_TIME);
1063 spin_lock_irqsave(scmd->device->host->host_lock, flags); 1064 spin_lock_irqsave(scmd->device->host->host_lock, flags);
1064 scsi_report_bus_reset(scmd->device->host, scmd->device->channel); 1065 scsi_report_bus_reset(scmd->device->host,
1066 scmd_channel(scmd));
1065 spin_unlock_irqrestore(scmd->device->host->host_lock, flags); 1067 spin_unlock_irqrestore(scmd->device->host->host_lock, flags);
1066 } 1068 }
1067 1069
@@ -1091,7 +1093,7 @@ static int scsi_eh_bus_reset(struct Scsi_Host *shost,
1091 for (channel = 0; channel <= shost->max_channel; channel++) { 1093 for (channel = 0; channel <= shost->max_channel; channel++) {
1092 chan_scmd = NULL; 1094 chan_scmd = NULL;
1093 list_for_each_entry(scmd, work_q, eh_entry) { 1095 list_for_each_entry(scmd, work_q, eh_entry) {
1094 if (channel == scmd->device->channel) { 1096 if (channel == scmd_channel(scmd)) {
1095 chan_scmd = scmd; 1097 chan_scmd = scmd;
1096 break; 1098 break;
1097 /* 1099 /*
@@ -1109,7 +1111,7 @@ static int scsi_eh_bus_reset(struct Scsi_Host *shost,
1109 rtn = scsi_try_bus_reset(chan_scmd); 1111 rtn = scsi_try_bus_reset(chan_scmd);
1110 if (rtn == SUCCESS) { 1112 if (rtn == SUCCESS) {
1111 list_for_each_entry_safe(scmd, next, work_q, eh_entry) { 1113 list_for_each_entry_safe(scmd, next, work_q, eh_entry) {
1112 if (channel == scmd->device->channel) 1114 if (channel == scmd_channel(scmd))
1113 if (!scsi_device_online(scmd->device) || 1115 if (!scsi_device_online(scmd->device) ||
1114 !scsi_eh_tur(scmd)) 1116 !scsi_eh_tur(scmd))
1115 scsi_eh_finish_cmd(scmd, 1117 scsi_eh_finish_cmd(scmd,
@@ -1675,7 +1677,7 @@ void scsi_report_bus_reset(struct Scsi_Host *shost, int channel)
1675 struct scsi_device *sdev; 1677 struct scsi_device *sdev;
1676 1678
1677 __shost_for_each_device(sdev, shost) { 1679 __shost_for_each_device(sdev, shost) {
1678 if (channel == sdev->channel) { 1680 if (channel == sdev_channel(sdev)) {
1679 sdev->was_reset = 1; 1681 sdev->was_reset = 1;
1680 sdev->expecting_cc_ua = 1; 1682 sdev->expecting_cc_ua = 1;
1681 } 1683 }
@@ -1710,8 +1712,8 @@ void scsi_report_device_reset(struct Scsi_Host *shost, int channel, int target)
1710 struct scsi_device *sdev; 1712 struct scsi_device *sdev;
1711 1713
1712 __shost_for_each_device(sdev, shost) { 1714 __shost_for_each_device(sdev, shost) {
1713 if (channel == sdev->channel && 1715 if (channel == sdev_channel(sdev) &&
1714 target == sdev->id) { 1716 target == sdev_id(sdev)) {
1715 sdev->was_reset = 1; 1717 sdev->was_reset = 1;
1716 sdev->expecting_cc_ua = 1; 1718 sdev->expecting_cc_ua = 1;
1717 } 1719 }
diff --git a/drivers/scsi/sym53c416.c b/drivers/scsi/sym53c416.c
index ef19adc67eff..93dc7b665ccf 100644
--- a/drivers/scsi/sym53c416.c
+++ b/drivers/scsi/sym53c416.c
@@ -773,7 +773,7 @@ int sym53c416_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
773 current_command->SCp.Message = 0; 773 current_command->SCp.Message = 0;
774 774
775 spin_lock_irqsave(&sym53c416_lock, flags); 775 spin_lock_irqsave(&sym53c416_lock, flags);
776 outb(SCpnt->device->id, base + DEST_BUS_ID); /* Set scsi id target */ 776 outb(scmd_id(SCpnt), base + DEST_BUS_ID); /* Set scsi id target */
777 outb(FLUSH_FIFO, base + COMMAND_REG); /* Flush SCSI and PIO FIFO's */ 777 outb(FLUSH_FIFO, base + COMMAND_REG); /* Flush SCSI and PIO FIFO's */
778 /* Write SCSI command into the SCSI fifo */ 778 /* Write SCSI command into the SCSI fifo */
779 for(i = 0; i < SCpnt->cmd_len; i++) 779 for(i = 0; i < SCpnt->cmd_len; i++)
diff --git a/drivers/scsi/u14-34f.c b/drivers/scsi/u14-34f.c
index e778e17d57f0..cfab8f197084 100644
--- a/drivers/scsi/u14-34f.c
+++ b/drivers/scsi/u14-34f.c
@@ -1822,7 +1822,7 @@ static irqreturn_t ihdlr(int irq, unsigned int j) {
1822 1822
1823 /* If there was a bus reset, redo operation on each target */ 1823 /* If there was a bus reset, redo operation on each target */
1824 else if (tstatus != GOOD && SCpnt->device->type == TYPE_DISK 1824 else if (tstatus != GOOD && SCpnt->device->type == TYPE_DISK
1825 && HD(j)->target_redo[SCpnt->device->id][SCpnt->device->channel]) 1825 && HD(j)->target_redo[scmd_id(SCpnt)][scmd_channel(SCpnt)])
1826 status = DID_BUS_BUSY << 16; 1826 status = DID_BUS_BUSY << 16;
1827 1827
1828 /* Works around a flaw in scsi.c */ 1828 /* Works around a flaw in scsi.c */
@@ -1835,29 +1835,28 @@ static irqreturn_t ihdlr(int irq, unsigned int j) {
1835 status = DID_OK << 16; 1835 status = DID_OK << 16;
1836 1836
1837 if (tstatus == GOOD) 1837 if (tstatus == GOOD)
1838 HD(j)->target_redo[SCpnt->device->id][SCpnt->device->channel] = FALSE; 1838 HD(j)->target_redo[scmd_id(SCpnt)][scmd_channel(SCpnt)] = FALSE;
1839 1839
1840 if (spp->target_status && SCpnt->device->type == TYPE_DISK && 1840 if (spp->target_status && SCpnt->device->type == TYPE_DISK &&
1841 (!(tstatus == CHECK_CONDITION && HD(j)->iocount <= 1000 && 1841 (!(tstatus == CHECK_CONDITION && HD(j)->iocount <= 1000 &&
1842 (SCpnt->sense_buffer[2] & 0xf) == NOT_READY))) 1842 (SCpnt->sense_buffer[2] & 0xf) == NOT_READY)))
1843 printk("%s: ihdlr, target %d.%d:%d, pid %ld, "\ 1843 scmd_printk(KERN_INFO, SCpnt,
1844 "target_status 0x%x, sense key 0x%x.\n", BN(j), 1844 "ihdlr, pid %ld, target_status 0x%x, sense key 0x%x.\n",
1845 SCpnt->device->channel, SCpnt->device->id, SCpnt->device->lun,
1846 SCpnt->pid, spp->target_status, 1845 SCpnt->pid, spp->target_status,
1847 SCpnt->sense_buffer[2]); 1846 SCpnt->sense_buffer[2]);
1848 1847
1849 HD(j)->target_to[SCpnt->device->id][SCpnt->device->channel] = 0; 1848 HD(j)->target_to[scmd_id(SCpnt)][scmd_channel(SCpnt)] = 0;
1850 1849
1851 if (HD(j)->last_retried_pid == SCpnt->pid) HD(j)->retries = 0; 1850 if (HD(j)->last_retried_pid == SCpnt->pid) HD(j)->retries = 0;
1852 1851
1853 break; 1852 break;
1854 case ASST: /* Selection Time Out */ 1853 case ASST: /* Selection Time Out */
1855 1854
1856 if (HD(j)->target_to[SCpnt->device->id][SCpnt->device->channel] > 1) 1855 if (HD(j)->target_to[scmd_id(SCpnt)][scmd_channel(SCpnt)] > 1)
1857 status = DID_ERROR << 16; 1856 status = DID_ERROR << 16;
1858 else { 1857 else {
1859 status = DID_TIME_OUT << 16; 1858 status = DID_TIME_OUT << 16;
1860 HD(j)->target_to[SCpnt->device->id][SCpnt->device->channel]++; 1859 HD(j)->target_to[scmd_id(SCpnt)][scmd_channel(SCpnt)]++;
1861 } 1860 }
1862 1861
1863 break; 1862 break;