Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5369887a authored by Vikas Chaudhary's avatar Vikas Chaudhary Committed by James Bottomley
Browse files

[SCSI] qla4xxx: correct use of cmd->host_scribble



used cmd->host_scribble to store iocb command handle.

Signed-off-by: default avatarVikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: default avatarRavi Anand <ravi.anand@qlogic.com>
Reviewed-by: default avatarMike Christie <michaelc@cs.wisc.edu>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent 821d6e54
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -148,6 +148,8 @@


#define MAX_RESET_HA_RETRIES		2
#define MAX_RESET_HA_RETRIES		2


#define CMD_SP(Cmnd)			((Cmnd)->SCp.ptr)

/*
/*
 * SCSI Request Block structure	 (srb)	that is placed
 * SCSI Request Block structure	 (srb)	that is placed
 * on cmd->SCp location of every I/O	 [We have 22 bytes available]
 * on cmd->SCp location of every I/O	 [We have 22 bytes available]
+1 −1
Original line number Original line Diff line number Diff line
@@ -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);
	qla4xxx_build_scsi_iocbs(srb, cmd_entry, tot_dsds);
	wmb();
	wmb();


	srb->cmd->host_scribble = (unsigned char *)srb;
	srb->cmd->host_scribble = (unsigned char *)(unsigned long)index;


	/* update counters */
	/* update counters */
	srb->state = SRB_ACTIVE_STATE;
	srb->state = SRB_ACTIVE_STATE;
+10 −8
Original line number Original line Diff line number Diff line
@@ -389,7 +389,7 @@ static struct srb* qla4xxx_get_new_srb(struct scsi_qla_host *ha,
	srb->ddb = ddb_entry;
	srb->ddb = ddb_entry;
	srb->cmd = cmd;
	srb->cmd = cmd;
	srb->flags = 0;
	srb->flags = 0;
	cmd->SCp.ptr = (void *)srb;
	CMD_SP(cmd) = (void *)srb;
	cmd->scsi_done = done;
	cmd->scsi_done = done;


	return srb;
	return srb;
@@ -403,7 +403,7 @@ static void qla4xxx_srb_free_dma(struct scsi_qla_host *ha, struct srb *srb)
		scsi_dma_unmap(cmd);
		scsi_dma_unmap(cmd);
		srb->flags &= ~SRB_DMA_VALID;
		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)
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);
	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 * qla4xxx_del_from_active_array(struct scsi_qla_host *ha, uint32_t index)
{
{
	struct srb *srb = NULL;
	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;
		return srb;


	if (!(srb = (struct srb *)cmd->host_scribble))
	srb = (struct srb *)CMD_SP(cmd);
	if (!srb)
		return srb;
		return srb;


	/* update counters */
	/* 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->req_q_count += srb->iocb_cnt;
		ha->iocb_cnt -= srb->iocb_cnt;
		ha->iocb_cnt -= srb->iocb_cnt;
		if (srb->cmd)
		if (srb->cmd)
			srb->cmd->host_scribble = NULL;
			srb->cmd->host_scribble =
				(unsigned char *)(unsigned long) MAX_SRBS;
	}
	}
	return srb;
	return srb;
}
}
@@ -1514,7 +1516,7 @@ static int qla4xxx_eh_wait_on_command(struct scsi_qla_host *ha,


	do {
	do {
		/* Checking to see if its returned to OS */
		/* Checking to see if its returned to OS */
		rp = (struct srb *) cmd->SCp.ptr;
		rp = (struct srb *) CMD_SP(cmd);
		if (rp == NULL) {
		if (rp == NULL) {
			done++;
			done++;
			break;
			break;