All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: "Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>
Subject: [PATCH 33/44] nsp_cs: Move the SCSI pointer to private command data
Date: Fri, 28 Jan 2022 14:18:58 -0800	[thread overview]
Message-ID: <20220128221909.8141-34-bvanassche@acm.org> (raw)
In-Reply-To: <20220128221909.8141-1-bvanassche@acm.org>

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
in struct scsi_cmnd.
This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/pcmcia/nsp_cs.c    | 206 ++++++++++++++++++--------------
 drivers/scsi/pcmcia/nsp_cs.h    |   2 +-
 drivers/scsi/pcmcia/nsp_debug.c |   2 +-
 3 files changed, 120 insertions(+), 90 deletions(-)

diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index dcffda384eaf..94d8185d3190 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -70,6 +70,17 @@ static bool       free_ports = 0;
 module_param(free_ports, bool, 0);
 MODULE_PARM_DESC(free_ports, "Release IO ports after configuration? (default: 0 (=no))");
 
+struct nsp_cmd_priv {
+	struct scsi_pointer scsi_pointer;
+};
+
+static struct scsi_pointer *nsp_priv(struct scsi_cmnd *cmd)
+{
+	struct nsp_cmd_priv *ncmd = scsi_cmd_priv(cmd);
+
+	return &ncmd->scsi_pointer;
+}
+
 static struct scsi_host_template nsp_driver_template = {
 	.proc_name	         = "nsp_cs",
 	.show_info		 = nsp_show_info,
@@ -83,6 +94,7 @@ static struct scsi_host_template nsp_driver_template = {
 	.this_id		 = NSP_INITIATOR_ID,
 	.sg_tablesize		 = SG_ALL,
 	.dma_boundary		 = PAGE_SIZE - 1,
+	.cmd_size		 = sizeof(struct nsp_cmd_priv),
 };
 
 static nsp_hw_data nsp_data_base; /* attach <-> detect glue */
@@ -180,8 +192,9 @@ static void nsp_scsi_done(struct scsi_cmnd *SCpnt)
 	scsi_done(SCpnt);
 }
 
