From: Hannes Reinecke <[email protected]>

Drop references to scsi_cmnd->serial_number.

Signed-off-by: Hannes Reinecke <[email protected]>
---
 drivers/scsi/dpt_i2o.c | 34 +++++-----------------------------
 1 file changed, 5 insertions(+), 29 deletions(-)

diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 70d1a18278af..22fcb7cecbbf 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -593,7 +593,7 @@ static int adpt_show_info(struct seq_file *m, struct 
Scsi_Host *host)
  */
 static u32 adpt_cmd_to_context(struct scsi_cmnd *cmd)
 {
-       return (u32)cmd->serial_number;
+       return (u32)cmd->request->tag + 1;
 }
 
 /*
@@ -604,28 +604,12 @@ static struct scsi_cmnd *
        adpt_cmd_from_context(adpt_hba * pHba, u32 context)
 {
        struct scsi_cmnd * cmd;
-       struct scsi_device * d;
-
-       if (context == 0)
-               return NULL;
 
        spin_unlock(pHba->host->host_lock);
-       shost_for_each_device(d, pHba->host) {
-               unsigned long flags;
-               spin_lock_irqsave(&d->list_lock, flags);
-               list_for_each_entry(cmd, &d->cmd_list, list) {
-                       if (((u32)cmd->serial_number == context)) {
-                               spin_unlock_irqrestore(&d->list_lock, flags);
-                               scsi_device_put(d);
-                               spin_lock(pHba->host->host_lock);
-                               return cmd;
-                       }
-               }
-               spin_unlock_irqrestore(&d->list_lock, flags);
-       }
+       cmd = scsi_host_find_tag(pHba->host, context - 1);
        spin_lock(pHba->host->host_lock);
 
-       return NULL;
+       return cmd;
 }
 
 /*
@@ -685,9 +669,6 @@ static int adpt_abort(struct scsi_cmnd * cmd)
        u32 msg[5];
        int rcode;
 
-       if(cmd->serial_number == 0){
-               return FAILED;
-       }
        pHba = (adpt_hba*) cmd->device->host->hostdata[0];
        printk(KERN_INFO"%s: Trying to Abort\n",pHba->name);
        if ((dptdevice = (void*) (cmd->device->hostdata)) == NULL) {
@@ -2209,9 +2190,7 @@ static irqreturn_t adpt_isr(int irq, void *dev_id)
                        cmd = adpt_cmd_from_context (pHba, readl(reply+12));
                        if(cmd != NULL){
                                scsi_dma_unmap(cmd);
-                               if(cmd->serial_number != 0) { // If not timedout
-                                       adpt_i2o_to_scsi(reply, cmd);
-                               }
+                               adpt_i2o_to_scsi(reply, cmd);
                        }
                }
                writel(m, pHba->reply_port);
@@ -2277,7 +2256,7 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct 
scsi_cmnd* cmd, struct adpt_d
        // I2O_CMD_SCSI_EXEC
        msg[1] = ((0xff<<24)|(HOST_TID<<12)|d->tid);
        msg[2] = 0;
-       msg[3] = adpt_cmd_to_context(cmd);  /* Want SCSI control block back */
+       msg[3] = adpt_cmd_to_context(cmd);
        // Our cards use the transaction context as the tag for queueing
        // Adaptec/DPT Private stuff 
        msg[4] = I2O_CMD_SCSI_EXEC|(DPT_ORGANIZATION_ID<<16);
@@ -2693,9 +2672,6 @@ static void adpt_fail_posted_scbs(adpt_hba* pHba)
                unsigned long flags;
                spin_lock_irqsave(&d->list_lock, flags);
                list_for_each_entry(cmd, &d->cmd_list, list) {
-                       if(cmd->serial_number == 0){
-                               continue;
-                       }
                        cmd->result = (DID_OK << 16) | (QUEUE_FULL <<1);
                        cmd->scsi_done(cmd);
                }
-- 
2.16.4

Reply via email to