From: Vikas Chaudhary Date: Wed, 28 Apr 2010 06:11:59 +0000 (+0530) Subject: [SCSI] qla4xxx: correct use of cmd->host_scribble X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=5369887a95da9509163931b21f61a94da09dac15;p=linux-beck.git [SCSI] qla4xxx: correct use of cmd->host_scribble used cmd->host_scribble to store iocb command handle. Signed-off-by: Vikas Chaudhary Signed-off-by: Ravi Anand Reviewed-by: Mike Christie Signed-off-by: James Bottomley --- diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h index 1e56b8ee19bb..b6f2d0152454 100644 --- a/drivers/scsi/qla4xxx/ql4_def.h +++ b/drivers/scsi/qla4xxx/ql4_def.h @@ -148,6 +148,8 @@ #define MAX_RESET_HA_RETRIES 2 +#define CMD_SP(Cmnd) ((Cmnd)->SCp.ptr) + /* * SCSI Request Block structure (srb) that is placed * on cmd->SCp location of every I/O [We have 22 bytes available] diff --git a/drivers/scsi/qla4xxx/ql4_iocb.c b/drivers/scsi/qla4xxx/ql4_iocb.c index e0c32159749c..e66f3f263f49 100644 --- a/drivers/scsi/qla4xxx/ql4_iocb.c +++ b/drivers/scsi/qla4xxx/ql4_iocb.c @@ -299,7 +299,7 @@ int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb * srb) qla4xxx_build_scsi_iocbs(srb, cmd_entry, tot_dsds); wmb(); - srb->cmd->host_scribble = (unsigned char *)srb; + srb->cmd->host_scribble = (unsigned char *)(unsigned long)index; /* update counters */ srb->state = SRB_ACTIVE_STATE; diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index d6c8b429a675..2ca43f0ebcd6 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -389,7 +389,7 @@ static struct srb* qla4xxx_get_new_srb(struct scsi_qla_host *ha, srb->ddb = ddb_entry; srb->cmd = cmd; srb->flags = 0; - cmd->SCp.ptr = (void *)srb; + CMD_SP(cmd) = (void *)srb; cmd->scsi_done = done; return srb; @@ -403,7 +403,7 @@ static void qla4xxx_srb_free_dma(struct scsi_qla_host *ha, struct srb *srb) scsi_dma_unmap(cmd); srb->flags &= ~SRB_DMA_VALID; } - cmd->SCp.ptr = NULL; + CMD_SP(cmd) = NULL; } void qla4xxx_srb_compl(struct scsi_qla_host *ha, struct srb *srb) @@ -891,7 +891,6 @@ static void qla4xxx_flush_active_srbs(struct scsi_qla_host *ha) } } spin_unlock_irqrestore(&ha->hardware_lock, flags); - } /** @@ -1479,12 +1478,14 @@ static void qla4xxx_slave_destroy(struct scsi_device *sdev) struct srb * qla4xxx_del_from_active_array(struct scsi_qla_host *ha, uint32_t index) { struct srb *srb = NULL; - struct scsi_cmnd *cmd; + struct scsi_cmnd *cmd = NULL; - if (!(cmd = scsi_host_find_tag(ha->host, index))) + cmd = scsi_host_find_tag(ha->host, index); + if (!cmd) return srb; - if (!(srb = (struct srb *)cmd->host_scribble)) + srb = (struct srb *)CMD_SP(cmd); + if (!srb) return srb; /* update counters */ @@ -1492,7 +1493,8 @@ struct srb * qla4xxx_del_from_active_array(struct scsi_qla_host *ha, uint32_t in ha->req_q_count += srb->iocb_cnt; ha->iocb_cnt -= srb->iocb_cnt; if (srb->cmd) - srb->cmd->host_scribble = NULL; + srb->cmd->host_scribble = + (unsigned char *)(unsigned long) MAX_SRBS; } return srb; } @@ -1514,7 +1516,7 @@ static int qla4xxx_eh_wait_on_command(struct scsi_qla_host *ha, do { /* Checking to see if its returned to OS */ - rp = (struct srb *) cmd->SCp.ptr; + rp = (struct srb *) CMD_SP(cmd); if (rp == NULL) { done++; break;