commit 2f3f6acc914150f0e671e3d3623d5e85bf95939b Author: Jeff Garzik <jgarzik@xxxxxxxxx> Date: Sat Oct 29 17:27:37 2005 -0400 [SCSI] more usage of scmd_{id,channel} and sdev_{id,channel} drivers/scsi/3w-xxxx.c | 22 ++++++++++++-------- drivers/scsi/BusLogic.c | 6 ++--- drivers/scsi/NCR5380.c | 8 +++---- drivers/scsi/NCR53C9x.c | 12 +++++------ drivers/scsi/advansys.c | 23 +++++++++++---------- drivers/scsi/aha152x.c | 6 ++--- drivers/scsi/aic7xxx/aic7xxx_osm.c | 8 +++---- drivers/scsi/dc395x.c | 24 +++++++++++----------- drivers/scsi/eata.c | 9 ++------ drivers/scsi/g_NCR5380.c | 10 ++++----- drivers/scsi/gdth_proc.c | 12 +++++------ drivers/scsi/in2000.c | 36 +++++++++++++++++----------------- drivers/scsi/initio.c | 2 - drivers/scsi/ipr.c | 3 +- drivers/scsi/libata-scsi.c | 4 +-- drivers/scsi/megaraid/mega_common.h | 2 - drivers/scsi/megaraid/megaraid_mbox.c | 6 ++--- drivers/scsi/megaraid/megaraid_sas.c | 2 - drivers/scsi/megaraid/megaraid_sas.h | 6 ++--- drivers/scsi/ncr53c8xx.c | 2 - drivers/scsi/nsp32.c | 4 +-- drivers/scsi/pcmcia/nsp_cs.c | 2 - drivers/scsi/psi240i.c | 2 - drivers/scsi/qlogicfc.c | 4 +-- drivers/scsi/sym53c8xx_2/sym_glue.c | 10 ++++----- 25 files changed, 114 insertions(+), 111 deletions(-) diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c index 283f6d2..2cec0d0 100644 --- a/drivers/scsi/3w-xxxx.c +++ b/drivers/scsi/3w-xxxx.c @@ -1543,7 +1543,8 @@ static int tw_scsiop_inquiry_complete(TW request_buffer[2] = 0; /* No ansi/iso compliance */ request_buffer[4] = 31; /* Additional length */ memcpy(&request_buffer[8], "3ware ", 8); /* Vendor ID */ - sprintf(&request_buffer[16], "Logical Disk %-2d ", tw_dev->srb[request_id]->device->id); + sprintf(&request_buffer[16], "Logical Disk %-2d ", + scmd_id(tw_dev->srb[request_id])); memcpy(&request_buffer[32], TW_DRIVER_VERSION, 3); tw_transfer_internal(tw_dev, request_id, request_buffer, sizeof(request_buffer)); @@ -1555,10 +1556,10 @@ static int tw_scsiop_inquiry_complete(TW } is_unit_present = &(param->data[0]); - if (is_unit_present[tw_dev->srb[request_id]->device->id] & TW_UNIT_ONLINE) { - tw_dev->is_unit_present[tw_dev->srb[request_id]->device->id] = 1; + if (is_unit_present[scmd_id(tw_dev->srb[request_id])] & TW_UNIT_ONLINE) { + tw_dev->is_unit_present[scmd_id(tw_dev->srb[request_id])] = 1; } else { - tw_dev->is_unit_present[tw_dev->srb[request_id]->device->id] = 0; + tw_dev->is_unit_present[scmd_id(tw_dev->srb[request_id])] = 0; tw_dev->srb[request_id]->result = (DID_BAD_TARGET << 16); return TW_ISR_DONT_RESULT; } @@ -1609,7 +1610,8 @@ static int tw_scsiop_mode_sense(TW_Devic param = (TW_Param *)tw_dev->alignment_virtual_address[request_id]; memset(param, 0, sizeof(TW_Sector)); - param->table_id = TW_UNIT_INFORMATION_TABLE_BASE + tw_dev->srb[request_id]->device->id; + param->table_id = TW_UNIT_INFORMATION_TABLE_BASE + + scmd_id(tw_dev->srb[request_id]); param->parameter_id = 7; /* unit flags */ param->parameter_size_bytes = 1; param_value = tw_dev->alignment_physical_address[request_id]; @@ -1686,7 +1688,8 @@ static int tw_scsiop_read_capacity(TW_De command_packet->opcode__sgloffset = TW_OPSGL_IN(2, TW_OP_GET_PARAM); command_packet->size = 4; command_packet->request_id = request_id; - command_packet->unit__hostid = TW_UNITHOST_IN(0, tw_dev->srb[request_id]->device->id); + command_packet->unit__hostid = + TW_UNITHOST_IN(0, scmd_id(tw_dev->srb[request_id])); command_packet->status = 0; command_packet->flags = 0; command_packet->byte6.block_count = 1; @@ -1699,7 +1702,7 @@ static int tw_scsiop_read_capacity(TW_De param = (TW_Param *)tw_dev->alignment_virtual_address[request_id]; memset(param, 0, sizeof(TW_Sector)); param->table_id = TW_UNIT_INFORMATION_TABLE_BASE + - tw_dev->srb[request_id]->device->id; + scmd_id(tw_dev->srb[request_id]); param->parameter_id = 4; /* unitcapacity parameter */ param->parameter_size_bytes = 4; param_value = tw_dev->alignment_physical_address[request_id]; @@ -1799,7 +1802,7 @@ static int tw_scsiop_read_write(TW_Devic command_packet->size = 3; command_packet->request_id = request_id; - command_packet->unit__hostid = TW_UNITHOST_IN(0, srb->device->id); + command_packet->unit__hostid = TW_UNITHOST_IN(0, scmd_id(srb)); command_packet->status = 0; command_packet->flags = 0; @@ -1904,7 +1907,8 @@ static int tw_scsiop_synchronize_cache(T command_packet->opcode__sgloffset = TW_OPSGL_IN(0, TW_OP_FLUSH_CACHE); command_packet->size = 2; command_packet->request_id = request_id; - command_packet->unit__hostid = TW_UNITHOST_IN(0, tw_dev->srb[request_id]->device->id); + command_packet->unit__hostid = + TW_UNITHOST_IN(0, scmd_id(tw_dev->srb[request_id])); command_packet->status = 0; command_packet->flags = 0; command_packet->byte6.parameter_count = 1; diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c index 9d6040b..77deafa 100644 --- a/drivers/scsi/BusLogic.c +++ b/drivers/scsi/BusLogic.c @@ -2139,7 +2139,7 @@ static void __init BusLogic_InitializeHo static int BusLogic_SlaveConfigure(struct scsi_device *Device) { struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) Device->host->hostdata; - int TargetID = Device->id; + int TargetID = sdev_id(Device); int QueueDepth = HostAdapter->QueueDepth[TargetID]; if (HostAdapter->TargetFlags[TargetID].TaggedQueuingSupported && (HostAdapter->TaggedQueuingPermitted & (1 << TargetID))) { @@ -2744,7 +2744,7 @@ static int BusLogic_host_reset(struct sc { struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) SCpnt->device->host->hostdata; - unsigned int id = SCpnt->device->id; + unsigned int id = scmd_id(SCpnt); struct BusLogic_TargetStatistics *stats = &HostAdapter->TargetStatistics[id]; int rc; @@ -2960,7 +2960,7 @@ static int BusLogic_AbortCommand(struct { struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) Command->device->host->hostdata; - int TargetID = Command->device->id; + int TargetID = scmd_id(Command); struct BusLogic_CCB *CCB; BusLogic_IncrementErrorCounter(&HostAdapter->TargetStatistics[TargetID].CommandAbortsRequested); /* diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c index 9e2764f..511c7f2 100644 --- a/drivers/scsi/NCR5380.c +++ b/drivers/scsi/NCR5380.c @@ -976,15 +976,15 @@ static int NCR5380_queue_command(Scsi_Cm case WRITE: case WRITE_6: case WRITE_10: - hostdata->time_write[cmd->device->id] -= (jiffies - hostdata->timebase); - hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen; + hostdata->time_write[scmd_id(cmd)] -= (jiffies - hostdata->timebase); + hostdata->bytes_write[scmd_id(cmd)] += cmd->request_bufflen; hostdata->pendingw++; break; case READ: case READ_6: case READ_10: - hostdata->time_read[cmd->device->id] -= (jiffies - hostdata->timebase); - hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen; + hostdata->time_read[scmd_id(cmd)] -= (jiffies - hostdata->timebase); + hostdata->bytes_read[scmd_id(cmd)] += cmd->request_bufflen; hostdata->pendingr++; break; } diff --git a/drivers/scsi/NCR53C9x.c b/drivers/scsi/NCR53C9x.c index 26146a4..1173698 100644 --- a/drivers/scsi/NCR53C9x.c +++ b/drivers/scsi/NCR53C9x.c @@ -871,7 +871,7 @@ static int esp_host_info(struct NCR_ESP shost_for_each_device(sdev, esp->ehost) { struct esp_device *esp_dev = sdev->hostdata; - uint id = sdev->id; + uint id = sdev_id(sdev); if (!(esp->targets_present & (1 << id))) continue; @@ -3050,10 +3050,10 @@ static int check_multibyte_msg(struct NC else bit = ESP_CONFIG3_FSCSI; if(period < 50) - esp->config3[SCptr->device->id] |= bit; + esp->config3[scmd_id(SCptr)] |= bit; else - esp->config3[SCptr->device->id] &= ~bit; - esp->prev_cfg3 = esp->config3[SCptr->device->id]; + esp->config3[scmd_id(SCptr)] &= ~bit; + esp->prev_cfg3 = esp->config3[scmd_id(SCptr)]; esp_write(eregs->esp_cfg3, esp->prev_cfg3); } esp->prev_soff = esp_dev->sync_min_period; @@ -3083,8 +3083,8 @@ static int check_multibyte_msg(struct NC bit = ESP_CONFIG3_FAST; else bit = ESP_CONFIG3_FSCSI; - esp->config3[SCptr->device->id] &= ~bit; - esp->prev_cfg3 = esp->config3[SCptr->device->id]; + esp->config3[scmd_id(SCptr)] &= ~bit; + esp->prev_cfg3 = esp->config3[scmd_id(SCptr)]; esp_write(eregs->esp_cfg3, esp->prev_cfg3); } } diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 37ec541..e70de4c 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -3523,7 +3523,7 @@ typedef struct { typedef struct scsi_cmnd REQ, *REQP; #define REQPNEXT(reqp) ((REQP) ((reqp)->host_scribble)) #define REQPNEXTP(reqp) ((REQP *) &((reqp)->host_scribble)) -#define REQPTID(reqp) ((reqp)->device->id) +#define REQPTID(reqp) (scmd_id(reqp)) #define REQPTIME(reqp) ((reqp)->SCp.this_residual) #define REQTIMESTAMP() (jiffies) @@ -6243,7 +6243,7 @@ asc_execute_scsi_cmnd(struct scsi_cmnd * (ulong) scp, (ulong) scp->scsi_done); boardp = ASC_BOARDP(scp->device->host); - device = boardp->device[scp->device->id]; + device = boardp->device[scmd_id(scp)]; if (ASC_NARROW_BOARD(boardp)) { /* @@ -6278,7 +6278,7 @@ asc_execute_scsi_cmnd(struct scsi_cmnd * * Increment monotonically increasing per device successful * request counter. Wrapping doesn't matter. */ - boardp->reqcnt[scp->device->id]++; + boardp->reqcnt[scmd_id(scp)]++; asc_enqueue(&boardp->active, scp, ASC_BACK); ASC_DBG(1, "asc_execute_scsi_cmnd: AscExeScsiQueue(), ASC_NOERROR\n"); @@ -6358,7 +6358,7 @@ asc_execute_scsi_cmnd(struct scsi_cmnd * * Increment monotonically increasing per device successful * request counter. Wrapping doesn't matter. */ - boardp->reqcnt[scp->device->id]++; + boardp->reqcnt[scmd_id(scp)]++; asc_enqueue(&boardp->active, scp, ASC_BACK); ASC_DBG(1, "asc_execute_scsi_cmnd: AdvExeScsiQueue(), ASC_NOERROR\n"); @@ -6451,8 +6451,8 @@ asc_build_req(asc_board_t *boardp, struc * started request. * */ - if ((boardp->dvc_var.asc_dvc_var.cur_dvc_qng[scp->device->id] > 0) && - (boardp->reqcnt[scp->device->id] % 255) == 0) { + if ((boardp->dvc_var.asc_dvc_var.cur_dvc_qng[scmd_id(scp)] > 0) && + (boardp->reqcnt[scmd_id(scp)] % 255) == 0) { asc_scsi_q.q2.tag_code = MSG_ORDERED_TAG; } else { asc_scsi_q.q2.tag_code = MSG_SIMPLE_TAG; @@ -6962,10 +6962,10 @@ asc_isr_callback(ASC_DVC_VAR *asc_dvc_va * current request finished normally, then set the bit for the target * to indicate that a device is present. */ - if ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(scp->device->id)) == 0 && + if ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(scmd_id(scp))) == 0 && qdonep->d3.done_stat == QD_NO_ERROR && qdonep->d3.host_stat == QHSTA_NO_ERROR) { - boardp->init_tidmask |= ADV_TID_TO_TIDMASK(scp->device->id); + boardp->init_tidmask |= ADV_TID_TO_TIDMASK(scmd_id(scp)); } /* @@ -7141,10 +7141,10 @@ adv_isr_callback(ADV_DVC_VAR *adv_dvc_va * current request finished normally, then set the bit for the target * to indicate that a device is present. */ - if ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(scp->device->id)) == 0 && + if ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(scmd_id(scp))) == 0 && scsiqp->done_status == QD_NO_ERROR && scsiqp->host_status == QHSTA_NO_ERROR) { - boardp->init_tidmask |= ADV_TID_TO_TIDMASK(scp->device->id); + boardp->init_tidmask |= ADV_TID_TO_TIDMASK(scmd_id(scp)); } /* @@ -7384,7 +7384,8 @@ asc_dequeue_list(asc_queue_t *ascq, REQP { REQP reqp; for (reqp = firstp; reqp; reqp = REQPNEXT(reqp)) { - REQTIMESTAT("asc_dequeue_list", ascq, reqp, reqp->device->id); + REQTIMESTAT("asc_dequeue_list", ascq, reqp, + scmd_id(reqp)); } } #endif /* ADVANSYS_STATS */ diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c index 9b7caf5..692dc56 100644 --- a/drivers/scsi/aha152x.c +++ b/drivers/scsi/aha152x.c @@ -586,8 +586,8 @@ struct aha152x_scdata { #define DATA_LEN (HOSTDATA(shpnt)->data_len) -#define SYNCRATE (HOSTDATA(shpnt)->syncrate[CURRENT_SC->device->id]) -#define SYNCNEG (HOSTDATA(shpnt)->syncneg[CURRENT_SC->device->id]) +#define SYNCRATE (HOSTDATA(shpnt)->syncrate[scmd_id(CURRENT_SC)]) +#define SYNCNEG (HOSTDATA(shpnt)->syncneg[scmd_id(CURRENT_SC)]) #define DELAY (HOSTDATA(shpnt)->delay) #define EXT_TRANS (HOSTDATA(shpnt)->ext_trans) @@ -1660,7 +1660,7 @@ static void busfree_run(struct Scsi_Host /* clear selection timeout */ SETPORT(SSTAT1, SELTO); - SETPORT(SCSIID, (shpnt->this_id << OID_) | CURRENT_SC->device->id); + SETPORT(SCSIID, (shpnt->this_id << OID_) | scmd_id(CURRENT_SC)); SETPORT(SXFRCTL1, (PARITY ? ENSPCHK : 0 ) | ENSTIMER); SETPORT(SCSISEQ, ENSELO | ENAUTOATNO | (DISCONNECTED_SC ? ENRESELI : 0)); } else { diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index 1861407..df364dd 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c @@ -798,9 +798,9 @@ struct scsi_host_template aic7xxx_driver /******************************** Macros **************************************/ #define BUILD_SCSIID(ahc, cmd) \ - ((((cmd)->device->id << TID_SHIFT) & TID) \ - | (((cmd)->device->channel == 0) ? (ahc)->our_id : (ahc)->our_id_b) \ - | (((cmd)->device->channel == 0) ? 0 : TWIN_CHNLB)) + (((scmd_id(cmd) << TID_SHIFT) & TID) \ + | ((scmd_channel(cmd) == 0) ? (ahc)->our_id : (ahc)->our_id_b) \ + | ((scmd_channel(cmd) == 0) ? 0 : TWIN_CHNLB)) /******************************** Bus DMA *************************************/ int @@ -1440,7 +1440,7 @@ ahc_linux_run_command(struct ahc_softc * && (ahc->features & AHC_SCB_BTT) == 0) { int target_offset; - target_offset = cmd->device->id + cmd->device->channel * 8; + target_offset = scmd_id(cmd) + scmd_channel(cmd) * 8; untagged_q = &(ahc->untagged_queues[target_offset]); if (!TAILQ_EMPTY(untagged_q)) /* if we're already executing an untagged command diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c index c44af57..be4342b 100644 --- a/drivers/scsi/dc395x.c +++ b/drivers/scsi/dc395x.c @@ -1647,7 +1647,7 @@ static u8 start_scsi(struct AdapterCtlBl /*polling:*/ /* Send CDB ..command block ......... */ dprintkdbg(DBG_KG, "start_scsi: (pid#%li) <%02i-%i> cmnd=0x%02x tag=%i\n", - srb->cmd->pid, srb->cmd->device->id, srb->cmd->device->lun, + srb->cmd->pid, scmd_id(srb->cmd), srb->cmd->device->lun, srb->cmd->cmnd[0], srb->tag_number); if (srb->flag & AUTO_REQSENSE) { DC395x_write8(acb, TRM_S1040_SCSI_FIFO, REQUEST_SENSE); @@ -2102,7 +2102,7 @@ static void data_out_phase0(struct Adapt u16 scsi_status = *pscsi_status; u32 d_left_counter = 0; dprintkdbg(DBG_0, "data_out_phase0: (pid#%li) <%02i-%i>\n", - srb->cmd->pid, srb->cmd->device->id, srb->cmd->device->lun); + srb->cmd->pid, scmd_id(srb->cmd), srb->cmd->device->lun); /* * KG: We need to drain the buffers before we draw any conclusions! @@ -2232,7 +2232,7 @@ static void data_out_phase1(struct Adapt u16 *pscsi_status) { dprintkdbg(DBG_0, "data_out_phase1: (pid#%li) <%02i-%i>\n", - srb->cmd->pid, srb->cmd->device->id, srb->cmd->device->lun); + srb->cmd->pid, scmd_id(srb->cmd), srb->cmd->device->lun); clear_fifo(acb, "data_out_phase1"); /* do prepare before transfer when data out phase */ data_io_transfer(acb, srb, XFERDATAOUT); @@ -2245,7 +2245,7 @@ static void data_in_phase0(struct Adapte u16 scsi_status = *pscsi_status; u32 d_left_counter = 0; dprintkdbg(DBG_0, "data_in_phase0: (pid#%li) <%02i-%i>\n", - srb->cmd->pid, srb->cmd->device->id, srb->cmd->device->lun); + srb->cmd->pid, scmd_id(srb->cmd), srb->cmd->device->lun); /* * KG: DataIn is much more tricky than DataOut. When the device is finished @@ -2419,7 +2419,7 @@ static void data_in_phase1(struct Adapte u16 *pscsi_status) { dprintkdbg(DBG_0, "data_in_phase1: (pid#%li) <%02i-%i>\n", - srb->cmd->pid, srb->cmd->device->id, srb->cmd->device->lun); + srb->cmd->pid, scmd_id(srb->cmd), srb->cmd->device->lun); data_io_transfer(acb, srb, XFERDATAIN); } @@ -2431,7 +2431,7 @@ static void data_io_transfer(struct Adap u8 bval; dprintkdbg(DBG_0, "data_io_transfer: (pid#%li) <%02i-%i> %c len=%i, sg=(%i/%i)\n", - srb->cmd->pid, srb->cmd->device->id, srb->cmd->device->lun, + srb->cmd->pid, scmd_id(srb->cmd), srb->cmd->device->lun, ((io_dir & DMACMD_DIR) ? 'r' : 'w'), srb->total_xfer_length, srb->sg_index, srb->sg_count); if (srb == acb->tmp_srb) @@ -2589,7 +2589,7 @@ static void status_phase0(struct Adapter u16 *pscsi_status) { dprintkdbg(DBG_0, "status_phase0: (pid#%li) <%02i-%i>\n", - srb->cmd->pid, srb->cmd->device->id, srb->cmd->device->lun); + srb->cmd->pid, scmd_id(srb->cmd), srb->cmd->device->lun); srb->target_status = DC395x_read8(acb, TRM_S1040_SCSI_FIFO); srb->end_message = DC395x_read8(acb, TRM_S1040_SCSI_FIFO); /* get message */ srb->state = SRB_COMPLETED; @@ -2603,7 +2603,7 @@ static void status_phase1(struct Adapter u16 *pscsi_status) { dprintkdbg(DBG_0, "status_phase1: (pid#%li) <%02i-%i>\n", - srb->cmd->pid, srb->cmd->device->id, srb->cmd->device->lun); + srb->cmd->pid, scmd_id(srb->cmd), srb->cmd->device->lun); srb->state = SRB_STATUS; DC395x_write16(acb, TRM_S1040_SCSI_CONTROL, DO_DATALATCH); /* it's important for atn stop */ DC395x_write8(acb, TRM_S1040_SCSI_COMMAND, SCMD_COMP); @@ -3515,7 +3515,7 @@ static void srb_done(struct AdapterCtlBl if (srb->total_xfer_length) dprintkdbg(DBG_KG, "srb_done: (pid#%li) <%02i-%i> " "cmnd=0x%02x Missed %i bytes\n", - cmd->pid, cmd->device->id, cmd->device->lun, + cmd->pid, scmd_id(cmd), cmd->device->lun, cmd->cmnd[0], srb->total_xfer_length); } @@ -3694,7 +3694,7 @@ static void request_sense(struct Adapter { struct scsi_cmnd *cmd = srb->cmd; dprintkdbg(DBG_1, "request_sense: (pid#%li) <%02i-%i>\n", - cmd->pid, cmd->device->id, cmd->device->lun); + cmd->pid, scmd_id(cmd), cmd->device->lun); srb->flag |= AUTO_REQSENSE; srb->adapter_status = 0; @@ -3922,7 +3922,7 @@ static int dc395x_slave_alloc(struct scs struct AdapterCtlBlk *acb = (struct AdapterCtlBlk *)scsi_device->host->hostdata; struct DeviceCtlBlk *dcb; - dcb = device_alloc(acb, scsi_device->id, scsi_device->lun); + dcb = device_alloc(acb, sdev_id(scsi_device), scsi_device->lun); if (!dcb) return -ENOMEM; adapter_add_device(acb, dcb); @@ -3940,7 +3940,7 @@ static int dc395x_slave_alloc(struct scs static void dc395x_slave_destroy(struct scsi_device *scsi_device) { struct AdapterCtlBlk *acb = (struct AdapterCtlBlk *)scsi_device->host->hostdata; - struct DeviceCtlBlk *dcb = find_dcb(acb, scsi_device->id, scsi_device->lun); + struct DeviceCtlBlk *dcb = find_dcb(acb, sdev_id(scsi_device), scsi_device->lun); if (dcb) adapter_remove_and_free_device(acb, dcb); } diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c index cd0fc64..f7b2f63 100644 --- a/drivers/scsi/eata.c +++ b/drivers/scsi/eata.c @@ -2440,9 +2440,7 @@ static irqreturn_t ihdlr(int irq, struct /* If there was a bus reset, redo operation on each target */ else if (tstatus != GOOD && SCpnt->device->type == TYPE_DISK - && ha->target_redo[SCpnt->device->id][SCpnt-> - device-> - channel]) + && ha->target_redo[scmd_id(SCpnt)][scmd_channel(SCpnt)]) status = DID_BUS_BUSY << 16; /* Works around a flaw in scsi.c */ @@ -2475,12 +2473,11 @@ static irqreturn_t ihdlr(int irq, struct case ASST: /* Selection Time Out */ case 0x02: /* Command Time Out */ - if (ha->target_to[SCpnt->device->id][SCpnt->device->channel] > 1) + if (ha->target_to[scmd_id(SCpnt)][scmd_channel(SCpnt)] > 1) status = DID_ERROR << 16; else { status = DID_TIME_OUT << 16; - ha->target_to[SCpnt->device->id][SCpnt->device-> - channel]++; + ha->target_to[scmd_id(SCpnt)][scmd_channel(SCpnt)]++; } break; diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c index a3aa729..de3b6d0 100644 --- a/drivers/scsi/g_NCR5380.c +++ b/drivers/scsi/g_NCR5380.c @@ -834,12 +834,12 @@ static int generic_NCR5380_proc_info(str if (hostdata->pendingr || hostdata->pendingw) PRINTP("\n"); shost_for_each_device(dev, scsi_ptr) { - unsigned long br = hostdata->bytes_read[dev->id]; - unsigned long bw = hostdata->bytes_write[dev->id]; - long tr = hostdata->time_read[dev->id] / HZ; - long tw = hostdata->time_write[dev->id] / HZ; + unsigned long br = hostdata->bytes_read[sdev_id(dev)]; + unsigned long bw = hostdata->bytes_write[sdev_id(dev)]; + long tr = hostdata->time_read[sdev_id(dev)] / HZ; + long tw = hostdata->time_write[sdev_id(dev)] / HZ; - PRINTP(" T:%d %s " ANDP dev->id ANDP(dev->type < MAX_SCSI_DEVICE_CODE) ? scsi_device_types[(int) dev->type] : "Unknown"); + PRINTP(" T:%d %s " ANDP sdev_id(dev) ANDP(dev->type < MAX_SCSI_DEVICE_CODE) ? scsi_device_types[(int) dev->type] : "Unknown"); for (i = 0; i < 8; i++) if (dev->vendor[i] >= 0x20) *(buffer + (len++)) = dev->vendor[i]; diff --git a/drivers/scsi/gdth_proc.c b/drivers/scsi/gdth_proc.c index 1bd02f8..dc8863b 100644 --- a/drivers/scsi/gdth_proc.c +++ b/drivers/scsi/gdth_proc.c @@ -951,8 +951,8 @@ static void gdth_wait_completion(int han for (i = 0; i < GDTH_MAXCMDS; ++i) { scp = ha->cmd_tab[i].cmnd; - b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel; - t = scp->device->id; + b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scmd_channel(scp); + t = scmd_id(scp); if (!SPECIAL_SCP(scp) && t == (unchar)id && b == (unchar)busnum) { scp->SCp.have_data_in = 0; @@ -976,8 +976,8 @@ static void gdth_stop_timeout(int hanum, spin_lock_irqsave(&ha->smp_lock, flags); for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) { - b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel; - t = scp->device->id; + b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scmd_channel(scp); + t = scmd_id(scp); if (t == (unchar)id && b == (unchar)busnum) { TRACE2(("gdth_stop_timeout(): update_timeout()\n")); scp->SCp.buffers_residual = gdth_update_timeout(hanum, scp, 0); @@ -997,8 +997,8 @@ static void gdth_start_timeout(int hanum spin_lock_irqsave(&ha->smp_lock, flags); for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) { - b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel; - t = scp->device->id; + b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scmd_channel(scp); + t = scmd_id(scp); if (t == (unchar)id && b == (unchar)busnum) { TRACE2(("gdth_start_timeout(): update_timeout()\n")); gdth_update_timeout(hanum, scp, scp->SCp.buffers_residual); diff --git a/drivers/scsi/in2000.c b/drivers/scsi/in2000.c index fe387b5..e6e49c0 100644 --- a/drivers/scsi/in2000.c +++ b/drivers/scsi/in2000.c @@ -493,7 +493,7 @@ static void in2000_execute(struct Scsi_H hostdata->input_Q = (Scsi_Cmnd *) cmd->host_scribble; #ifdef PROC_STATISTICS - hostdata->cmd_cnt[cmd->device->id]++; + hostdata->cmd_cnt[scmd_id(cmd)]++; #endif /* @@ -501,9 +501,9 @@ static void in2000_execute(struct Scsi_H */ if (is_dir_out(cmd)) - write_3393(hostdata, WD_DESTINATION_ID, cmd->device->id); + write_3393(hostdata, WD_DESTINATION_ID, scmd_id(cmd)); else - write_3393(hostdata, WD_DESTINATION_ID, cmd->device->id | DSTID_DPD); + write_3393(hostdata, WD_DESTINATION_ID, scmd_id(cmd) | DSTID_DPD); /* Now we need to figure out whether or not this command is a good * candidate for disconnect/reselect. We guess to the best of our @@ -584,11 +584,11 @@ static void in2000_execute(struct Scsi_H * unless we don't want to even _try_ synchronous transfers: In this * case we set SS_SET to make the defaults final. */ - if (hostdata->sync_stat[cmd->device->id] == SS_UNSET) { - if (hostdata->sync_off & (1 << cmd->device->id)) - hostdata->sync_stat[cmd->device->id] = SS_SET; + if (hostdata->sync_stat[scmd_id(cmd)] == SS_UNSET) { + if (hostdata->sync_off & (1 << scmd_id(cmd))) + hostdata->sync_stat[scmd_id(cmd)] = SS_SET; else - hostdata->sync_stat[cmd->device->id] = SS_FIRST; + hostdata->sync_stat[scmd_id(cmd)] = SS_FIRST; } hostdata->state = S_SELECTING; write_3393_count(hostdata, 0); /* this guarantees a DATA_PHASE interrupt */ @@ -769,7 +769,7 @@ static void transfer_bytes(Scsi_Cmnd * c /* Set up hardware registers */ - write_3393(hostdata, WD_SYNCHRONOUS_TRANSFER, hostdata->sync_xfer[cmd->device->id]); + write_3393(hostdata, WD_SYNCHRONOUS_TRANSFER, hostdata->sync_xfer[scmd_id(cmd)]); write_3393_count(hostdata, cmd->SCp.this_residual); write_3393(hostdata, WD_CONTROL, CTRL_IDI | CTRL_EDI | CTRL_BUS); write1_io(0, IO_FIFO_WRITE); /* zero counter, assume write */ @@ -1224,8 +1224,8 @@ static irqreturn_t in2000_intr(int irqnu #ifdef SYNC_DEBUG printk("-REJ-"); #endif - if (hostdata->sync_stat[cmd->device->id] == SS_WAITING) - hostdata->sync_stat[cmd->device->id] = SS_SET; + if (hostdata->sync_stat[scmd_id(cmd)] == SS_WAITING) + hostdata->sync_stat[scmd_id(cmd)] = SS_SET; write_3393_cmd(hostdata, WD_CMD_NEGATE_ACK); hostdata->state = S_CONNECTED; break; @@ -1245,7 +1245,7 @@ static irqreturn_t in2000_intr(int irqnu switch (ucp[2]) { /* what's the EXTENDED code? */ case EXTENDED_SDTR: id = calc_sync_xfer(ucp[3], ucp[4]); - if (hostdata->sync_stat[cmd->device->id] != SS_WAITING) { + if (hostdata->sync_stat[scmd_id(cmd)] != SS_WAITING) { /* A device has sent an unsolicited SDTR message; rather than go * through the effort of decoding it and then figuring out what @@ -1263,14 +1263,14 @@ static irqreturn_t in2000_intr(int irqnu hostdata->outgoing_msg[3] = hostdata->default_sx_per / 4; hostdata->outgoing_msg[4] = 0; hostdata->outgoing_len = 5; - hostdata->sync_xfer[cmd->device->id] = calc_sync_xfer(hostdata->default_sx_per / 4, 0); + hostdata->sync_xfer[scmd_id(cmd)] = calc_sync_xfer(hostdata->default_sx_per / 4, 0); } else { - hostdata->sync_xfer[cmd->device->id] = id; + hostdata->sync_xfer[scmd_id(cmd)] = id; } #ifdef SYNC_DEBUG - printk("sync_xfer=%02x", hostdata->sync_xfer[cmd->device->id]); + printk("sync_xfer=%02x", hostdata->sync_xfer[scmd_id(cmd)]); #endif - hostdata->sync_stat[cmd->device->id] = SS_SET; + hostdata->sync_stat[scmd_id(cmd)] = SS_SET; write_3393_cmd(hostdata, WD_CMD_NEGATE_ACK); hostdata->state = S_CONNECTED; break; @@ -1465,7 +1465,7 @@ static irqreturn_t in2000_intr(int irqnu hostdata->state = S_UNCONNECTED; #ifdef PROC_STATISTICS - hostdata->disc_done_cnt[cmd->device->id]++; + hostdata->disc_done_cnt[scmd_id(cmd)]++; #endif break; @@ -1562,9 +1562,9 @@ static irqreturn_t in2000_intr(int irqnu */ if (is_dir_out(cmd)) - write_3393(hostdata, WD_DESTINATION_ID, cmd->device->id); + write_3393(hostdata, WD_DESTINATION_ID, scmd_id(cmd)); else - write_3393(hostdata, WD_DESTINATION_ID, cmd->device->id | DSTID_DPD); + write_3393(hostdata, WD_DESTINATION_ID, scmd_id(cmd) | DSTID_DPD); if (hostdata->level2 >= L2_RESELECT) { write_3393_count(hostdata, 0); /* we want a DATA_PHASE interrupt */ write_3393(hostdata, WD_COMMAND_PHASE, 0x45); diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c index ea6f3c0..c1404fb 100644 --- a/drivers/scsi/initio.c +++ b/drivers/scsi/initio.c @@ -3019,7 +3019,7 @@ static int i91u_biosparam(struct scsi_de TCS *pTcb; pHcb = (HCS *) sdev->host->base; - pTcb = &pHcb->HCS_Tcs[sdev->id]; + pTcb = &pHcb->HCS_Tcs[sdev_id(sdev)]; if (pTcb->TCS_DrvHead) { info_array[0] = pTcb->TCS_DrvHead; diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index babd483..91746e7 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c @@ -3758,7 +3758,8 @@ static void ipr_erp_start(struct ipr_ioa * will give CC/UA the next command. */ if (!res->resetting_device) - scsi_report_bus_reset(ioa_cfg->host, scsi_cmd->device->channel); + scsi_report_bus_reset(ioa_cfg->host, + scmd_channel(scsi_cmd)); scsi_cmd->result |= (DID_ERROR << 16); res->needs_sync_complete = 1; break; diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index 5885888..43efa56 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c @@ -342,12 +342,12 @@ int ata_scsi_slave_config(struct scsi_de blk_queue_max_phys_segments(sdev->request_queue, LIBATA_MAX_PRD); - if (sdev->id < ATA_MAX_DEVICES) { + if (sdev_id(sdev) < ATA_MAX_DEVICES) { struct ata_port *ap; struct ata_device *dev; ap = (struct ata_port *) &sdev->host->hostdata[0]; - dev = &ap->device[sdev->id]; + dev = &ap->device[sdev_id(sdev)]; /* TODO: 1024 is an arbitrary number, not the * hardware maximum. This should be increased to diff --git a/drivers/scsi/megaraid/mega_common.h b/drivers/scsi/megaraid/mega_common.h index 69df1a9..7fb6788 100644 --- a/drivers/scsi/megaraid/mega_common.h +++ b/drivers/scsi/megaraid/mega_common.h @@ -223,7 +223,7 @@ typedef struct { (SCP2CHANNEL(scp) == (adp)->max_channel) ? 1 : 0 #define MRAID_IS_LOGICAL_SDEV(adp, sdev) \ - (sdev->channel == (adp)->max_channel) ? 1 : 0 + (sdev_channel(sdev) == (adp)->max_channel) ? 1 : 0 #define MRAID_GET_DEVICE_MAP(adp, scp, p_chan, target, islogical) \ /* \ diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c index d47be8e..8236fd4 100644 --- a/drivers/scsi/megaraid/megaraid_mbox.c +++ b/drivers/scsi/megaraid/megaraid_mbox.c @@ -4165,15 +4165,15 @@ megaraid_sysfs_show_ldnum(struct device for (i = 0; i < MAX_LOGICAL_DRIVES_40LD; i++) { - mapped_sdev_id = sdev->id; + mapped_sdev_id = sdev_id(sdev); - if (sdev->id > adapter->init_id) { + if (sdev_id(sdev) > adapter->init_id) { mapped_sdev_id -= 1; } if (raid_dev->curr_ldmap[i] == mapped_sdev_id) { - scsi_id = sdev->id; + scsi_id = sdev_id(sdev); logical_drv = i; diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c index 4245d05..87a6103 100644 --- a/drivers/scsi/megaraid/megaraid_sas.c +++ b/drivers/scsi/megaraid/megaraid_sas.c @@ -581,7 +581,7 @@ static inline struct megasas_cmd *megasa */ if (logical_cmd) { - if (scp->device->id >= MEGASAS_MAX_LD) { + if (scmd_id(scp) >= MEGASAS_MAX_LD) { scp->result = DID_BAD_TARGET << 16; return NULL; } diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index eaec9d5..3b5cf42 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -1059,11 +1059,11 @@ struct megasas_instance { }; #define MEGASAS_IS_LOGICAL(scp) \ - (scp->device->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1 + (scmd_channel(scp) < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1 #define MEGASAS_DEV_INDEX(inst, scp) \ - ((scp->device->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + \ - scp->device->id + ((scmd_channel(scp) % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + \ + scmd_id(scp) struct megasas_cmd { diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c index 2434709..858101b 100644 --- a/drivers/scsi/ncr53c8xx.c +++ b/drivers/scsi/ncr53c8xx.c @@ -4245,7 +4245,7 @@ void ncr_complete (struct ncb *np, struc ** Allocate the lcb if not yet. */ if (!lp) - ncr_alloc_lcb (np, cmd->device->id, cmd->device->lun); + ncr_alloc_lcb (np, scmd_id(cmd), cmd->device->lun); tp->bytes += cp->data_len; tp->transfers ++; diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c index e4ff4f0..cd6920f 100644 --- a/drivers/scsi/nsp32.c +++ b/drivers/scsi/nsp32.c @@ -961,7 +961,7 @@ static int nsp32_queuecommand(struct scs nsp32_dbg(NSP32_DEBUG_QUEUECOMMAND, "enter. target: 0x%x LUN: 0x%x cmnd: 0x%x cmndlen: 0x%x " "use_sg: 0x%x reqbuf: 0x%lx reqlen: 0x%x", - SCpnt->device->id, SCpnt->device->lun, SCpnt->cmnd[0], SCpnt->cmd_len, + scmd_id(SCpnt), SCpnt->device->lun, SCpnt->cmnd[0], SCpnt->cmd_len, SCpnt->use_sg, SCpnt->request_buffer, SCpnt->request_bufflen); if (data->CurrentSC != NULL) { @@ -1074,7 +1074,7 @@ static int nsp32_queuecommand(struct scs nsp32_dbg(NSP32_DEBUG_TARGETFLAG, "target: %d sync_flag: 0x%x syncreg: 0x%x ackwidth: 0x%x", - SCpnt->device->id, target->sync_flag, target->syncreg, + scmd_id(SCpnt), target->sync_flag, target->syncreg, target->ackwidth); /* Selection */ diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index 3d2f710..2fe9532 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c @@ -1051,7 +1051,7 @@ static irqreturn_t nspintr(int irq, void } tmpSC = data->CurrentSC; - target = tmpSC->device->id; + target = scmd_id(tmpSC); lun = tmpSC->device->lun; sync_neg = &(data->Sync[target].SyncNegotiation); diff --git a/drivers/scsi/psi240i.c b/drivers/scsi/psi240i.c index 4322c95..df19d7e 100644 --- a/drivers/scsi/psi240i.c +++ b/drivers/scsi/psi240i.c @@ -394,7 +394,7 @@ static int Psi240i_QueueCommand (Scsi_Cm { UCHAR *cdb = (UCHAR *)SCpnt->cmnd; // Pointer to SCSI CDB PADAPTER240I padapter = HOSTDATA (SCpnt->device->host); // Pointer to adapter control structure - POUR_DEVICE pdev = &padapter->device [SCpnt->device->id];// Pointer to device information + POUR_DEVICE pdev = &padapter->device [scmd_id(SCpnt)];// Pointer to device information UCHAR rc; // command return code SCpnt->scsi_done = done; diff --git a/drivers/scsi/qlogicfc.c b/drivers/scsi/qlogicfc.c index a4b3b3f..56110e3 100644 --- a/drivers/scsi/qlogicfc.c +++ b/drivers/scsi/qlogicfc.c @@ -1325,9 +1325,9 @@ static int isp2x00_queuecommand(Scsi_Cmn cmd->control_flags = cpu_to_le16(CFLAG_READ); if (Cmnd->device->tagged_supported) { - if ((jiffies - hostdata->tag_ages[Cmnd->device->id]) > (2 * ISP_TIMEOUT)) { + if ((jiffies - hostdata->tag_ages[scmd_id(Cmnd)]) > (2 * ISP_TIMEOUT)) { cmd->control_flags |= cpu_to_le16(CFLAG_ORDERED_TAG); - hostdata->tag_ages[Cmnd->device->id] = jiffies; + hostdata->tag_ages[scmd_id(Cmnd)] = jiffies; } else switch (Cmnd->tag) { case HEAD_OF_QUEUE_TAG: diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c index d76766c..5c2a086 100644 --- a/drivers/scsi/sym53c8xx_2/sym_glue.c +++ b/drivers/scsi/sym53c8xx_2/sym_glue.c @@ -357,7 +357,7 @@ void sym_set_cam_result_error(struct sym * condition otherwise the device will always return * BUSY. Use a big stick. */ - sym_reset_scsi_target(np, cmd->device->id); + sym_reset_scsi_target(np, scmd_id(cmd)); cam_status = DID_ERROR; } } else if (cp->host_status == HS_COMPLETE) /* Bad SCSI status */ @@ -470,7 +470,7 @@ static int sym_queue_command(struct sym_ * Minimal checkings, so that we will not * go outside our tables. */ - if (sdev->id == np->myaddr) { + if (sdev_id(sdev) == np->myaddr) { sym_xpt_done2(np, cmd, DID_NO_CONNECT); return 0; } @@ -804,7 +804,7 @@ prepare: sts = sym_abort_scsiio(np, cmd, 1); break; case SYM_EH_DEVICE_RESET: - sts = sym_reset_scsi_target(np, cmd->device->id); + sts = sym_reset_scsi_target(np, scmd_id(cmd)); break; case SYM_EH_BUS_RESET: sym_reset_scsi_bus(np, 1); @@ -1015,7 +1015,7 @@ static int sym53c8xx_slave_alloc(struct static int sym53c8xx_slave_configure(struct scsi_device *device) { struct sym_hcb *np = sym_get_hcb(device->host); - struct sym_tcb *tp = &np->target[device->id]; + struct sym_tcb *tp = &np->target[sdev_id(device)]; struct sym_lcb *lp; int reqtags, depth_to_use; @@ -1023,7 +1023,7 @@ static int sym53c8xx_slave_configure(str * Allocate the LCB if not yet. * If it fail, we may well be in the sh*t. :) */ - lp = sym_alloc_lcb(np, device->id, device->lun); + lp = sym_alloc_lcb(np, sdev_id(device), device->lun); if (!lp) return -ENOMEM; - : send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html