-static int nsp_queuecommand_lck(struct scsi_cmnd *SCpnt)
+static int nsp_queuecommand_lck(struct scsi_cmnd *const SCpnt)
 {
+	struct scsi_pointer *scsi_pointer = nsp_priv(SCpnt);
 #ifdef NSP_DEBUG
 	/*unsigned int host_id = SCpnt->device->host->this_id;*/
 	/*unsigned int base    = SCpnt->device->host->io_port;*/
@@ -217,11 +230,11 @@ static int nsp_queuecommand_lck(struct scsi_cmnd *SCpnt)
 
 	data->CurrentSC		= SCpnt;
 
-	SCpnt->SCp.Status	= SAM_STAT_CHECK_CONDITION;
-	SCpnt->SCp.Message	= 0;
-	SCpnt->SCp.have_data_in = IO_UNKNOWN;
-	SCpnt->SCp.sent_command = 0;
-	SCpnt->SCp.phase	= PH_UNDETERMINED;
+	scsi_pointer->Status	   = SAM_STAT_CHECK_CONDITION;
+	scsi_pointer->Message	   = 0;
+	scsi_pointer->have_data_in = IO_UNKNOWN;
+	scsi_pointer->sent_command = 0;
+	scsi_pointer->phase	   = PH_UNDETERMINED;
 	scsi_set_resid(SCpnt, scsi_bufflen(SCpnt));
 
 	/* setup scratch area
@@ -231,15 +244,15 @@ static int nsp_queuecommand_lck(struct scsi_cmnd *SCpnt)
 	   SCp.buffers_residual : left buffers in list
 	   SCp.phase		: current state of the command */
 	if (scsi_bufflen(SCpnt)) {
-		SCpnt->SCp.buffer	    = scsi_sglist(SCpnt);
-		SCpnt->SCp.ptr		    = BUFFER_ADDR;
-		SCpnt->SCp.this_residual    = SCpnt->SCp.buffer->length;
-		SCpnt->SCp.buffers_residual = scsi_sg_count(SCpnt) - 1;
+		scsi_pointer->buffer	       = scsi_sglist(SCpnt);
+		scsi_pointer->ptr	       = BUFFER_ADDR(SCpnt);
+		scsi_pointer->this_residual    = scsi_pointer->buffer->length;
+		scsi_pointer->buffers_residual = scsi_sg_count(SCpnt) - 1;
 	} else {
-		SCpnt->SCp.ptr		    = NULL;
-		SCpnt->SCp.this_residual    = 0;
-		SCpnt->SCp.buffer	    = NULL;
-		SCpnt->SCp.buffers_residual = 0;
+		scsi_pointer->ptr	       = NULL;
+		scsi_pointer->this_residual    = 0;
+		scsi_pointer->buffer	       = NULL;
+		scsi_pointer->buffers_residual = 0;
 	}
 
 	if (!nsphw_start_selection(SCpnt)) {
@@ -353,8 +366,9 @@ static void nsphw_init(nsp_hw_data *data)
 /*
  * Start selection phase
  */
-static bool nsphw_start_selection(struct scsi_cmnd *SCpnt)
+static bool nsphw_start_selection(struct scsi_cmnd *const SCpnt)
 {
+	struct scsi_pointer *scsi_pointer = nsp_priv(SCpnt);
 	unsigned int  host_id	 = SCpnt->device->host->this_id;
 	unsigned int  base	 = SCpnt->device->host->io_port;
 	unsigned char target	 = scmd_id(SCpnt);
@@ -372,7 +386,7 @@ static bool nsphw_start_selection(struct scsi_cmnd *SCpnt)
 
 	/* start arbitration */
 	//nsp_dbg(NSP_DEBUG_RESELECTION, "start arbit");
-	SCpnt->SCp.phase = PH_ARBSTART;
+	scsi_pointer->phase = PH_ARBSTART;
 	nsp_index_write(base, SETARBIT, ARBIT_GO);
 
 	time_out = 1000;
@@ -392,7 +406,7 @@ static bool nsphw_start_selection(struct scsi_cmnd *SCpnt)
 
 	/* assert select line */
 	//nsp_dbg(NSP_DEBUG_RESELECTION, "assert SEL line");
-	SCpnt->SCp.phase = PH_SELSTART;
+	scsi_pointer->phase = PH_SELSTART;
 	udelay(3); /* wait 2.4us */
 	nsp_index_write(base, SCSIDATALATCH, BIT(host_id) | BIT(target));
 	nsp_index_write(base, SCSIBUSCTRL,   SCSI_SEL | SCSI_BSY                    | SCSI_ATN);
@@ -568,8 +582,9 @@ static int nsp_expect_signal(struct scsi_cmnd *SCpnt,
 /*
  * transfer SCSI message
  */
-static int nsp_xfer(struct scsi_cmnd *SCpnt, int phase)
+static int nsp_xfer(struct scsi_cmnd *const SCpnt, int phase)
 {
+	struct scsi_pointer *scsi_pointer = nsp_priv(SCpnt);
 	unsigned int  base = SCpnt->device->host->io_port;
 	nsp_hw_data  *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
 	char	     *buf  = data->MsgBuffer;
@@ -587,7 +602,7 @@ static int nsp_xfer(struct scsi_cmnd *SCpnt, int phase)
 		}
 
 		/* if last byte, negate ATN */
-		if (len == 1 && SCpnt->SCp.phase == PH_MSG_OUT) {
+		if (len == 1 && scsi_pointer->phase == PH_MSG_OUT) {
 			nsp_index_write(base, SCSIBUSCTRL, AUTODIRECTION | ACKENB);
 		}
 
@@ -608,14 +623,15 @@ static int nsp_xfer(struct scsi_cmnd *SCpnt, int phase)
 /*
  * get extra SCSI data from fifo
  */
-static int nsp_dataphase_bypass(struct scsi_cmnd *SCpnt)
+static int nsp_dataphase_bypass(struct scsi_cmnd *const SCpnt)
 {
+	struct scsi_pointer *scsi_pointer = nsp_priv(SCpnt);
 	nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
 	unsigned int count;
 
 	//nsp_dbg(NSP_DEBUG_DATA_IO, "in");
 
-	if (SCpnt->SCp.have_data_in != IO_IN) {
+	if (scsi_pointer->have_data_in != IO_IN) {
 		return 0;
 	}
 
@@ -630,7 +646,7 @@ static int nsp_dataphase_bypass(struct scsi_cmnd *SCpnt)
 	 * data phase skip only occures in case of SCSI_LOW_READ
 	 */
 	nsp_dbg(NSP_DEBUG_DATA_IO, "use bypass quirk");
-	SCpnt->SCp.phase = PH_DATA;
+	scsi_pointer->phase = PH_DATA;
 	nsp_pio_read(SCpnt);
 	nsp_setup_fifo(data, false);
 
@@ -704,8 +720,9 @@ static int nsp_fifo_count(struct scsi_cmnd *SCpnt)
 /*
  * read data in DATA IN phase
  */
-static void nsp_pio_read(struct scsi_cmnd *SCpnt)
+static void nsp_pio_read(struct scsi_cmnd *const SCpnt)
 {
+	struct scsi_pointer *scsi_pointer = nsp_priv(SCpnt);
 	unsigned int  base      = SCpnt->device->host->io_port;
 	unsigned long mmio_base = SCpnt->device->host->base;
 	nsp_hw_data  *data      = (nsp_hw_data *)SCpnt->device->host->hostdata;
@@ -716,24 +733,25 @@ static void nsp_pio_read(struct scsi_cmnd *SCpnt)
 	ocount = data->FifoCount;
 
 	nsp_dbg(NSP_DEBUG_DATA_IO, "in SCpnt=0x%p resid=%d ocount=%d ptr=0x%p this_residual=%d buffers=0x%p nbuf=%d",
-		SCpnt, scsi_get_resid(SCpnt), ocount, SCpnt->SCp.ptr,
-		SCpnt->SCp.this_residual, SCpnt->SCp.buffer,
-		SCpnt->SCp.buffers_residual);
+		SCpnt, scsi_get_resid(SCpnt), ocount, scsi_pointer->ptr,
+		scsi_pointer->this_residual, scsi_pointer->buffer,
+		scsi_pointer->buffers_residual);
 
 	time_out = 1000;
 
 	while ((time_out-- != 0) &&
-	       (SCpnt->SCp.this_residual > 0 || SCpnt->SCp.buffers_residual > 0 ) ) {
+	       (scsi_pointer->this_residual > 0 ||
+		scsi_pointer->buffers_residual > 0)) {
 
 		stat = nsp_index_read(base, SCSIBUSMON);
 		stat &= BUSMON_PHASE_MASK;
 
 
 		res = nsp_fifo_count(SCpnt) - ocount;
-		//nsp_dbg(NSP_DEBUG_DATA_IO, "ptr=0x%p this=0x%x ocount=0x%x res=0x%x", SCpnt->SCp.ptr, SCpnt->SCp.this_residual, ocount, res);
+		//nsp_dbg(NSP_DEBUG_DATA_IO, "ptr=0x%p this=0x%x ocount=0x%x res=0x%x", scsi_pointer->ptr, scsi_pointer->this_residual, ocount, res);
 		if (res == 0) { /* if some data available ? */
 			if (stat == BUSPHASE_DATA_IN) { /* phase changed? */
-				//nsp_dbg(NSP_DEBUG_DATA_IO, " wait for data this=%d", SCpnt->SCp.this_residual);
+				//nsp_dbg(NSP_DEBUG_DATA_IO, " wait for data this=%d", scsi_pointer->this_residual);
 				continue;
 			} else {
 				nsp_dbg(NSP_DEBUG_DATA_IO, "phase changed stat=0x%x", stat);
@@ -747,20 +765,21 @@ static void nsp_pio_read(struct scsi_cmnd *SCpnt)
 			continue;
 		}
 
-		res = min(res, SCpnt->SCp.this_residual);
+		res = min(res, scsi_pointer->this_residual);
 
 		switch (data->TransferMode) {
 		case MODE_IO32:
 			res &= ~(BIT(1)|BIT(0)); /* align 4 */
-			nsp_fifo32_read(base, SCpnt->SCp.ptr, res >> 2);
+			nsp_fifo32_read(base, scsi_pointer->ptr, res >> 2);
 			break;
 		case MODE_IO8:
-			nsp_fifo8_read (base, SCpnt->SCp.ptr, res     );
+			nsp_fifo8_read(base, scsi_pointer->ptr, res);
 			break;
 
 		case MODE_MEM32:
 			res &= ~(BIT(1)|BIT(0)); /* align 4 */
-			nsp_mmio_fifo32_read(mmio_base, SCpnt->SCp.ptr, res >> 2);
+			nsp_mmio_fifo32_read(mmio_base, scsi_pointer->ptr,
+					     res >> 2);
 			break;
 
 		default:
@@ -769,22 +788,23 @@ static void nsp_pio_read(struct scsi_cmnd *SCpnt)
 		}
 
 		nsp_inc_resid(SCpnt, -res);
-		SCpnt->SCp.ptr		 += res;
-		SCpnt->SCp.this_residual -= res;
+		scsi_pointer->ptr += res;
+		scsi_pointer->this_residual -= res;
 		ocount			 += res;
-		//nsp_dbg(NSP_DEBUG_DATA_IO, "ptr=0x%p this_residual=0x%x ocount=0x%x", SCpnt->SCp.ptr, SCpnt->SCp.this_residual, ocount);
+		//nsp_dbg(NSP_DEBUG_DATA_IO, "ptr=0x%p this_residual=0x%x ocount=0x%x", scsi_pointer->ptr, scsi_pointer->this_residual, ocount);
 
 		/* go to next scatter list if available */
-		if (SCpnt->SCp.this_residual	== 0 &&
-		    SCpnt->SCp.buffers_residual != 0 ) {
+		if (scsi_pointer->this_residual	== 0 &&
+		    scsi_pointer->buffers_residual != 0 ) {
 			//nsp_dbg(NSP_DEBUG_DATA_IO, "scatterlist next timeout=%d", time_out);
-			SCpnt->SCp.buffers_residual--;
-			SCpnt->SCp.buffer = sg_next(SCpnt->SCp.buffer);
-			SCpnt->SCp.ptr		 = BUFFER_ADDR;
-			SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length;
+			scsi_pointer->buffers_residual--;
+			scsi_pointer->buffer = sg_next(scsi_pointer->buffer);
+			scsi_pointer->ptr = BUFFER_ADDR(SCpnt);
+			scsi_pointer->this_residual =
+				scsi_pointer->buffer->length;
 			time_out = 1000;
 
-			//nsp_dbg(NSP_DEBUG_DATA_IO, "page: 0x%p, off: 0x%x", SCpnt->SCp.buffer->page, SCpnt->SCp.buffer->offset);
+			//nsp_dbg(NSP_DEBUG_DATA_IO, "page: 0x%p, off: 0x%x", scsi_pointer->buffer->page, scsi_pointer->buffer->offset);
 		}
 	}
 
@@ -792,8 +812,8 @@ static void nsp_pio_read(struct scsi_cmnd *SCpnt)
 
 	if (time_out < 0) {
 		nsp_msg(KERN_DEBUG, "pio read timeout resid=%d this_residual=%d buffers_residual=%d",
-			scsi_get_resid(SCpnt), SCpnt->SCp.this_residual,
-			SCpnt->SCp.buffers_residual);
+			scsi_get_resid(SCpnt), scsi_pointer->this_residual,
+			scsi_pointer->buffers_residual);
 	}
 	nsp_dbg(NSP_DEBUG_DATA_IO, "read ocount=0x%x", ocount);
 	nsp_dbg(NSP_DEBUG_DATA_IO, "r cmd=%d resid=0x%x\n", data->CmdId,
@@ -805,6 +825,7 @@ static void nsp_pio_read(struct scsi_cmnd *SCpnt)
  */
 static void nsp_pio_write(struct scsi_cmnd *SCpnt)
 {
+	struct scsi_pointer *scsi_pointer = nsp_priv(SCpnt);
 	unsigned int  base      = SCpnt->device->host->io_port;
 	unsigned long mmio_base = SCpnt->device->host->base;
 	nsp_hw_data  *data      = (nsp_hw_data *)SCpnt->device->host->hostdata;
@@ -815,14 +836,15 @@ static void nsp_pio_write(struct scsi_cmnd *SCpnt)
 	ocount	 = data->FifoCount;
 
 	nsp_dbg(NSP_DEBUG_DATA_IO, "in fifocount=%d ptr=0x%p this_residual=%d buffers=0x%p nbuf=%d resid=0x%x",
-		data->FifoCount, SCpnt->SCp.ptr, SCpnt->SCp.this_residual,
-		SCpnt->SCp.buffer, SCpnt->SCp.buffers_residual,
+		data->FifoCount, scsi_pointer->ptr, scsi_pointer->this_residual,
+		scsi_pointer->buffer, scsi_pointer->buffers_residual,
 		scsi_get_resid(SCpnt));
 
 	time_out = 1000;
 
 	while ((time_out-- != 0) &&
-	       (SCpnt->SCp.this_residual > 0 || SCpnt->SCp.buffers_residual > 0)) {
+	       (scsi_pointer->this_residual > 0 ||
+		scsi_pointer->buffers_residual > 0)) {
 		stat = nsp_index_read(base, SCSIBUSMON);
 		stat &= BUSMON_PHASE_MASK;
 
@@ -832,9 +854,9 @@ static void nsp_pio_write(struct scsi_cmnd *SCpnt)
 			nsp_dbg(NSP_DEBUG_DATA_IO, "phase changed stat=0x%x, res=%d\n", stat, res);
 			/* Put back pointer */
 			nsp_inc_resid(SCpnt, res);
-			SCpnt->SCp.ptr		 -= res;
-			SCpnt->SCp.this_residual += res;
-			ocount			 -= res;
+			scsi_pointer->ptr -= res;
+			scsi_pointer->this_residual += res;
+			ocount -= res;
 
 			break;
 		}
@@ -845,21 +867,22 @@ static void nsp_pio_write(struct scsi_cmnd *SCpnt)
 			continue;
 		}
 
-		res = min(SCpnt->SCp.this_residual, WFIFO_CRIT);
+		res = min(scsi_pointer->this_residual, WFIFO_CRIT);
 
-		//nsp_dbg(NSP_DEBUG_DATA_IO, "ptr=0x%p this=0x%x res=0x%x", SCpnt->SCp.ptr, SCpnt->SCp.this_residual, res);
+		//nsp_dbg(NSP_DEBUG_DATA_IO, "ptr=0x%p this=0x%x res=0x%x", scsi_pointer->ptr, scsi_pointer->this_residual, res);
 		switch (data->TransferMode) {
 		case MODE_IO32:
 			res &= ~(BIT(1)|BIT(0)); /* align 4 */
-			nsp_fifo32_write(base, SCpnt->SCp.ptr, res >> 2);
+			nsp_fifo32_write(base, scsi_pointer->ptr, res >> 2);
 			break;
 		case MODE_IO8:
-			nsp_fifo8_write (base, SCpnt->SCp.ptr, res     );
+			nsp_fifo8_write(base, scsi_pointer->ptr, res);
 			break;
 
 		case MODE_MEM32:
 			res &= ~(BIT(1)|BIT(0)); /* align 4 */
-			nsp_mmio_fifo32_write(mmio_base, SCpnt->SCp.ptr, res >> 2);
+			nsp_mmio_fifo32_write(mmio_base, scsi_pointer->ptr,
+					      res >> 2);
 			break;
 
 		default:
@@ -868,18 +891,19 @@ static void nsp_pio_write(struct scsi_cmnd *SCpnt)
 		}
 
 		nsp_inc_resid(SCpnt, -res);
-		SCpnt->SCp.ptr		 += res;
-		SCpnt->SCp.this_residual -= res;
-		ocount			 += res;
+		scsi_pointer->ptr += res;
+		scsi_pointer->this_residual -= res;
+		ocount += res;
 
 		/* go to next scatter list if available */
-		if (SCpnt->SCp.this_residual	== 0 &&
-		    SCpnt->SCp.buffers_residual != 0 ) {
+		if (scsi_pointer->this_residual	== 0 &&
+		    scsi_pointer->buffers_residual != 0 ) {
 			//nsp_dbg(NSP_DEBUG_DATA_IO, "scatterlist next");
-			SCpnt->SCp.buffers_residual--;
-			SCpnt->SCp.buffer = sg_next(SCpnt->SCp.buffer);
-			SCpnt->SCp.ptr		 = BUFFER_ADDR;
-			SCpnt->SCp.this_residual = SCpnt->SCp.buffer->length;
+			scsi_pointer->buffers_residual--;
+			scsi_pointer->buffer = sg_next(scsi_pointer->buffer);
+			scsi_pointer->ptr = BUFFER_ADDR(SCpnt);
+			scsi_pointer->this_residual =
+				scsi_pointer->buffer->length;
 			time_out = 1000;
 		}
 	}
@@ -947,6 +971,7 @@ static irqreturn_t nspintr(int irq, void *dev_id)
 	unsigned int   base;
 	unsigned char  irq_status, irq_phase, phase;
 	struct scsi_cmnd *tmpSC;
+	struct scsi_pointer *scsi_pointer;
 	unsigned char  target, lun;
 	unsigned int  *sync_neg;
 	int            i, tmp;
@@ -1025,9 +1050,10 @@ static irqreturn_t nspintr(int irq, void *dev_id)
 
 		if(data->CurrentSC != NULL) {
 			tmpSC = data->CurrentSC;
-			tmpSC->result  = (DID_RESET                   << 16) |
-				         ((tmpSC->SCp.Message & 0xff) <<  8) |
-				         ((tmpSC->SCp.Status  & 0xff) <<  0);
+			scsi_pointer = nsp_priv(tmpSC);
+			tmpSC->result = (DID_RESET              << 16) |
+				((scsi_pointer->Message & 0xff) <<  8) |
+				((scsi_pointer->Status  & 0xff) <<  0);
 			nsp_scsi_done(tmpSC);
 		}
 		return IRQ_HANDLED;
@@ -1041,6 +1067,7 @@ static irqreturn_t nspintr(int irq, void *dev_id)
 	}
 
 	tmpSC    = data->CurrentSC;
+	scsi_pointer = nsp_priv(tmpSC);
 	target   = tmpSC->device->id;
 	lun      = tmpSC->device->lun;
 	sync_neg = &(data->Sync[target].SyncNegotiation);
@@ -1063,7 +1090,7 @@ static irqreturn_t nspintr(int irq, void *dev_id)
 
 	//show_phase(tmpSC);
 
-	switch(tmpSC->SCp.phase) {
+	switch (scsi_pointer->phase) {
 	case PH_SELSTART:
 		// *sync_neg = SYNC_NOT_YET;
 		if ((phase & BUSMON_BSY) == 0) {
@@ -1086,7 +1113,7 @@ static irqreturn_t nspintr(int irq, void *dev_id)
 		/* attention assert */
 		//nsp_dbg(NSP_DEBUG_INTR, "attention assert");
 		data->SelectionTimeOut = 0;
-		tmpSC->SCp.phase       = PH_SELECTED;
+		scsi_pointer->phase = PH_SELECTED;
 		nsp_index_write(base, SCSIBUSCTRL, SCSI_ATN);
 		udelay(1);
 		nsp_index_write(base, SCSIBUSCTRL, SCSI_ATN | AUTODIRECTION | ACKENB);
@@ -1115,17 +1142,18 @@ static irqreturn_t nspintr(int irq, void *dev_id)
 	//nsp_dbg(NSP_DEBUG_INTR, "start scsi seq");
 
 	/* normal disconnect */
-	if (((tmpSC->SCp.phase == PH_MSG_IN) || (tmpSC->SCp.phase == PH_MSG_OUT)) &&
-	    (irq_phase & LATCHED_BUS_FREE) != 0 ) {
+	if ((scsi_pointer->phase == PH_MSG_IN ||
+	     scsi_pointer->phase == PH_MSG_OUT) &&
+	    (irq_phase & LATCHED_BUS_FREE) != 0) {
 		nsp_dbg(NSP_DEBUG_INTR, "normal disconnect irq_status=0x%x, phase=0x%x, irq_phase=0x%x", irq_status, phase, irq_phase);
 
 		//*sync_neg       = SYNC_NOT_YET;
 
 		/* all command complete and return status */
-		if (tmpSC->SCp.Message == COMMAND_COMPLETE) {
-			tmpSC->result = (DID_OK		             << 16) |
-					((tmpSC->SCp.Message & 0xff) <<  8) |
-					((tmpSC->SCp.Status  & 0xff) <<  0);
+		if (scsi_pointer->Message == COMMAND_COMPLETE) {
+			tmpSC->result = (DID_OK		        << 16) |
+				((scsi_pointer->Message & 0xff) <<  8) |
+				((scsi_pointer->Status  & 0xff) <<  0);
 			nsp_dbg(NSP_DEBUG_INTR, "command complete result=0x%x", tmpSC->result);
 			nsp_scsi_done(tmpSC);
 
@@ -1154,7 +1182,7 @@ static irqreturn_t nspintr(int irq, void *dev_id)
 			return IRQ_HANDLED;
 		}
 
-		tmpSC->SCp.phase = PH_COMMAND;
+		scsi_pointer->phase = PH_COMMAND;
 
 		nsp_nexus(tmpSC);
 
@@ -1170,8 +1198,8 @@ static irqreturn_t nspintr(int irq, void *dev_id)
 	case BUSPHASE_DATA_OUT:
 		nsp_dbg(NSP_DEBUG_INTR, "BUSPHASE_DATA_OUT");
 
-		tmpSC->SCp.phase        = PH_DATA;
-		tmpSC->SCp.have_data_in = IO_OUT;
+		scsi_pointer->phase        = PH_DATA;
+		scsi_pointer->have_data_in = IO_OUT;
 
 		nsp_pio_write(tmpSC);
 
@@ -1180,8 +1208,8 @@ static irqreturn_t nspintr(int irq, void *dev_id)
 	case BUSPHASE_DATA_IN:
 		nsp_dbg(NSP_DEBUG_INTR, "BUSPHASE_DATA_IN");
 
-		tmpSC->SCp.phase        = PH_DATA;
-		tmpSC->SCp.have_data_in = IO_IN;
+		scsi_pointer->phase        = PH_DATA;
+		scsi_pointer->have_data_in = IO_IN;
 
 		nsp_pio_read(tmpSC);
 
@@ -1191,10 +1219,11 @@ static irqreturn_t nspintr(int irq, void *dev_id)
 		nsp_dataphase_bypass(tmpSC);
 		nsp_dbg(NSP_DEBUG_INTR, "BUSPHASE_STATUS");
 
-		tmpSC->SCp.phase = PH_STATUS;
+		scsi_pointer->phase = PH_STATUS;
 
-		tmpSC->SCp.Status = nsp_index_read(base, SCSIDATAWITHACK);
-		nsp_dbg(NSP_DEBUG_INTR, "message=0x%x status=0x%x", tmpSC->SCp.Message, tmpSC->SCp.Status);
+		scsi_pointer->Status = nsp_index_read(base, SCSIDATAWITHACK);
+		nsp_dbg(NSP_DEBUG_INTR, "message=0x%x status=0x%x",
+			scsi_pointer->Message, scsi_pointer->Status);
 
 		break;
 
@@ -1204,7 +1233,7 @@ static irqreturn_t nspintr(int irq, void *dev_id)
 			goto timer_out;
 		}
 
-		tmpSC->SCp.phase = PH_MSG_OUT;
+		scsi_pointer->phase = PH_MSG_OUT;
 
 		//*sync_neg = SYNC_NOT_YET;
 
@@ -1237,7 +1266,7 @@ static irqreturn_t nspintr(int irq, void *dev_id)
 			goto timer_out;
 		}
 
-		tmpSC->SCp.phase = PH_MSG_IN;
+		scsi_pointer->phase = PH_MSG_IN;
 		nsp_message_in(tmpSC);
 
 		/**/
@@ -1269,9 +1298,10 @@ static irqreturn_t nspintr(int irq, void *dev_id)
 				i += (1 + data->MsgBuffer[i+1]);
 			}
 		}
-		tmpSC->SCp.Message = tmp;
+		scsi_pointer->Message = tmp;
 
-		nsp_dbg(NSP_DEBUG_INTR, "message=0x%x len=%d", tmpSC->SCp.Message, data->MsgLen);
+		nsp_dbg(NSP_DEBUG_INTR, "message=0x%x len=%d",
+			scsi_pointer->Message, data->MsgLen);
 		show_message(data);
 
 		break;
diff --git a/drivers/scsi/pcmcia/nsp_cs.h b/drivers/scsi/pcmcia/nsp_cs.h
index 7d5d1a5b36e0..e1ee8ef90ad3 100644
--- a/drivers/scsi/pcmcia/nsp_cs.h
+++ b/drivers/scsi/pcmcia/nsp_cs.h
@@ -371,7 +371,7 @@ enum _burst_mode {
 };
 
 /* scatter-gather table */
-#  define BUFFER_ADDR ((char *)((sg_virt(SCpnt->SCp.buffer))))
+#define BUFFER_ADDR(SCpnt) ((char *)(sg_virt(nsp_priv(SCpnt)->buffer)))
 
 #endif  /*__nsp_cs__*/
 /* end */
diff --git a/drivers/scsi/pcmcia/nsp_debug.c b/drivers/scsi/pcmcia/nsp_debug.c
index 6aa7d269d3b3..23b68dd26f74 100644
--- a/drivers/scsi/pcmcia/nsp_debug.c
+++ b/drivers/scsi/pcmcia/nsp_debug.c
@@ -145,7 +145,7 @@ static void show_command(struct scsi_cmnd *SCpnt)
 
 static void show_phase(struct scsi_cmnd *SCpnt)
 {
-	int i = SCpnt->SCp.phase;
+	int i = nsp_scsi_pointer(SCpnt)->phase;
 
 	char *ph[] = {
 		"PH_UNDETERMINED",

  parent reply	other threads:[~2022-01-28 22:22 UTC|newest]

Thread overview: 94+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28 22:18 [PATCH 00/44] Remove the SCSI pointer from struct scsi_cmnd Bart Van Assche
2022-01-28 22:18 ` [PATCH 01/44] ips: Use true and false instead of TRUE and FALSE Bart Van Assche
2022-01-31  9:53   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 02/44] nsp_cs: " Bart Van Assche
2022-01-31  9:55   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 03/44] scsi: Remove drivers/scsi/scsi.h Bart Van Assche
2022-01-31 12:53   ` Greg Kroah-Hartman
2022-01-28 22:18 ` [PATCH 04/44] NCR5380: Remove the NCR5380_CMD_SIZE macro Bart Van Assche
2022-01-31  9:58   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 05/44] NCR5380: Move the SCSI pointer to private command data Bart Van Assche
2022-01-31 10:04   ` Johannes Thumshirn
2022-01-31 22:39   ` Finn Thain
2022-01-31 23:36     ` Bart Van Assche
2022-02-01  0:11       ` Finn Thain
2022-01-28 22:18 ` [PATCH 06/44] scsi: arm: Rename arm/scsi.h into arm/arm_scsi.h Bart Van Assche
2022-01-31 10:09   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 07/44] scsi: arm: Move the SCSI pointer to private command data Bart Van Assche
2022-01-28 22:18 ` [PATCH 08/44] 53c700: Stop clearing SCSI pointer fields Bart Van Assche
2022-01-31 10:15   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 09/44] aacraid: Move the SCSI pointer to private command data Bart Van Assche
2022-01-28 22:18 ` [PATCH 10/44] advansys: " Bart Van Assche
2022-01-31 10:23   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 11/44] aha1542: Remove a set-but-not-used array Bart Van Assche
2022-01-31 10:25   ` Johannes Thumshirn
2022-01-31 17:13     ` Bart Van Assche
2022-01-28 22:18 ` [PATCH 12/44] aha152x: Move the SCSI pointer to private command data Bart Van Assche
2022-01-31 10:32   ` Johannes Thumshirn
2022-01-31 17:16     ` Bart Van Assche
2022-01-28 22:18 ` [PATCH 13/44] bfa: Stop using the SCSI pointer Bart Van Assche
2022-01-31 10:39   ` Johannes Thumshirn
2022-01-31 17:19     ` Bart Van Assche
2022-02-01  9:16       ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 14/44] csio: " Bart Van Assche
2022-01-31 10:41   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 15/44] dc395x: " Bart Van Assche
2022-01-31 10:42   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 16/44] esp_scsi: " Bart Van Assche
2022-01-31 10:43   ` Johannes Thumshirn
2022-01-31 22:46   ` Finn Thain
2022-02-01 21:20     ` Bart Van Assche
2022-01-28 22:18 ` [PATCH 17/44] fdomain: Move the SCSI pointer to private command data Bart Van Assche
2022-01-31 10:44   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 18/44] fnic: Fix a tracing statement Bart Van Assche
2022-01-28 22:18 ` [PATCH 19/44] fnic: Stop using the SCSI pointer Bart Van Assche
2022-01-31 11:01   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 20/44] hptiop: " Bart Van Assche
2022-01-31 11:03   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 21/44] imm: Move the SCSI pointer to private command data Bart Van Assche
2022-01-31 11:17   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 22/44] iscsi: Stop using the SCSI pointer Bart Van Assche
2022-01-28 22:18 ` [PATCH 23/44] initio: " Bart Van Assche
2022-01-31 11:19   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 24/44] libfc: " Bart Van Assche
2022-01-28 22:18 ` [PATCH 25/44] mac53c94: Fix a set-but-not-used compiler warning Bart Van Assche
2022-01-31 11:21   ` Johannes Thumshirn
2022-01-31 17:22     ` Bart Van Assche
2022-01-28 22:18 ` [PATCH 26/44] mac53c94: Move the SCSI pointer to private command data Bart Van Assche
2022-01-31 11:22   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 27/44] megaraid: Stop using the SCSI pointer Bart Van Assche
2022-01-31 11:27   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 28/44] megasas: " Bart Van Assche
2022-01-31 11:28   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 29/44] mesh: Move the SCSI pointer to private command data Bart Van Assche
2022-01-31 11:31   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 30/44] mvsas: Fix a set-but-not-used warning Bart Van Assche
2022-01-31 11:33   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 31/44] mvumi: Stop using the SCSI pointer Bart Van Assche
2022-01-31 11:34   ` Johannes Thumshirn
2022-01-28 22:18 ` [PATCH 32/44] nsp32: " Bart Van Assche
2022-01-31  2:53   ` Masanori Goto
2022-01-31 17:28     ` Bart Van Assche
2022-01-28 22:18 ` Bart Van Assche [this message]
2022-01-28 22:18 ` [PATCH 34/44] sym53c500_cs: Move the SCSI pointer to private command data Bart Van Assche
2022-01-31 11:37   ` Johannes Thumshirn
2022-01-28 22:19 ` [PATCH 35/44] ppa: " Bart Van Assche
2022-01-31 11:38   ` Johannes Thumshirn
2022-01-28 22:19 ` [PATCH 36/44] qla1280: " Bart Van Assche
2022-01-31 11:39   ` Johannes Thumshirn
2022-01-28 22:19 ` [PATCH 37/44] qla2xxx: Stop using the SCSI pointer Bart Van Assche
2022-01-28 22:19 ` [PATCH 38/44] smartpqi: " Bart Van Assche
2022-01-31 11:41   ` Johannes Thumshirn
2022-01-28 22:19 ` [PATCH 39/44] sym53c8xx_2: Move the SCSI pointer to private command data Bart Van Assche
2022-01-31 11:42   ` Johannes Thumshirn
2022-01-28 22:19 ` [PATCH 40/44] scsi: usb: Stop using the SCSI pointer Bart Van Assche
2022-01-31 11:43   ` Johannes Thumshirn
2022-01-31 12:53   ` Greg Kroah-Hartman
2022-02-02  8:14   ` Oliver Neukum
2022-01-28 22:19 ` [PATCH 41/44] wd719x: " Bart Van Assche
2022-01-31 11:44   ` Johannes Thumshirn
2022-01-28 22:19 ` [PATCH 42/44] wdc33c93: Move the SCSI pointer to private command data Bart Van Assche
2022-01-28 22:19 ` [PATCH 43/44] zalon: Stop using the SCSI pointer Bart Van Assche
2022-01-31 11:46   ` Johannes Thumshirn
2022-01-28 22:19 ` [PATCH 44/44] scsi: core: Remove struct scsi_pointer from struct scsi_cmnd Bart Van Assche
2022-01-31 11:47   ` Johannes Thumshirn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220128221909.8141-34-bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=jejb@linux.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.