All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/5] Remove scmd->tag
@ 2014-10-02 10:43 Hannes Reinecke
  2014-10-02 10:43 ` [PATCH 1/5] NCR5380: Whitespace cleanup Hannes Reinecke
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Hannes Reinecke @ 2014-10-02 10:43 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: James Bottomley, Sagi Grimberg, Webb Scales, linux-scsi, Hannes Reinecke

The 'tag' field of struct scsi_cmnd has not separate meaning anymore,
and the same information is present in the associated request.
So remove it.

Hannes Reinecke (5):
  NCR5380: Whitespace cleanup
  scsi: Remove references to linked commands
  vmw_pvscsi: fixup tagging
  tcm_loop: Fixup tag handling
  scsi: Remove scmd->tag

 drivers/scsi/NCR5380.c             | 691 ++++++++++++++++++-------------------
 drivers/scsi/atari_NCR5380.c       |  57 ---
 drivers/scsi/fnic/fnic_scsi.c      |   1 -
 drivers/scsi/scsi_lib.c            |   4 -
 drivers/scsi/sun3_NCR5380.c        |  57 ---
 drivers/scsi/vmw_pvscsi.c          |   5 +-
 drivers/target/loopback/tcm_loop.c |  23 +-
 include/scsi/scsi_cmnd.h           |   2 -
 8 files changed, 342 insertions(+), 498 deletions(-)

-- 
1.8.5.2


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/5] NCR5380: Whitespace cleanup
  2014-10-02 10:43 [RFC PATCH 0/5] Remove scmd->tag Hannes Reinecke
@ 2014-10-02 10:43 ` Hannes Reinecke
  2014-10-02 11:07   ` Finn Thain
  2014-10-02 10:43 ` [PATCH 2/5] scsi: Remove references to linked commands Hannes Reinecke
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 12+ messages in thread
From: Hannes Reinecke @ 2014-10-02 10:43 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: James Bottomley, Sagi Grimberg, Webb Scales, linux-scsi, Hannes Reinecke

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/NCR5380.c | 652 +++++++++++++++++++++++++------------------------
 1 file changed, 333 insertions(+), 319 deletions(-)

diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index 45da3c8..c8aa935 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -1,4 +1,4 @@
-/* 
+/*
  * NCR 5380 generic driver routines.  These should make it *trivial*
  *      to implement 5380 SCSI drivers under Linux with a non-trantor
  *      architecture.
@@ -6,14 +6,14 @@
  *      Note that these routines also work with NR53c400 family chips.
  *
  * Copyright 1993, Drew Eckhardt
- *      Visionary Computing 
+ *      Visionary Computing
  *      (Unix and Linux consulting and custom programming)
  *      drew@colorado.edu
  *      +1 (303) 666-5836
  *
- * DISTRIBUTION RELEASE 6. 
+ * DISTRIBUTION RELEASE 6.
  *
- * For more information, please consult 
+ * For more information, please consult
  *
  * NCR 5380 Family
  * SCSI Protocol Controller
@@ -29,10 +29,10 @@
 /*
  * Revision 1.10 1998/9/2	Alan Cox
  *				(alan@lxorguk.ukuu.org.uk)
- * Fixed up the timer lockups reported so far. Things still suck. Looking 
+ * Fixed up the timer lockups reported so far. Things still suck. Looking
  * forward to 2.3 and per device request queues. Then it'll be possible to
  * SMP thread this beast and improve life no end.
- 
+
  * Revision 1.9  1997/7/27	Ronald van Cuijlenborg
  *				(ronald.van.cuijlenborg@tip.nl or nutty@dds.nl)
  * (hopefully) fixed and enhanced USLEEP
@@ -69,27 +69,35 @@
  */
 
 /*
- * Further development / testing that should be done : 
+ * Further development / testing that should be done :
  * 1.  Cleanup the NCR5380_transfer_dma function and DMA operation complete
- *     code so that everything does the same thing that's done at the 
+ *     code so that everything does the same thing that's done at the
  *     end of a pseudo-DMA read operation.
  *
  * 2.  Fix REAL_DMA (interrupt driven, polled works fine) -
- *     basically, transfer size needs to be reduced by one 
+ *     basically, transfer size needs to be reduced by one
  *     and the last byte read as is done with PSEUDO_DMA.
- * 
- * 4.  Test SCSI-II tagged queueing (I have no devices which support 
+ *
+ * 4.  Test SCSI-II tagged queueing (I have no devices which support
  *      tagged queueing)
  *
- * 5.  Test linked command handling code after Eric is ready with 
+ * 5.  Test linked command handling code after Eric is ready with
  *      the high level code.
  */
 #include <scsi/scsi_dbg.h>
 #include <scsi/scsi_transport_spi.h>
 
 #if (NDEBUG & NDEBUG_LISTS)
-#define LIST(x,y) {printk("LINE:%d   Adding %p to %p\n", __LINE__, (void*)(x), (void*)(y)); if ((x)==(y)) udelay(5); }
-#define REMOVE(w,x,y,z) {printk("LINE:%d   Removing: %p->%p  %p->%p \n", __LINE__, (void*)(w), (void*)(x), (void*)(y), (void*)(z)); if ((x)==(y)) udelay(5); }
+#define LIST(x,y) {							\
+		printk("LINE:%d   Adding %p to %p\n", __LINE__,		\
+		       (void*)(x), (void*)(y));				\
+		if ((x)==(y)) udelay(5);				\
+	}
+#define REMOVE(w,x,y,z) {						\
+		printk("LINE:%d   Removing: %p->%p  %p->%p \n", __LINE__, \
+		       (void*)(w), (void*)(x), (void*)(y), (void*)(z));	\
+		if ((x)==(y)) udelay(5);				\
+}
 #else
 #define LIST(x,y)
 #define REMOVE(w,x,y,z)
@@ -114,9 +122,9 @@
 /*
  * Design
  *
- * This is a generic 5380 driver.  To use it on a different platform, 
+ * This is a generic 5380 driver.  To use it on a different platform,
  * one simply writes appropriate system specific macros (ie, data
- * transfer - some PC's will use the I/O bus, 68K's must use 
+ * transfer - some PC's will use the I/O bus, 68K's must use
  * memory mapped) and drops this file in their 'C' wrapper.
  *
  * (Note from hch:  unfortunately it was not enough for the different
@@ -125,33 +133,33 @@
  * most updates to this driver.  Maybe someone will fix all these
  * drivers to use a common core one day..)
  *
- * As far as command queueing, two queues are maintained for 
+ * As far as command queueing, two queues are maintained for
  * each 5380 in the system - commands that haven't been issued yet,
- * and commands that are currently executing.  This means that an 
- * unlimited number of commands may be queued, letting 
- * more commands propagate from the higher driver levels giving higher 
- * throughput.  Note that both I_T_L and I_T_L_Q nexuses are supported, 
- * allowing multiple commands to propagate all the way to a SCSI-II device 
+ * and commands that are currently executing.  This means that an
+ * unlimited number of commands may be queued, letting
+ * more commands propagate from the higher driver levels giving higher
+ * throughput.  Note that both I_T_L and I_T_L_Q nexuses are supported,
+ * allowing multiple commands to propagate all the way to a SCSI-II device
  * while a command is already executing.
  *
  *
- * Issues specific to the NCR5380 : 
+ * Issues specific to the NCR5380 :
  *
- * When used in a PIO or pseudo-dma mode, the NCR5380 is a braindead 
- * piece of hardware that requires you to sit in a loop polling for 
- * the REQ signal as long as you are connected.  Some devices are 
- * brain dead (ie, many TEXEL CD ROM drives) and won't disconnect 
+ * When used in a PIO or pseudo-dma mode, the NCR5380 is a braindead
+ * piece of hardware that requires you to sit in a loop polling for
+ * the REQ signal as long as you are connected.  Some devices are
+ * brain dead (ie, many TEXEL CD ROM drives) and won't disconnect
  * while doing long seek operations.
- * 
+ *
  * The workaround for this is to keep track of devices that have
  * disconnected.  If the device hasn't disconnected, for commands that
- * should disconnect, we do something like 
+ * should disconnect, we do something like
  *
  * while (!REQ is asserted) { sleep for N usecs; poll for M usecs }
- * 
- * Some tweaking of N and M needs to be done.  An algorithm based 
+ *
+ * Some tweaking of N and M needs to be done.  An algorithm based
  * on "time to data" would give the best results as long as short time
- * to datas (ie, on the same track) were considered, however these 
+ * to datas (ie, on the same track) were considered, however these
  * broken devices are the exception rather than the rule and I'd rather
  * spend my time optimizing for the normal case.
  *
@@ -161,23 +169,23 @@
  * which is started from a workqueue for each NCR5380 host in the
  * system.  It attempts to establish I_T_L or I_T_L_Q nexuses by
  * removing the commands from the issue queue and calling
- * NCR5380_select() if a nexus is not established. 
+ * NCR5380_select() if a nexus is not established.
  *
  * Once a nexus is established, the NCR5380_information_transfer()
  * phase goes through the various phases as instructed by the target.
  * if the target goes into MSG IN and sends a DISCONNECT message,
  * the command structure is placed into the per instance disconnected
- * queue, and NCR5380_main tries to find more work.  If the target is 
+ * queue, and NCR5380_main tries to find more work.  If the target is
  * idle for too long, the system will try to sleep.
  *
  * If a command has disconnected, eventually an interrupt will trigger,
  * calling NCR5380_intr()  which will in turn call NCR5380_reselect
  * to reestablish a nexus.  This will run main if necessary.
  *
- * On command termination, the done function will be called as 
+ * On command termination, the done function will be called as
  * appropriate.
  *
- * SCSI pointers are maintained in the SCp field of SCSI command 
+ * SCSI pointers are maintained in the SCp field of SCSI command
  * structures, being initialized after the command is connected
  * in NCR5380_select, and set as appropriate in NCR5380_information_transfer.
  * Note that in violation of the standard, an implicit SAVE POINTERS operation
@@ -187,18 +195,18 @@
 /*
  * Using this file :
  * This file a skeleton Linux SCSI driver for the NCR 5380 series
- * of chips.  To use it, you write an architecture specific functions 
+ * of chips.  To use it, you write an architecture specific functions
  * and macros and include this file in your driver.
  *
- * These macros control options : 
- * AUTOPROBE_IRQ - if defined, the NCR5380_probe_irq() function will be 
+ * These macros control options :
+ * AUTOPROBE_IRQ - if defined, the NCR5380_probe_irq() function will be
  *      defined.
- * 
+ *
  * AUTOSENSE - if defined, REQUEST SENSE will be performed automatically
- *      for commands that return with a CHECK CONDITION status. 
+ *      for commands that return with a CHECK CONDITION status.
  *
  * DIFFERENTIAL - if defined, NCR53c81 chips will use external differential
- *      transceivers. 
+ *      transceivers.
  *
  * DONT_USE_INTR - if defined, never use interrupts, even if we probe or
  *      override-configure an IRQ.
@@ -215,7 +223,7 @@
  * REAL_DMA - if defined, REAL DMA is used during the data transfer phases.
  *
  * REAL_DMA_POLL - if defined, REAL DMA is used but the driver doesn't
- *      rely on phase mismatch and EOP interrupts to determine end 
+ *      rely on phase mismatch and EOP interrupts to determine end
  *      of phase.
  *
  * UNSAFE - leave interrupts enabled during pseudo-DMA transfers.  You
@@ -224,9 +232,9 @@
  *          then, you're going to be better off twiddling with transfersize
  *          in the high level code.
  *
- * Defaults for these will be provided although the user may want to adjust 
+ * Defaults for these will be provided although the user may want to adjust
  * these to allocate CPU resources to the SCSI driver or "real" code.
- * 
+ *
  * USLEEP_SLEEP - amount of time, in jiffies, to sleep
  *
  * USLEEP_POLL - amount of time, in jiffies, to poll
@@ -237,21 +245,21 @@
  *
  * NCR5380_setup(instance) - initialize any local variables needed from a given
  *      instance of the host adapter for NCR5380_{read,write,pread,pwrite}
- * 
+ *
  * NCR5380_read(register)  - read from the specified register
  *
- * NCR5380_write(register, value) - write to the specific register 
+ * NCR5380_write(register, value) - write to the specific register
  *
- * NCR5380_implementation_fields  - additional fields needed for this 
+ * NCR5380_implementation_fields  - additional fields needed for this
  *      specific implementation of the NCR5380
  *
  * Either real DMA *or* pseudo DMA may be implemented
- * REAL functions : 
+ * REAL functions :
  * NCR5380_REAL_DMA should be defined if real DMA is to be used.
- * Note that the DMA setup functions should return the number of bytes 
+ * Note that the DMA setup functions should return the number of bytes
  *      that they were able to program the controller for.
  *
- * Also note that generic i386/PC versions of these macros are 
+ * Also note that generic i386/PC versions of these macros are
  *      available as NCR5380_i386_dma_write_setup,
  *      NCR5380_i386_dma_read_setup, and NCR5380_i386_dma_residual.
  *
@@ -264,7 +272,7 @@
  * NCR5380_pread(instance, dst, count);
  *
  * The generic driver is initialized by calling NCR5380_init(instance),
- * after setting the appropriate host specific fields and ID.  If the 
+ * after setting the appropriate host specific fields and ID.  If the
  * driver wishes to autoprobe for an IRQ line, the NCR5380_probe_irq(instance,
  * possible) function may be used.
  */
@@ -281,8 +289,8 @@ static void do_reset(struct Scsi_Host *host);
 
 static __inline__ void initialize_SCp(Scsi_Cmnd * cmd)
 {
-	/* 
-	 * Initialize the Scsi Pointer field so that all of the commands in the 
+	/*
+	 * Initialize the Scsi Pointer field so that all of the commands in the
 	 * various queues are valid.
 	 */
 
@@ -312,14 +320,15 @@ static __inline__ void initialize_SCp(Scsi_Cmnd * cmd)
  *
  *	Returns the value of the register or a negative error code.
  */
- 
-static int NCR5380_poll_politely(struct Scsi_Host *instance, int reg, int bit, int val, int t)
+
+static int NCR5380_poll_politely(struct Scsi_Host *instance,
+				 int reg, int bit, int val, int t)
 {
 	NCR5380_local_declare();
 	int n = 500;		/* At about 8uS a cycle for the cpu access */
 	unsigned long end = jiffies + t;
 	int r;
-	
+
 	NCR5380_setup(instance);
 
 	while( n-- > 0)
@@ -329,7 +338,7 @@ static int NCR5380_poll_politely(struct Scsi_Host *instance, int reg, int bit, i
 			return 0;
 		cpu_relax();
 	}
-	
+
 	/* t time yet ? */
 	while(time_before(jiffies, end))
 	{
@@ -348,12 +357,12 @@ static struct {
 	unsigned char value;
 	const char *name;
 } phases[] __maybe_unused = {
-	{PHASE_DATAOUT, "DATAOUT"}, 
-	{PHASE_DATAIN, "DATAIN"}, 
-	{PHASE_CMDOUT, "CMDOUT"}, 
-	{PHASE_STATIN, "STATIN"}, 
-	{PHASE_MSGOUT, "MSGOUT"}, 
-	{PHASE_MSGIN, "MSGIN"}, 
+	{PHASE_DATAOUT, "DATAOUT"},
+	{PHASE_DATAIN, "DATAIN"},
+	{PHASE_CMDOUT, "CMDOUT"},
+	{PHASE_STATIN, "STATIN"},
+	{PHASE_MSGOUT, "MSGOUT"},
+	{PHASE_MSGIN, "MSGIN"},
 	{PHASE_UNKNOWN, "UNKNOWN"}
 };
 
@@ -361,39 +370,39 @@ static struct {
 static struct {
 	unsigned char mask;
 	const char *name;
-} signals[] = { 
-	{SR_DBP, "PARITY"}, 
-	{SR_RST, "RST"}, 
-	{SR_BSY, "BSY"}, 
-	{SR_REQ, "REQ"}, 
-	{SR_MSG, "MSG"}, 
-	{SR_CD, "CD"}, 
-	{SR_IO, "IO"}, 
-	{SR_SEL, "SEL"}, 
+} signals[] = {
+	{SR_DBP, "PARITY"},
+	{SR_RST, "RST"},
+	{SR_BSY, "BSY"},
+	{SR_REQ, "REQ"},
+	{SR_MSG, "MSG"},
+	{SR_CD, "CD"},
+	{SR_IO, "IO"},
+	{SR_SEL, "SEL"},
 	{0, NULL}
-}, 
+},
 basrs[] = {
-	{BASR_ATN, "ATN"}, 
-	{BASR_ACK, "ACK"}, 
+	{BASR_ATN, "ATN"},
+	{BASR_ACK, "ACK"},
 	{0, NULL}
-}, 
-icrs[] = { 
-	{ICR_ASSERT_RST, "ASSERT RST"}, 
-	{ICR_ASSERT_ACK, "ASSERT ACK"}, 
-	{ICR_ASSERT_BSY, "ASSERT BSY"}, 
-	{ICR_ASSERT_SEL, "ASSERT SEL"}, 
-	{ICR_ASSERT_ATN, "ASSERT ATN"}, 
-	{ICR_ASSERT_DATA, "ASSERT DATA"}, 
+},
+icrs[] = {
+	{ICR_ASSERT_RST, "ASSERT RST"},
+	{ICR_ASSERT_ACK, "ASSERT ACK"},
+	{ICR_ASSERT_BSY, "ASSERT BSY"},
+	{ICR_ASSERT_SEL, "ASSERT SEL"},
+	{ICR_ASSERT_ATN, "ASSERT ATN"},
+	{ICR_ASSERT_DATA, "ASSERT DATA"},
 	{0, NULL}
-}, 
-mrs[] = { 
-	{MR_BLOCK_DMA_MODE, "MODE BLOCK DMA"}, 
-	{MR_TARGET, "MODE TARGET"}, 
-	{MR_ENABLE_PAR_CHECK, "MODE PARITY CHECK"}, 
-	{MR_ENABLE_PAR_INTR, "MODE PARITY INTR"}, 
-	{MR_MONITOR_BSY, "MODE MONITOR BSY"}, 
-	{MR_DMA_MODE, "MODE DMA"}, 
-	{MR_ARBITRATE, "MODE ARBITRATION"}, 
+},
+mrs[] = {
+	{MR_BLOCK_DMA_MODE, "MODE BLOCK DMA"},
+	{MR_TARGET, "MODE TARGET"},
+	{MR_ENABLE_PAR_CHECK, "MODE PARITY CHECK"},
+	{MR_ENABLE_PAR_INTR, "MODE PARITY INTR"},
+	{MR_MONITOR_BSY, "MODE MONITOR BSY"},
+	{MR_DMA_MODE, "MODE DMA"},
+	{MR_ARBITRATE, "MODE ARBITRATION"},
 	{0, NULL}
 };
 
@@ -438,11 +447,11 @@ static void NCR5380_print(struct Scsi_Host *instance)
 }
 
 
-/* 
+/*
  *	NCR5380_print_phase	-	show SCSI phase
  *	@instance: adapter to dump
  *
- * 	Print the current SCSI phase for debugging purposes
+ *	Print the current SCSI phase for debugging purposes
  *
  *	Locks: none
  */
@@ -456,16 +465,19 @@ static void NCR5380_print_phase(struct Scsi_Host *instance)
 
 	status = NCR5380_read(STATUS_REG);
 	if (!(status & SR_REQ))
-		printk("scsi%d : REQ not asserted, phase unknown.\n", instance->host_no);
+		printk("scsi%d : REQ not asserted, phase unknown.\n",
+		       instance->host_no);
 	else {
-		for (i = 0; (phases[i].value != PHASE_UNKNOWN) && (phases[i].value != (status & PHASE_MASK)); ++i);
-		printk("scsi%d : phase %s\n", instance->host_no, phases[i].name);
+		for (i = 0; (phases[i].value != PHASE_UNKNOWN) &&
+			     (phases[i].value != (status & PHASE_MASK)); ++i);
+		printk("scsi%d : phase %s\n", instance->host_no,
+		       phases[i].name);
 	}
 }
 #endif
 
 /*
- * These need tweaking, and would probably work best as per-device 
+ * These need tweaking, and would probably work best as per-device
  * flags initialized differently for disk, tape, cd, etc devices.
  * People with broken devices are free to experiment as to what gives
  * the best results for them.
@@ -487,26 +499,26 @@ static void NCR5380_print_phase(struct Scsi_Host *instance)
 #define USLEEP_WAITLONG USLEEP_SLEEP
 #endif
 
-/* 
+/*
  * Function : int should_disconnect (unsigned char cmd)
  *
- * Purpose : decide whether a command would normally disconnect or 
+ * Purpose : decide whether a command would normally disconnect or
  *      not, since if it won't disconnect we should go to sleep.
  *
  * Input : cmd - opcode of SCSI command
  *
- * Returns : DISCONNECT_LONG if we should disconnect for a really long 
- *      time (ie always, sleep, look for REQ active, sleep), 
+ * Returns : DISCONNECT_LONG if we should disconnect for a really long
+ *      time (ie always, sleep, look for REQ active, sleep),
  *      DISCONNECT_TIME_TO_DATA if we would only disconnect for a normal
  *      time-to-data delay, DISCONNECT_NONE if this command would return
  *      immediately.
  *
- *      Future sleep algorithms based on time to data can exploit 
- *      something like this so they can differentiate between "normal" 
+ *      Future sleep algorithms based on time to data can exploit
+ *      something like this so they can differentiate between "normal"
  *      (ie, read, write, seek) and unusual commands (ie, * format).
  *
  * Note : We don't deal with commands that handle an immediate disconnect,
- *        
+ *
  */
 
 static int should_disconnect(unsigned char cmd)
@@ -529,7 +541,8 @@ static int should_disconnect(unsigned char cmd)
 	}
 }
 
-static void NCR5380_set_timer(struct NCR5380_hostdata *hostdata, unsigned long timeout)
+static void NCR5380_set_timer(struct NCR5380_hostdata *hostdata,
+			      unsigned long timeout)
 {
 	hostdata->time_expires = jiffies + timeout;
 	schedule_delayed_work(&hostdata->coroutine, timeout);
@@ -547,7 +560,7 @@ static int probe_irq __initdata = 0;
  *	Set a flag to indicate the IRQ in question was received. This is
  *	used by the IRQ probe code.
  */
- 
+
 static irqreturn_t __init probe_intr(int irq, void *dev_id)
 {
 	probe_irq = irq;
@@ -575,7 +588,8 @@ static int __init __maybe_unused NCR5380_probe_irq(struct Scsi_Host *instance,
 	NCR5380_setup(instance);
 
 	for (trying_irqs = i = 0, mask = 1; i < 16; ++i, mask <<= 1)
-		if ((mask & possible) && (request_irq(i, &probe_intr, 0, "NCR-probe", NULL) == 0))
+		if ((mask & possible) && (request_irq(i, &probe_intr, 0,
+						      "NCR-probe", NULL) == 0))
 			trying_irqs |= mask;
 
 	timeout = jiffies + (250 * HZ / 1000);
@@ -583,7 +597,7 @@ static int __init __maybe_unused NCR5380_probe_irq(struct Scsi_Host *instance,
 
 	/*
 	 * A interrupt is triggered whenever BSY = false, SEL = true
-	 * and a bit set in the SELECT_ENABLE_REG is asserted on the 
+	 * and a bit set in the SELECT_ENABLE_REG is asserted on the
 	 * SCSI bus.
 	 *
 	 * Note that the bus is only driven when the phase control signals
@@ -594,11 +608,12 @@ static int __init __maybe_unused NCR5380_probe_irq(struct Scsi_Host *instance,
 	NCR5380_write(TARGET_COMMAND_REG, 0);
 	NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
 	NCR5380_write(OUTPUT_DATA_REG, hostdata->id_mask);
-	NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_DATA | ICR_ASSERT_SEL);
+	NCR5380_write(INITIATOR_COMMAND_REG,
+		      ICR_BASE | ICR_ASSERT_DATA | ICR_ASSERT_SEL);
 
 	while (probe_irq == SCSI_IRQ_NONE && time_before(jiffies, timeout))
 		schedule_timeout_uninterruptible(1);
-	
+
 	NCR5380_write(SELECT_ENABLE_REG, 0);
 	NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
 
@@ -613,7 +628,7 @@ static int __init __maybe_unused NCR5380_probe_irq(struct Scsi_Host *instance,
  *	NCR58380_print_options	-	show options
  *	@instance: unused for now
  *
- *	Called by probe code indicating the NCR5380 driver options that 
+ *	Called by probe code indicating the NCR5380 driver options that
  *	were selected. At some point this will switch to runtime options
  *	read from the adapter in question
  *
@@ -649,7 +664,8 @@ NCR5380_print_options(struct Scsi_Host *instance)
 	       " UNSAFE "
 #endif
 	    );
-	printk(" USLEEP, USLEEP_POLL=%d USLEEP_SLEEP=%d", USLEEP_POLL, USLEEP_SLEEP);
+	printk(" USLEEP, USLEEP_POLL=%d USLEEP_SLEEP=%d",
+	       USLEEP_POLL, USLEEP_SLEEP);
 	printk(" generic release=%d", NCR5380_PUBLIC_RELEASE);
 	if (((struct NCR5380_hostdata *) instance->hostdata)->flags & FLAG_NCR53C400) {
 		printk(" ncr53c400 release=%d", NCR53C400_PUBLIC_RELEASE);
@@ -657,10 +673,10 @@ NCR5380_print_options(struct Scsi_Host *instance)
 }
 
 /**
- *	NCR5380_print_status 	-	dump controller info
+ *	NCR5380_print_status	-	dump controller info
  *	@instance: controller to dump
  *
- *	Print commands in the various queues, called from NCR5380_abort 
+ *	Print commands in the various queues, called from NCR5380_abort
  *	and NCR5380_debug to aid debugging.
  *
  *	Locks: called functions disable irqs
@@ -791,11 +807,11 @@ static void lprint_opcode(int opcode, struct seq_file *m)
  *      with flags OR'd into the initial flags value.
  *
  *	Notes : I assume that the host, hostno, and id bits have been
- *      set correctly.  I don't care about the irq and other fields. 
+ *      set correctly.  I don't care about the irq and other fields.
  *
  *	Returns 0 for success
  *
- *	Locks: interrupts must be enabled when we are called 
+ *	Locks: interrupts must be enabled when we are called
  */
 
 static int NCR5380_init(struct Scsi_Host *instance, int flags)
@@ -807,8 +823,8 @@ static int NCR5380_init(struct Scsi_Host *instance, int flags)
 
 	if(in_interrupt())
 		printk(KERN_ERR "NCR5380_init called with interrupts off!\n");
-	/* 
-	 * On NCR53C400 boards, NCR5380 registers are mapped 8 past 
+	/*
+	 * On NCR53C400 boards, NCR5380 registers are mapped 8 past
 	 * the base address.
 	 */
 
@@ -833,9 +849,9 @@ static int NCR5380_init(struct Scsi_Host *instance, int flags)
 	hostdata->connected = NULL;
 	hostdata->issue_queue = NULL;
 	hostdata->disconnected_queue = NULL;
-	
+
 	INIT_DELAYED_WORK(&hostdata->coroutine, NCR5380_main);
-	
+
 #ifdef NCR5380_STATS
 	for (i = 0; i < 8; ++i) {
 		hostdata->time_read[i] = 0;
@@ -860,7 +876,7 @@ static int NCR5380_init(struct Scsi_Host *instance, int flags)
 #ifndef AUTOSENSE
 	if ((instance->cmd_per_lun > 1) || instance->can_queue > 1)
 		    printk(KERN_WARNING "scsi%d : WARNING : support for multiple outstanding commands enabled\n" "         without AUTOSENSE option, contingent allegiance conditions may\n"
-		    	   "         be incorrectly cleared.\n", instance->host_no);
+			   "         be incorrectly cleared.\n", instance->host_no);
 #endif				/* def AUTOSENSE */
 
 	NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
@@ -874,16 +890,16 @@ static int NCR5380_init(struct Scsi_Host *instance, int flags)
 	}
 #endif
 
-	/* 
+	/*
 	 * Detect and correct bus wedge problems.
 	 *
-	 * If the system crashed, it may have crashed in a state 
-	 * where a SCSI command was still executing, and the 
+	 * If the system crashed, it may have crashed in a state
+	 * where a SCSI command was still executing, and the
 	 * SCSI bus is not in a BUS FREE STATE.
 	 *
 	 * If this is the case, we'll try to abort the currently
 	 * established nexus which we know nothing about, and that
-	 * failing, do a hard reset of the SCSI bus 
+	 * failing, do a hard reset of the SCSI bus
 	 */
 
 	for (pass = 1; (NCR5380_read(STATUS_REG) & SR_BSY) && pass <= 6; ++pass) {
@@ -924,12 +940,12 @@ static void NCR5380_exit(struct Scsi_Host *instance)
 }
 
 /**
- *	NCR5380_queue_command 		-	queue a command
+ *	NCR5380_queue_command		-	queue a command
  *	@cmd: SCSI command
  *	@done: completion handler
  *
- *      cmd is added to the per instance issue_queue, with minor 
- *      twiddling done to the host specific fields of cmd.  If the 
+ *      cmd is added to the per instance issue_queue, with minor
+ *      twiddling done to the host specific fields of cmd.  If the
  *      main coroutine is not running, it is restarted.
  *
  *	Locks: host lock taken by caller
@@ -971,19 +987,19 @@ static int NCR5380_queue_command_lck(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)
 	}
 #endif
 
-	/* 
-	 * We use the host_scribble field as a pointer to the next command  
-	 * in a queue 
+	/*
+	 * We use the host_scribble field as a pointer to the next command
+	 * in a queue
 	 */
 
 	cmd->host_scribble = NULL;
 	cmd->scsi_done = done;
 	cmd->result = 0;
 
-	/* 
-	 * Insert the cmd into the issue queue. Note that REQUEST SENSE 
+	/*
+	 * Insert the cmd into the issue queue. Note that REQUEST SENSE
 	 * commands are added to the head of the queue since any command will
-	 * clear the contingent allegiance condition that exists and the 
+	 * clear the contingent allegiance condition that exists and the
 	 * sense data is only guaranteed to be valid while the condition exists.
 	 */
 
@@ -1009,11 +1025,11 @@ static DEF_SCSI_QCMD(NCR5380_queue_command)
 /**
  *	NCR5380_main	-	NCR state machines
  *
- *	NCR5380_main is a coroutine that runs as long as more work can 
- *      be done on the NCR5380 host adapters in a system.  Both 
- *      NCR5380_queue_command() and NCR5380_intr() will try to start it 
+ *	NCR5380_main is a coroutine that runs as long as more work can
+ *      be done on the NCR5380 host adapters in a system.  Both
+ *      NCR5380_queue_command() and NCR5380_intr() will try to start it
  *      in case it is not running.
- * 
+ *
  *	Locks: called as its own thread with no locks held. Takes the
  *	host lock and called routines may take the isa dma lock.
  */
@@ -1025,7 +1041,7 @@ static void NCR5380_main(struct work_struct *work)
 	struct Scsi_Host *instance = hostdata->host;
 	Scsi_Cmnd *tmp, *prev;
 	int done;
-	
+
 	spin_lock_irq(instance->host_lock);
 	do {
 		/* Lock held here */
@@ -1036,7 +1052,7 @@ static void NCR5380_main(struct work_struct *work)
 			 * Search through the issue_queue for a command destined
 			 * for a target that's not busy.
 			 */
-			for (tmp = (Scsi_Cmnd *) hostdata->issue_queue, prev = NULL; tmp; prev = tmp, tmp = (Scsi_Cmnd *) tmp->host_scribble) 
+			for (tmp = (Scsi_Cmnd *) hostdata->issue_queue, prev = NULL; tmp; prev = tmp, tmp = (Scsi_Cmnd *) tmp->host_scribble)
 			{
 				if (prev != tmp)
 				    dprintk(NDEBUG_LISTS, "MAIN tmp=%p   target=%d   busy=%d lun=%llu\n", tmp, tmp->device->id, hostdata->busy[tmp->device->id], tmp->device->lun);
@@ -1052,17 +1068,17 @@ static void NCR5380_main(struct work_struct *work)
 					}
 					tmp->host_scribble = NULL;
 
-					/* 
-					 * Attempt to establish an I_T_L nexus here. 
+					/*
+					 * Attempt to establish an I_T_L nexus here.
 					 * On success, instance->hostdata->connected is set.
 					 * On failure, we must add the command back to the
-					 *   issue queue so we can keep trying. 
+					 *   issue queue so we can keep trying.
 					 */
 					dprintk(NDEBUG_MAIN|NDEBUG_QUEUES, "scsi%d : main() : command for target %d lun %llu removed from issue_queue\n", instance->host_no, tmp->device->id, tmp->device->lun);
-	
+
 					/*
-					 * A successful selection is defined as one that 
-					 * leaves us with the command connected and 
+					 * A successful selection is defined as one that
+					 * leaves us with the command connected and
 					 * in hostdata->connected, OR has terminated the
 					 * command.
 					 *
@@ -1074,10 +1090,10 @@ static void NCR5380_main(struct work_struct *work)
 					/* RvC: have to preset this to indicate a new command is being performed */
 
 					if (!NCR5380_select(instance, tmp,
-							    /* 
+							    /*
 							     * REQUEST SENSE commands are issued without tagged
-							     * queueing, even on SCSI-II devices because the 
-							     * contingent allegiance condition exists for the 
+							     * queueing, even on SCSI-II devices because the
+							     * contingent allegiance condition exists for the
 							     * entire unit.
 							     */
 							    (tmp->cmnd[0] == REQUEST_SENSE) ? TAG_NONE : TAG_NEXT)) {
@@ -1124,19 +1140,19 @@ static void NCR5380_main(struct work_struct *work)
 		} else
 			break;
 	} while (!done);
-	
+
 	spin_unlock_irq(instance->host_lock);
 }
 
 #ifndef DONT_USE_INTR
 
 /**
- * 	NCR5380_intr	-	generic NCR5380 irq handler
+ *	NCR5380_intr	-	generic NCR5380 irq handler
  *	@irq: interrupt number
  *	@dev_id: device info
  *
  *	Handle interrupts, reestablishing I_T_L or I_T_L_Q nexuses
- *      from the disconnected queue, and restarting NCR5380_main() 
+ *      from the disconnected queue, and restarting NCR5380_main()
  *      as required.
  *
  *	Locks: takes the needed instance locks
@@ -1194,7 +1210,7 @@ static irqreturn_t NCR5380_intr(int dummy, void *dev_id)
 					hostdata->dmalen = 0;
 
 					(void) NCR5380_read(RESET_PARITY_INTERRUPT_REG);
-							
+
 					/* FIXME: we need to poll briefly then defer a workqueue task ! */
 					NCR5380_poll_politely(hostdata, BUS_AND_STATUS_REG, BASR_ACK, 0, 2*HZ);
 
@@ -1214,17 +1230,16 @@ static irqreturn_t NCR5380_intr(int dummy, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-#endif 
+#endif
 
 /**
  *	collect_stats		-	collect stats on a scsi command
- *	@hostdata: adapter 
+ *	@hostdata: adapter
  *	@cmd: command being issued
  *
  *	Update the statistical data by parsing the command in question
  */
- 
-static void collect_stats(struct NCR5380_hostdata *hostdata, Scsi_Cmnd * cmd) 
+static void collect_stats(struct NCR5380_hostdata *hostdata, Scsi_Cmnd * cmd)
 {
 #ifdef NCR5380_STATS
 	switch (cmd->cmnd[0]) {
@@ -1245,40 +1260,39 @@ static void collect_stats(struct NCR5380_hostdata *hostdata, Scsi_Cmnd * cmd)
 }
 
 
-/* 
- * Function : int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, 
+/*
+ * Function : int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd,
  *      int tag);
  *
  * Purpose : establishes I_T_L or I_T_L_Q nexus for new or existing command,
- *      including ARBITRATION, SELECTION, and initial message out for 
- *      IDENTIFY and queue messages. 
+ *      including ARBITRATION, SELECTION, and initial message out for
+ *      IDENTIFY and queue messages.
  *
- * Inputs : instance - instantiation of the 5380 driver on which this 
- *      target lives, cmd - SCSI command to execute, tag - set to TAG_NEXT for 
- *      new tag, TAG_NONE for untagged queueing, otherwise set to the tag for 
+ * Inputs : instance - instantiation of the 5380 driver on which this
+ *      target lives, cmd - SCSI command to execute, tag - set to TAG_NEXT for
+ *      new tag, TAG_NONE for untagged queueing, otherwise set to the tag for
  *      the command that is presently connected.
- * 
+ *
  * Returns : -1 if selection could not execute for some reason,
- *      0 if selection succeeded or failed because the target 
+ *      0 if selection succeeded or failed because the target
  *      did not respond.
  *
- * Side effects : 
- *      If bus busy, arbitration failed, etc, NCR5380_select() will exit 
+ * Side effects :
+ *      If bus busy, arbitration failed, etc, NCR5380_select() will exit
  *              with registers as they should have been on entry - ie
  *              SELECT_ENABLE will be set appropriately, the NCR5380
  *              will cease to drive any SCSI bus signals.
  *
- *      If successful : I_T_L or I_T_L_Q nexus will be established, 
- *              instance->connected will be set to cmd.  
+ *      If successful : I_T_L or I_T_L_Q nexus will be established,
+ *              instance->connected will be set to cmd.
  *              SELECT interrupt will be disabled.
  *
- *      If failed (no target) : cmd->scsi_done() will be called, and the 
+ *      If failed (no target) : cmd->scsi_done() will be called, and the
  *              cmd->result host byte set to DID_BAD_TARGET.
  *
  *	Locks: caller holds hostdata lock in IRQ mode
  */
- 
-static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag) 
+static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag)
 {
 	NCR5380_local_declare();
 	struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata;
@@ -1298,14 +1312,14 @@ static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag)
 	NCR5380_dprint(NDEBUG_ARBITRATION, instance);
 	dprintk(NDEBUG_ARBITRATION, "scsi%d : starting arbitration, id = %d\n", instance->host_no, instance->this_id);
 
-	/* 
-	 * Set the phase bits to 0, otherwise the NCR5380 won't drive the 
+	/*
+	 * Set the phase bits to 0, otherwise the NCR5380 won't drive the
 	 * data bus during SELECTION.
 	 */
 
 	NCR5380_write(TARGET_COMMAND_REG, 0);
 
-	/* 
+	/*
 	 * Start arbitration.
 	 */
 
@@ -1327,8 +1341,8 @@ static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag)
 
 	dprintk(NDEBUG_ARBITRATION, "scsi%d : arbitration complete\n", instance->host_no);
 
-	/* 
-	 * The arbitration delay is 2.2us, but this is a minimum and there is 
+	/*
+	 * The arbitration delay is 2.2us, but this is a minimum and there is
 	 * no maximum so we can safely sleep for ceil(2.2) usecs to accommodate
 	 * the integral nature of udelay().
 	 *
@@ -1355,8 +1369,8 @@ static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag)
 		dprintk(NDEBUG_ARBITRATION, "scsi%d : lost arbitration, deasserting ICR_ASSERT_SEL\n", instance->host_no);
 		goto failed;
 	}
-	/* 
-	 * Again, bus clear + bus settle time is 1.2us, however, this is 
+	/*
+	 * Again, bus clear + bus settle time is 1.2us, however, this is
 	 * a minimum so we'll udelay ceil(1.2)
 	 */
 
@@ -1364,14 +1378,14 @@ static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag)
 
 	dprintk(NDEBUG_ARBITRATION, "scsi%d : won arbitration\n", instance->host_no);
 
-	/* 
-	 * Now that we have won arbitration, start Selection process, asserting 
+	/*
+	 * Now that we have won arbitration, start Selection process, asserting
 	 * the host and target ID's on the SCSI bus.
 	 */
 
 	NCR5380_write(OUTPUT_DATA_REG, (hostdata->id_mask | (1 << scmd_id(cmd))));
 
-	/* 
+	/*
 	 * Raise ATN while SEL is true before BSY goes false from arbitration,
 	 * since this is the only way to guarantee that we'll get a MESSAGE OUT
 	 * phase immediately after selection.
@@ -1380,14 +1394,14 @@ static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag)
 	NCR5380_write(INITIATOR_COMMAND_REG, (ICR_BASE | ICR_ASSERT_BSY | ICR_ASSERT_DATA | ICR_ASSERT_ATN | ICR_ASSERT_SEL));
 	NCR5380_write(MODE_REG, MR_BASE);
 
-	/* 
+	/*
 	 * Reselect interrupts must be turned off prior to the dropping of BSY,
 	 * otherwise we will trigger an interrupt.
 	 */
 	NCR5380_write(SELECT_ENABLE_REG, 0);
 
 	/*
-	 * The initiator shall then wait at least two deskew delays and release 
+	 * The initiator shall then wait at least two deskew delays and release
 	 * the BSY signal.
 	 */
 	udelay(1);		/* wingel -- wait two bus deskew delay >2*45ns */
@@ -1395,17 +1409,17 @@ static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag)
 	/* Reset BSY */
 	NCR5380_write(INITIATOR_COMMAND_REG, (ICR_BASE | ICR_ASSERT_DATA | ICR_ASSERT_ATN | ICR_ASSERT_SEL));
 
-	/* 
+	/*
 	 * Something weird happens when we cease to drive BSY - looks
-	 * like the board/chip is letting us do another read before the 
+	 * like the board/chip is letting us do another read before the
 	 * appropriate propagation delay has expired, and we're confusing
 	 * a BSY signal from ourselves as the target's response to SELECTION.
 	 *
 	 * A small delay (the 'C++' frontend breaks the pipeline with an
 	 * unnecessary jump, making it work on my 386-33/Trantor T128, the
-	 * tighter 'C' code breaks and requires this) solves the problem - 
-	 * the 1 us delay is arbitrary, and only used because this delay will 
-	 * be the same on other platforms and since it works here, it should 
+	 * tighter 'C' code breaks and requires this) solves the problem -
+	 * the 1 us delay is arbitrary, and only used because this delay will
+	 * be the same on other platforms and since it works here, it should
 	 * work there.
 	 *
 	 * wingel suggests that this could be due to failing to wait
@@ -1416,15 +1430,15 @@ static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag)
 
 	dprintk(NDEBUG_SELECTION, "scsi%d : selecting target %d\n", instance->host_no, scmd_id(cmd));
 
-	/* 
-	 * The SCSI specification calls for a 250 ms timeout for the actual 
+	/*
+	 * The SCSI specification calls for a 250 ms timeout for the actual
 	 * selection.
 	 */
 
 	timeout = jiffies + (250 * HZ / 1000);
 
-	/* 
-	 * XXX very interesting - we're seeing a bounce where the BSY we 
+	/*
+	 * XXX very interesting - we're seeing a bounce where the BSY we
 	 * asserted is being reflected / still asserted (propagation delay?)
 	 * and it's detecting as true.  Sigh.
 	 */
@@ -1455,9 +1469,9 @@ part2:
 		NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
 		return -1;
 	}
-	/* 
-	 * No less than two deskew delays after the initiator detects the 
-	 * BSY signal is true, it shall release the SEL signal and may 
+	/*
+	 * No less than two deskew delays after the initiator detects the
+	 * BSY signal is true, it shall release the SEL signal and may
 	 * change the DATA BUS.                                     -wingel
 	 */
 
@@ -1486,11 +1500,11 @@ part2:
 	hostdata->targets_present |= (1 << scmd_id(cmd));
 
 	/*
-	 * Since we followed the SCSI spec, and raised ATN while SEL 
+	 * Since we followed the SCSI spec, and raised ATN while SEL
 	 * was true but before BSY was false during selection, the information
 	 * transfer phase should be a MESSAGE OUT phase so that we can send the
 	 * IDENTIFY message.
-	 * 
+	 *
 	 * If SCSI-II tagged queuing is enabled, we also send a SIMPLE_QUEUE_TAG
 	 * message (2 bytes) with a tag ID that we increment with every command
 	 * until it wraps back to 0.
@@ -1505,7 +1519,7 @@ part2:
 	spin_unlock_irq(instance->host_lock);
 	err = NCR5380_poll_politely(instance, STATUS_REG, SR_REQ, SR_REQ, HZ);
 	spin_lock_irq(instance->host_lock);
-	
+
 	if(err) {
 		printk(KERN_ERR "scsi%d: timeout at NCR5380.c:%d\n", instance->host_no, __LINE__);
 		NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
@@ -1537,16 +1551,16 @@ failed:
 
 }
 
-/* 
- * Function : int NCR5380_transfer_pio (struct Scsi_Host *instance, 
+/*
+ * Function : int NCR5380_transfer_pio (struct Scsi_Host *instance,
  *      unsigned char *phase, int *count, unsigned char **data)
  *
  * Purpose : transfers data in given phase using polled I/O
  *
- * Inputs : instance - instance of driver, *phase - pointer to 
- *      what phase is expected, *count - pointer to number of 
+ * Inputs : instance - instance of driver, *phase - pointer to
+ *      what phase is expected, *count - pointer to number of
  *      bytes to transfer, **data - pointer to data pointer.
- * 
+ *
  * Returns : -1 when different phase is entered without transferring
  *      maximum number of bytes, 0 if all bytes or transferred or exit
  *      is in same phase.
@@ -1557,7 +1571,7 @@ failed:
  */
 
 /*
- * Note : this code is not as quick as it could be, however it 
+ * Note : this code is not as quick as it could be, however it
  * IS 100% reliable, and for the actual data transfer where speed
  * counts, we will always do a pseudo DMA or DMA transfer.
  */
@@ -1579,8 +1593,8 @@ static int NCR5380_transfer_pio(struct Scsi_Host *instance, unsigned char *phase
 	else
 		dprintk(NDEBUG_PIO, "scsi%d : pio read %d bytes\n", instance->host_no, c);
 
-	/* 
-	 * The NCR5380 chip will only drive the SCSI bus when the 
+	/*
+	 * The NCR5380 chip will only drive the SCSI bus when the
 	 * phase specified in the appropriate bits of the TARGET COMMAND
 	 * REGISTER match the STATUS REGISTER
 	 */
@@ -1594,9 +1608,9 @@ static int NCR5380_transfer_pio(struct Scsi_Host *instance, unsigned char *phase
 		break_allowed = 1;
 	}
 	do {
-		/* 
-		 * Wait for assertion of REQ, after which the phase bits will be 
-		 * valid 
+		/*
+		 * Wait for assertion of REQ, after which the phase bits will be
+		 * valid
 		 */
 
 		/* RvC: we simply poll once, after that we stop temporarily
@@ -1628,7 +1642,7 @@ static int NCR5380_transfer_pio(struct Scsi_Host *instance, unsigned char *phase
 
 		++d;
 
-		/* 
+		/*
 		 * The SCSI standard suggests that in MSGOUT phase, the initiator
 		 * should drop ATN on the last byte of the message phase
 		 * after REQ has been asserted for the handshake but before
@@ -1655,11 +1669,11 @@ static int NCR5380_transfer_pio(struct Scsi_Host *instance, unsigned char *phase
 		dprintk(NDEBUG_HANDSHAKE, "scsi%d : req false, handshake complete\n", instance->host_no);
 
 /*
- * We have several special cases to consider during REQ/ACK handshaking : 
- * 1.  We were in MSGOUT phase, and we are on the last byte of the 
+ * We have several special cases to consider during REQ/ACK handshaking :
+ * 1.  We were in MSGOUT phase, and we are on the last byte of the
  *      message.  ATN must be dropped as ACK is dropped.
  *
- * 2.  We are in a MSGIN phase, and we are on the last byte of the  
+ * 2.  We are in a MSGIN phase, and we are on the last byte of the
  *      message.  We must exit with ACK asserted, so that the calling
  *      code may raise ATN before dropping ACK to reject the message.
  *
@@ -1698,7 +1712,7 @@ static int NCR5380_transfer_pio(struct Scsi_Host *instance, unsigned char *phase
  *
  *	Locks: caller holds queue lock
  */
- 
+
 static void do_reset(struct Scsi_Host *host) {
 	NCR5380_local_declare();
 	NCR5380_setup(host);
@@ -1711,10 +1725,10 @@ static void do_reset(struct Scsi_Host *host) {
 
 /*
  * Function : do_abort (Scsi_Host *host)
- * 
- * Purpose : abort the currently established nexus.  Should only be 
- *      called from a routine which can drop into a 
- * 
+ *
+ * Purpose : abort the currently established nexus.  Should only be
+ *      called from a routine which can drop into a
+ *
  * Returns : 0 on success, -1 on failure.
  *
  * Locks: queue lock held by caller
@@ -1732,23 +1746,23 @@ static int do_abort(struct Scsi_Host *host) {
 	/* Request message out phase */
 	NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
 
-	/* 
-	 * Wait for the target to indicate a valid phase by asserting 
-	 * REQ.  Once this happens, we'll have either a MSGOUT phase 
-	 * and can immediately send the ABORT message, or we'll have some 
+	/*
+	 * Wait for the target to indicate a valid phase by asserting
+	 * REQ.  Once this happens, we'll have either a MSGOUT phase
+	 * and can immediately send the ABORT message, or we'll have some
 	 * other phase and will have to source/sink data.
-	 * 
+	 *
 	 * We really don't care what value was on the bus or what value
 	 * the target sees, so we just handshake.
 	 */
 
 	rc = NCR5380_poll_politely(host, STATUS_REG, SR_REQ, SR_REQ, 60 * HZ);
-	
+
 	if(rc < 0)
 		return -1;
 
 	tmp = (unsigned char)rc;
-	
+
 	NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(tmp));
 
 	if ((tmp & PHASE_MASK) != PHASE_MSGOUT) {
@@ -1773,17 +1787,17 @@ static int do_abort(struct Scsi_Host *host) {
 }
 
 #if defined(REAL_DMA) || defined(PSEUDO_DMA) || defined (REAL_DMA_POLL)
-/* 
- * Function : int NCR5380_transfer_dma (struct Scsi_Host *instance, 
+/*
+ * Function : int NCR5380_transfer_dma (struct Scsi_Host *instance,
  *      unsigned char *phase, int *count, unsigned char **data)
  *
  * Purpose : transfers data in given phase using either real
  *      or pseudo DMA.
  *
- * Inputs : instance - instance of driver, *phase - pointer to 
- *      what phase is expected, *count - pointer to number of 
+ * Inputs : instance - instance of driver, *phase - pointer to
+ *      what phase is expected, *count - pointer to number of
  *      bytes to transfer, **data - pointer to data pointer.
- * 
+ *
  * Returns : -1 when different phase is entered without transferring
  *      maximum number of bytes, 0 if all bytes or transferred or exit
  *      is in same phase.
@@ -1833,7 +1847,7 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase
 #else
 	/*
 	 * Note : on my sample board, watch-dog timeouts occurred when interrupts
-	 * were not disabled for the duration of a single DMA transfer, from 
+	 * were not disabled for the duration of a single DMA transfer, from
 	 * before the setting of DMA mode to after transfer of the last byte.
 	 */
 
@@ -1851,7 +1865,7 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase
 
 	dprintk(NDEBUG_DMA, "scsi%d : mode reg = 0x%X\n", instance->host_no, NCR5380_read(MODE_REG));
 
-	/* 
+	/*
 	 *	On the PAS16 at least I/O recovery delays are not needed here.
 	 *	Everyone else seems to want them.
 	 */
@@ -1971,24 +1985,24 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase
 		}
 		if (!(foo = NCR5380_pread(instance, d, c - diff))) {
 			/*
-			 * We can't disable DMA mode after successfully transferring 
+			 * We can't disable DMA mode after successfully transferring
 			 * what we plan to be the last byte, since that would open up
-			 * a race condition where if the target asserted REQ before 
+			 * a race condition where if the target asserted REQ before
 			 * we got the DMA mode reset, the NCR5380 would have latched
 			 * an additional byte into the INPUT DATA register and we'd
 			 * have dropped it.
-			 * 
-			 * The workaround was to transfer one fewer bytes than we 
-			 * intended to with the pseudo-DMA read function, wait for 
+			 *
+			 * The workaround was to transfer one fewer bytes than we
+			 * intended to with the pseudo-DMA read function, wait for
 			 * the chip to latch the last byte, read it, and then disable
 			 * pseudo-DMA mode.
-			 * 
+			 *
 			 * After REQ is asserted, the NCR5380 asserts DRQ and ACK.
 			 * REQ is deasserted when ACK is asserted, and not reasserted
 			 * until ACK goes false.  Since the NCR5380 won't lower ACK
 			 * until DACK is asserted, which won't happen unless we twiddle
-			 * the DMA port or we take the NCR5380 out of DMA mode, we 
-			 * can guarantee that we won't handshake another extra 
+			 * the DMA port or we take the NCR5380 out of DMA mode, we
+			 * can guarantee that we won't handshake another extra
 			 * byte.
 			 */
 
@@ -2008,8 +2022,8 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase
 		dprintk(NDEBUG_C400_PWRITE, "About to pwrite %d bytes\n", c);
 		if (!(foo = NCR5380_pwrite(instance, d, c))) {
 			/*
-			 * Wait for the last byte to be sent.  If REQ is being asserted for 
-			 * the byte we're interested, we'll ACK it and it will go false.  
+			 * Wait for the last byte to be sent.  If REQ is being asserted for
+			 * the byte we're interested, we'll ACK it and it will go false.
 			 */
 			if (!(hostdata->flags & FLAG_HAS_LAST_BYTE_SENT)) {
 				timeout = 20000;
@@ -2059,17 +2073,17 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase
 /*
  * Function : NCR5380_information_transfer (struct Scsi_Host *instance)
  *
- * Purpose : run through the various SCSI phases and do as the target 
- *      directs us to.  Operates on the currently connected command, 
+ * Purpose : run through the various SCSI phases and do as the target
+ *      directs us to.  Operates on the currently connected command,
  *      instance->connected.
  *
  * Inputs : instance, instance for which we are doing commands
  *
- * Side effects : SCSI things happen, the disconnected queue will be 
+ * Side effects : SCSI things happen, the disconnected queue will be
  *      modified if a command disconnects, *instance->connected will
  *      change.
  *
- * XXX Note : we need to watch for bus free or a reset condition here 
+ * XXX Note : we need to watch for bus free or a reset condition here
  *      to recover from an unexpected bus free condition.
  *
  * Locks: io_request_lock held by caller in IRQ mode
@@ -2121,7 +2135,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
 				cmd->scsi_done(cmd);
 				return;
 #endif
-				/* 
+				/*
 				 * If there is no room left in the current buffer in the
 				 * scatter-gather list, move onto the next one.
 				 */
@@ -2134,7 +2148,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
 					dprintk(NDEBUG_INFORMATION, "scsi%d : %d bytes and %d buffers left\n", instance->host_no, cmd->SCp.this_residual, cmd->SCp.buffers_residual);
 				}
 				/*
-				 * The preferred transfer method is going to be 
+				 * The preferred transfer method is going to be
 				 * PSEUDO-DMA for systems that are strictly PIO,
 				 * since we can let the hardware do the handshaking.
 				 *
@@ -2197,13 +2211,13 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
 
 				switch (tmp) {
 					/*
-					 * Linking lets us reduce the time required to get the 
+					 * Linking lets us reduce the time required to get the
 					 * next command out to the device, hopefully this will
 					 * mean we don't waste another revolution due to the delays
 					 * required by ARBITRATION and another SELECTION.
 					 *
 					 * In the current implementation proposal, low level drivers
-					 * merely have to start the next command, pointed to by 
+					 * merely have to start the next command, pointed to by
 					 * next_link, done() is called as with unlinked commands.
 					 */
 #ifdef LINKED
@@ -2212,7 +2226,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
 					/* Accept message by clearing ACK */
 					NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
 					dprintk(NDEBUG_LINKED, "scsi%d : target %d lun %llu linked command complete.\n", instance->host_no, cmd->device->id, cmd->device->lun);
-					/* 
+					/*
 					 * Sanity check : A linked command should only terminate with
 					 * one of these messages if there are more linked commands
 					 * available.
@@ -2242,20 +2256,20 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
 					dprintk(NDEBUG_QUEUES, "scsi%d : command for target %d, lun %llu completed\n", instance->host_no, cmd->device->id, cmd->device->lun);
 					hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xFF));
 
-					/* 
-					 * I'm not sure what the correct thing to do here is : 
-					 * 
-					 * If the command that just executed is NOT a request 
+					/*
+					 * I'm not sure what the correct thing to do here is :
+					 *
+					 * If the command that just executed is NOT a request
 					 * sense, the obvious thing to do is to set the result
 					 * code to the values of the stored parameters.
-					 * 
-					 * If it was a REQUEST SENSE command, we need some way 
+					 *
+					 * If it was a REQUEST SENSE command, we need some way
 					 * to differentiate between the failure code of the original
 					 * and the failure code of the REQUEST sense - the obvious
 					 * case is success, where we fall through and leave the result
 					 * code unchanged.
-					 * 
-					 * The non-obvious place is where the REQUEST SENSE failed 
+					 *
+					 * The non-obvious place is where the REQUEST SENSE failed
 					 */
 
 					if (cmd->cmnd[0] != REQUEST_SENSE)
@@ -2288,8 +2302,8 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
 					}
 
 					NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
-					/* 
-					 * Restore phase bits to 0 so an interrupted selection, 
+					/*
+					 * Restore phase bits to 0 so an interrupted selection,
 					 * arbitration can resume.
 					 */
 					NCR5380_write(TARGET_COMMAND_REG, 0);
@@ -2320,8 +2334,8 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
 						hostdata->connected = NULL;
 						hostdata->disconnected_queue = cmd;
 						dprintk(NDEBUG_QUEUES, "scsi%d : command for target %d lun %llu was moved from connected to" "  the disconnected_queue\n", instance->host_no, cmd->device->id, cmd->device->lun);
-						/* 
-						 * Restore phase bits to 0 so an interrupted selection, 
+						/*
+						 * Restore phase bits to 0 so an interrupted selection,
 						 * arbitration can resume.
 						 */
 						NCR5380_write(TARGET_COMMAND_REG, 0);
@@ -2334,14 +2348,14 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
 							barrier();
 						return;
 					}
-					/* 
+					/*
 					 * The SCSI data pointer is *IMPLICITLY* saved on a disconnect
-					 * operation, in violation of the SCSI spec so we can safely 
+					 * operation, in violation of the SCSI spec so we can safely
 					 * ignore SAVE/RESTORE pointers calls.
 					 *
-					 * Unfortunately, some disks violate the SCSI spec and 
+					 * Unfortunately, some disks violate the SCSI spec and
 					 * don't issue the required SAVE_POINTERS message before
-					 * disconnecting, and we have to break spec to remain 
+					 * disconnecting, and we have to break spec to remain
 					 * compatible.
 					 */
 				case SAVE_POINTERS:
@@ -2350,17 +2364,17 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
 					NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
 					break;
 				case EXTENDED_MESSAGE:
-/* 
+/*
  * Extended messages are sent in the following format :
- * Byte         
+ * Byte
  * 0            EXTENDED_MESSAGE == 1
- * 1            length (includes one byte for code, doesn't 
+ * 1            length (includes one byte for code, doesn't
  *              include first two bytes)
  * 2            code
  * 3..length+1  arguments
  *
  * Start the extended message buffer with the EXTENDED_MESSAGE
- * byte, since spi_print_msg() wants the whole thing.  
+ * byte, since spi_print_msg() wants the whole thing.
  */
 					extended_msg[0] = EXTENDED_MESSAGE;
 					/* Accept first byte by clearing ACK */
@@ -2400,8 +2414,8 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
 					}
 					/* Fall through to reject message */
 
-					/* 
-					 * If we get something weird that we aren't expecting, 
+					/*
+					 * If we get something weird that we aren't expecting,
 					 * reject it.
 					 */
 				default:
@@ -2440,10 +2454,10 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
 			case PHASE_CMDOUT:
 				len = cmd->cmd_len;
 				data = cmd->cmnd;
-				/* 
-				 * XXX for performance reasons, on machines with a 
-				 * PSEUDO-DMA architecture we should probably 
-				 * use the dma transfer function.  
+				/*
+				 * XXX for performance reasons, on machines with a
+				 * PSEUDO-DMA architecture we should probably
+				 * use the dma transfer function.
 				 */
 				NCR5380_transfer_pio(instance, &phase, &len, &data);
 				if (!cmd->device->disconnect && should_disconnect(cmd->cmnd[0])) {
@@ -2478,10 +2492,10 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
 /*
  * Function : void NCR5380_reselect (struct Scsi_Host *instance)
  *
- * Purpose : does reselection, initializing the instance->connected 
- *      field to point to the Scsi_Cmnd for which the I_T_L or I_T_L_Q 
+ * Purpose : does reselection, initializing the instance->connected
+ *      field to point to the Scsi_Cmnd for which the I_T_L or I_T_L_Q
  *      nexus has been reestablished,
- *      
+ *
  * Inputs : instance - this instance of the NCR5380.
  *
  * Locks: io_request_lock held by caller if IRQ driven
@@ -2511,7 +2525,7 @@ static void NCR5380_reselect(struct Scsi_Host *instance) {
 	target_mask = NCR5380_read(CURRENT_SCSI_DATA_REG) & ~(hostdata->id_mask);
 	dprintk(NDEBUG_SELECTION, "scsi%d : reselect\n", instance->host_no);
 
-	/* 
+	/*
 	 * At this point, we have detected that our SCSI ID is on the bus,
 	 * SEL is true and BSY was false for at least one bus settle delay
 	 * (400 ns).
@@ -2522,10 +2536,10 @@ static void NCR5380_reselect(struct Scsi_Host *instance) {
 
 	NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_BSY);
 
-	/* FIXME: timeout too long, must fail to workqueue */	
+	/* FIXME: timeout too long, must fail to workqueue */
 	if(NCR5380_poll_politely(instance, STATUS_REG, SR_SEL, 0, 2*HZ)<0)
 		abort = 1;
-		
+
 	NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
 
 	/*
@@ -2550,14 +2564,14 @@ static void NCR5380_reselect(struct Scsi_Host *instance) {
 		NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
 		lun = (msg[0] & 0x07);
 
-		/* 
+		/*
 		 * We need to add code for SCSI-II to track which devices have
 		 * I_T_L_Q nexuses established, and which have simple I_T_L
 		 * nexuses so we can chose to do additional data transfer.
 		 */
 
-		/* 
-		 * Find the command corresponding to the I_T_L or I_T_L_Q  nexus we 
+		/*
+		 * Find the command corresponding to the I_T_L or I_T_L_Q  nexus we
 		 * just reestablished, and remove it from the disconnected queue.
 		 */
 
@@ -2577,9 +2591,9 @@ static void NCR5380_reselect(struct Scsi_Host *instance) {
 			}
 		if (!tmp) {
 			printk(KERN_ERR "scsi%d : warning : target bitmask %02x lun %d not in disconnect_queue.\n", instance->host_no, target_mask, lun);
-			/* 
+			/*
 			 * Since we have an established nexus that we can't do anything with,
-			 * we must abort it.  
+			 * we must abort it.
 			 */
 			abort = 1;
 		}
@@ -2597,7 +2611,7 @@ static void NCR5380_reselect(struct Scsi_Host *instance) {
  * Function : void NCR5380_dma_complete (struct Scsi_Host *instance)
  *
  * Purpose : called by interrupt handler when DMA finishes or a phase
- *      mismatch occurs (which would finish the DMA transfer).  
+ *      mismatch occurs (which would finish the DMA transfer).
  *
  * Inputs : instance - this instance of the NCR5380.
  *
@@ -2617,7 +2631,7 @@ static void NCR5380_dma_complete(NCR5380_instance * instance) {
 	 *
 	 * Wait for final byte to transfer, ie wait for ACK to go false.
 	 *
-	 * We should use the Last Byte Sent bit, unfortunately this is 
+	 * We should use the Last Byte Sent bit, unfortunately this is
 	 * not available on the 5380/5381 (only the various CMOS chips)
 	 *
 	 * FIXME: timeout, and need to handle long timeout/irq case
@@ -2647,14 +2661,14 @@ static void NCR5380_dma_complete(NCR5380_instance * instance) {
  *
  * Purpose : abort a command
  *
- * Inputs : cmd - the Scsi_Cmnd to abort, code - code to set the 
- *      host byte of the result field to, if zero DID_ABORTED is 
+ * Inputs : cmd - the Scsi_Cmnd to abort, code - code to set the
+ *      host byte of the result field to, if zero DID_ABORTED is
  *      used.
  *
  * Returns : 0 - success, -1 on failure.
  *
- *	XXX - there is no way to abort the command that is currently 
- *	connected, you have to wait for it to complete.  If this is 
+ *	XXX - there is no way to abort the command that is currently
+ *	connected, you have to wait for it to complete.  If this is
  *	a problem, we could implement longjmp() / setjmp(), setjmp()
  *	called where the loop started in NCR5380_main().
  *
@@ -2666,7 +2680,7 @@ static int NCR5380_abort(Scsi_Cmnd * cmd) {
 	struct Scsi_Host *instance = cmd->device->host;
 	struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata;
 	Scsi_Cmnd *tmp, **prev;
-	
+
 	printk(KERN_WARNING "scsi%d : aborting command\n", instance->host_no);
 	scsi_print_command(cmd);
 
@@ -2679,8 +2693,8 @@ static int NCR5380_abort(Scsi_Cmnd * cmd) {
 
 #if 0
 /*
- * Case 1 : If the command is the currently executing command, 
- * we'll set the aborted flag and return control so that 
+ * Case 1 : If the command is the currently executing command,
+ * we'll set the aborted flag and return control so that
  * information transfer routine can exit cleanly.
  */
 
@@ -2693,13 +2707,13 @@ static int NCR5380_abort(Scsi_Cmnd * cmd) {
  */
 
 		NCR5380_write(INITIATOR_COMMAND_REG, ICR_ASSERT_ATN);
-/* 
- * Since we can't change phases until we've completed the current 
+/*
+ * Since we can't change phases until we've completed the current
  * handshake, we have to source or sink a byte of data if the current
  * phase is not MSGOUT.
  */
 
-/* 
+/*
  * Return control to the executing NCR drive so we can clear the
  * aborted flag and get back into our main loop.
  */
@@ -2708,11 +2722,11 @@ static int NCR5380_abort(Scsi_Cmnd * cmd) {
 	}
 #endif
 
-/* 
- * Case 2 : If the command hasn't been issued yet, we simply remove it 
+/*
+ * Case 2 : If the command hasn't been issued yet, we simply remove it
  *          from the issue queue.
  */
- 
+
 	dprintk(NDEBUG_ABORT, "scsi%d : abort going into loop.\n", instance->host_no);
 	for (prev = (Scsi_Cmnd **) & (hostdata->issue_queue), tmp = (Scsi_Cmnd *) hostdata->issue_queue; tmp; prev = (Scsi_Cmnd **) & (tmp->host_scribble), tmp = (Scsi_Cmnd *) tmp->host_scribble)
 		if (cmd == tmp) {
@@ -2730,9 +2744,9 @@ static int NCR5380_abort(Scsi_Cmnd * cmd) {
 			printk(KERN_ERR "scsi%d : LOOP\n", instance->host_no);
 #endif
 
-/* 
+/*
  * Case 3 : If any commands are connected, we're going to fail the abort
- *          and let the high level SCSI driver retry at a later time or 
+ *          and let the high level SCSI driver retry at a later time or
  *          issue a reset.
  *
  *          Timeouts, and therefore aborted commands, will be highly unlikely
@@ -2746,22 +2760,22 @@ static int NCR5380_abort(Scsi_Cmnd * cmd) {
 		return FAILED;
 	}
 /*
- * Case 4: If the command is currently disconnected from the bus, and 
- *      there are no connected commands, we reconnect the I_T_L or 
- *      I_T_L_Q nexus associated with it, go into message out, and send 
+ * Case 4: If the command is currently disconnected from the bus, and
+ *      there are no connected commands, we reconnect the I_T_L or
+ *      I_T_L_Q nexus associated with it, go into message out, and send
  *      an abort message.
  *
  * This case is especially ugly. In order to reestablish the nexus, we
- * need to call NCR5380_select().  The easiest way to implement this 
+ * need to call NCR5380_select().  The easiest way to implement this
  * function was to abort if the bus was busy, and let the interrupt
  * handler triggered on the SEL for reselect take care of lost arbitrations
  * where necessary, meaning interrupts need to be enabled.
  *
- * When interrupts are enabled, the queues may change - so we 
+ * When interrupts are enabled, the queues may change - so we
  * can't remove it from the disconnected queue before selecting it
- * because that could cause a failure in hashing the nexus if that 
+ * because that could cause a failure in hashing the nexus if that
  * device reselected.
- * 
+ *
  * Since the queues may change, we can't use the pointers from when we
  * first locate it.
  *
@@ -2791,7 +2805,7 @@ static int NCR5380_abort(Scsi_Cmnd * cmd) {
 				}
 		}
 /*
- * Case 5 : If we reached this point, the command was not found in any of 
+ * Case 5 : If we reached this point, the command was not found in any of
  *          the queues.
  *
  * We probably reached this point because of an unlikely race condition
@@ -2805,9 +2819,9 @@ static int NCR5380_abort(Scsi_Cmnd * cmd) {
 }
 
 
-/* 
+/*
  * Function : int NCR5380_bus_reset (Scsi_Cmnd *cmd)
- * 
+ *
  * Purpose : reset the SCSI bus.
  *
  * Returns : SUCCESS
-- 
1.8.5.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/5] scsi: Remove references to linked commands
  2014-10-02 10:43 [RFC PATCH 0/5] Remove scmd->tag Hannes Reinecke
  2014-10-02 10:43 ` [PATCH 1/5] NCR5380: Whitespace cleanup Hannes Reinecke
@ 2014-10-02 10:43 ` Hannes Reinecke
  2014-10-02 10:43 ` [PATCH 3/5] vmw_pvscsi: fixup tagging Hannes Reinecke
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Hannes Reinecke @ 2014-10-02 10:43 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: James Bottomley, Sagi Grimberg, Webb Scales, linux-scsi, Hannes Reinecke

Some NCR5380-based drivers implement support for linked commands
via a 'next_link' pointer in struct scsi_cmnd. This pointer has
long since removed, rendering the code pointless.
So remove it.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/NCR5380.c       | 40 -------------------------------
 drivers/scsi/atari_NCR5380.c | 57 --------------------------------------------
 drivers/scsi/sun3_NCR5380.c  | 57 --------------------------------------------
 3 files changed, 154 deletions(-)

diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index c8aa935..a0c8c5d 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -104,7 +104,6 @@
 #endif
 
 #ifndef notyet
-#undef LINKED
 #undef REAL_DMA
 #endif
 
@@ -216,8 +215,6 @@
  *      these transfers, we might need this to give reasonable interrupt
  *      service time if the transfer size gets too large.
  *
- * LINKED - if defined, linked commands are supported.
- *
  * PSEUDO_DMA - if defined, PSEUDO DMA is used during the data transfer phases.
  *
  * REAL_DMA - if defined, REAL DMA is used during the data transfer phases.
@@ -2210,43 +2207,6 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
 				cmd->SCp.Message = tmp;
 
 				switch (tmp) {
-					/*
-					 * Linking lets us reduce the time required to get the
-					 * next command out to the device, hopefully this will
-					 * mean we don't waste another revolution due to the delays
-					 * required by ARBITRATION and another SELECTION.
-					 *
-					 * In the current implementation proposal, low level drivers
-					 * merely have to start the next command, pointed to by
-					 * next_link, done() is called as with unlinked commands.
-					 */
-#ifdef LINKED
-				case LINKED_CMD_COMPLETE:
-				case LINKED_FLG_CMD_COMPLETE:
-					/* Accept message by clearing ACK */
-					NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
-					dprintk(NDEBUG_LINKED, "scsi%d : target %d lun %llu linked command complete.\n", instance->host_no, cmd->device->id, cmd->device->lun);
-					/*
-					 * Sanity check : A linked command should only terminate with
-					 * one of these messages if there are more linked commands
-					 * available.
-					 */
-					if (!cmd->next_link) {
-					    printk("scsi%d : target %d lun %llu linked command complete, no next_link\n" instance->host_no, cmd->device->id, cmd->device->lun);
-						sink = 1;
-						do_abort(instance);
-						return;
-					}
-					initialize_SCp(cmd->next_link);
-					/* The next command is still part of this process */
-					cmd->next_link->tag = cmd->tag;
-					cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8);
-					dprintk(NDEBUG_LINKED, "scsi%d : target %d lun %llu linked request done, calling scsi_done().\n", instance->host_no, cmd->device->id, cmd->device->lun);
-					collect_stats(hostdata, cmd);
-					cmd->scsi_done(cmd);
-					cmd = hostdata->connected;
-					break;
-#endif				/* def LINKED */
 				case ABORT:
 				case COMMAND_COMPLETE:
 					/* Accept message by clearing ACK */
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
index 79e6f04..d11c271 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -97,10 +97,6 @@
 #define REMOVE(w,x,y,z)
 #endif
 
-#ifndef notyet
-#undef LINKED
-#endif
-
 /*
  * Design
  * Issues :
@@ -211,8 +207,6 @@
  * AUTOSENSE - if defined, REQUEST SENSE will be performed automatically
  *	for commands that return with a CHECK CONDITION status.
  *
- * LINKED - if defined, linked commands are supported.
- *
  * REAL_DMA - if defined, REAL DMA is used during the data transfer phases.
  *
  * SUPPORT_TAGS - if defined, SCSI-2 tagged queuing is used where possible
@@ -2101,57 +2095,6 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
 				cmd->SCp.Message = tmp;
 
 				switch (tmp) {
-				/*
-				 * Linking lets us reduce the time required to get the
-				 * next command out to the device, hopefully this will
-				 * mean we don't waste another revolution due to the delays
-				 * required by ARBITRATION and another SELECTION.
-				 *
-				 * In the current implementation proposal, low level drivers
-				 * merely have to start the next command, pointed to by
-				 * next_link, done() is called as with unlinked commands.
-				 */
-#ifdef LINKED
-				case LINKED_CMD_COMPLETE:
-				case LINKED_FLG_CMD_COMPLETE:
-					/* Accept message by clearing ACK */
-					NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
-
-					dprintk(NDEBUG_LINKED, "scsi%d: target %d lun %llu linked command "
-						   "complete.\n", HOSTNO, cmd->device->id, cmd->device->lun);
-
-					/* Enable reselect interrupts */
-					NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
-					/*
-					 * Sanity check : A linked command should only terminate
-					 * with one of these messages if there are more linked
-					 * commands available.
-					 */
-
-					if (!cmd->next_link) {
-						 printk(KERN_NOTICE "scsi%d: target %d lun %llu "
-							"linked command complete, no next_link\n",
-							HOSTNO, cmd->device->id, cmd->device->lun);
-						sink = 1;
-						do_abort(instance);
-						return;
-					}
-
-					initialize_SCp(cmd->next_link);
-					/* The next command is still part of this process; copy it
-					 * and don't free it! */
-					cmd->next_link->tag = cmd->tag;
-					cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8);
-					dprintk(NDEBUG_LINKED, "scsi%d: target %d lun %llu linked request "
-						   "done, calling scsi_done().\n",
-						   HOSTNO, cmd->device->id, cmd->device->lun);
-#ifdef NCR5380_STATS
-					collect_stats(hostdata, cmd);
-#endif
-					cmd->scsi_done(cmd);
-					cmd = hostdata->connected;
-					break;
-#endif /* def LINKED */
 				case ABORT:
 				case COMMAND_COMPLETE:
 					/* Accept message by clearing ACK */
diff --git a/drivers/scsi/sun3_NCR5380.c b/drivers/scsi/sun3_NCR5380.c
index 1a2367a..efdc555 100644
--- a/drivers/scsi/sun3_NCR5380.c
+++ b/drivers/scsi/sun3_NCR5380.c
@@ -84,10 +84,6 @@
 #define REMOVE(w,x,y,z)
 #endif
 
-#ifndef notyet
-#undef LINKED
-#endif
-
 /*
  * Design
  * Issues :
@@ -198,8 +194,6 @@
  * AUTOSENSE - if defined, REQUEST SENSE will be performed automatically
  *	for commands that return with a CHECK CONDITION status. 
  *
- * LINKED - if defined, linked commands are supported.
- *
  * REAL_DMA - if defined, REAL DMA is used during the data transfer phases.
  *
  * SUPPORT_TAGS - if defined, SCSI-2 tagged queuing is used where possible
@@ -2065,57 +2059,6 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
 		cmd->SCp.Message = tmp;
 		
 		switch (tmp) {
-		/*
-		 * Linking lets us reduce the time required to get the 
-		 * next command out to the device, hopefully this will
-		 * mean we don't waste another revolution due to the delays
-		 * required by ARBITRATION and another SELECTION.
-		 *
-		 * In the current implementation proposal, low level drivers
-		 * merely have to start the next command, pointed to by 
-		 * next_link, done() is called as with unlinked commands.
-		 */
-#ifdef LINKED
-		case LINKED_CMD_COMPLETE:
-		case LINKED_FLG_CMD_COMPLETE:
-		    /* Accept message by clearing ACK */
-		    NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
-		    
-		    dprintk(NDEBUG_LINKED, "scsi%d: target %d lun %llu linked command "
-			       "complete.\n", HOSTNO, cmd->device->id, cmd->device->lun);
-
-		    /* Enable reselect interrupts */
-		    NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
-		    /*
-		     * Sanity check : A linked command should only terminate
-		     * with one of these messages if there are more linked
-		     * commands available.
-		     */
-
-		    if (!cmd->next_link) {
-			 printk(KERN_NOTICE "scsi%d: target %d lun %llu "
-				"linked command complete, no next_link\n",
-				HOSTNO, cmd->device->id, cmd->device->lun);
-			    sink = 1;
-			    do_abort (instance);
-			    return;
-		    }
-
-		    initialize_SCp(cmd->next_link);
-		    /* The next command is still part of this process; copy it
-		     * and don't free it! */
-		    cmd->next_link->tag = cmd->tag;
-		    cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8); 
-		    dprintk(NDEBUG_LINKED, "scsi%d: target %d lun %llu linked request "
-			       "done, calling scsi_done().\n",
-			       HOSTNO, cmd->device->id, cmd->device->lun);
-#ifdef NCR5380_STATS
-		    collect_stats(hostdata, cmd);
-#endif
-		    cmd->scsi_done(cmd);
-		    cmd = hostdata->connected;
-		    break;
-#endif /* def LINKED */
 		case ABORT:
 		case COMMAND_COMPLETE: 
 		    /* Accept message by clearing ACK */
-- 
1.8.5.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/5] vmw_pvscsi: fixup tagging
  2014-10-02 10:43 [RFC PATCH 0/5] Remove scmd->tag Hannes Reinecke
  2014-10-02 10:43 ` [PATCH 1/5] NCR5380: Whitespace cleanup Hannes Reinecke
  2014-10-02 10:43 ` [PATCH 2/5] scsi: Remove references to linked commands Hannes Reinecke
@ 2014-10-02 10:43 ` Hannes Reinecke
  2014-10-02 10:43 ` [PATCH 4/5] tcm_loop: Fixup tag handling Hannes Reinecke
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Hannes Reinecke @ 2014-10-02 10:43 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: James Bottomley, Sagi Grimberg, Webb Scales, linux-scsi, Hannes Reinecke

The request (and SCSI command) tag is the tag number assigned
by the generic block-tagging code, not the SCSI-II tag messages.
Those are represented by the device flags 'tagged_supported',
'simple_tags', and 'ordered_tags'.
(The SCSI midlayer doesn't use HEAD_OF_QUEUE tags).
So fixup vmw_pvscsi to assign the correct tag type.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/vmw_pvscsi.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c
index 598f65e..d18df8c 100644
--- a/drivers/scsi/vmw_pvscsi.c
+++ b/drivers/scsi/vmw_pvscsi.c
@@ -724,9 +724,8 @@ static int pvscsi_queue_ring(struct pvscsi_adapter *adapter,
 
 	e->tag = SIMPLE_QUEUE_TAG;
 	if (sdev->tagged_supported &&
-	    (cmd->tag == HEAD_OF_QUEUE_TAG ||
-	     cmd->tag == ORDERED_QUEUE_TAG))
-		e->tag = cmd->tag;
+	    sdev->ordered_tags)
+		e->tag = ORDERED_QUEUE_TAG;
 
 	if (cmd->sc_data_direction == DMA_FROM_DEVICE)
 		e->flags = PVSCSI_FLAG_CMD_DIR_TOHOST;
-- 
1.8.5.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/5] tcm_loop: Fixup tag handling
  2014-10-02 10:43 [RFC PATCH 0/5] Remove scmd->tag Hannes Reinecke
                   ` (2 preceding siblings ...)
  2014-10-02 10:43 ` [PATCH 3/5] vmw_pvscsi: fixup tagging Hannes Reinecke
@ 2014-10-02 10:43 ` Hannes Reinecke
  2014-10-02 10:43 ` [PATCH 5/5] scsi: Remove scmd->tag Hannes Reinecke
  2014-10-02 11:20 ` [RFC PATCH 0/5] " Christoph Hellwig
  5 siblings, 0 replies; 12+ messages in thread
From: Hannes Reinecke @ 2014-10-02 10:43 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: James Bottomley, Sagi Grimberg, Webb Scales, linux-scsi, Hannes Reinecke

The SCSI command tag is set to the tag assigned from the block
layer, not the SCSI-II tag message. So we need to convert
it into the correct SCSI-II tag message based on the
device flags, not the tag value itself.

Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/target/loopback/tcm_loop.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
index 340de9d..c2a9370 100644
--- a/drivers/target/loopback/tcm_loop.c
+++ b/drivers/target/loopback/tcm_loop.c
@@ -153,18 +153,11 @@ static int tcm_loop_change_queue_type(struct scsi_device *sdev, int tag)
 /*
  * Locate the SAM Task Attr from struct scsi_cmnd *
  */
-static int tcm_loop_sam_attr(struct scsi_cmnd *sc)
-{
-	if (sc->device->tagged_supported) {
-		switch (sc->tag) {
-		case HEAD_OF_QUEUE_TAG:
-			return MSG_HEAD_TAG;
-		case ORDERED_QUEUE_TAG:
-			return MSG_ORDERED_TAG;
-		default:
-			break;
-		}
-	}
+static int tcm_loop_sam_attr(struct scsi_cmnd *sc, int tag)
+{
+	if (sc->device->tagged_supported &&
+	    sc->device->ordered_tags && tag >= 0)
+		return MSG_ORDERED_TAG;
 
 	return MSG_SIMPLE_TAG;
 }
@@ -227,7 +220,7 @@ static void tcm_loop_submission_work(struct work_struct *work)
 
 	rc = target_submit_cmd_map_sgls(se_cmd, tl_nexus->se_sess, sc->cmnd,
 			&tl_cmd->tl_sense_buf[0], tl_cmd->sc->device->lun,
-			transfer_length, tcm_loop_sam_attr(sc),
+			transfer_length, tcm_loop_sam_attr(sc, tl_cmd->sc_cmd_tag),
 			sc->sc_data_direction, 0,
 			scsi_sglist(sc), scsi_sg_count(sc),
 			sgl_bidi, sgl_bidi_count,
@@ -266,7 +259,7 @@ static int tcm_loop_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *sc)
 	}
 
 	tl_cmd->sc = sc;
-	tl_cmd->sc_cmd_tag = sc->tag;
+	tl_cmd->sc_cmd_tag = sc->request->tag;
 	INIT_WORK(&tl_cmd->work, tcm_loop_submission_work);
 	queue_work(tcm_loop_workqueue, &tl_cmd->work);
 	return 0;
@@ -370,7 +363,7 @@ static int tcm_loop_abort_task(struct scsi_cmnd *sc)
 	 */
 	tl_tpg = &tl_hba->tl_hba_tpgs[sc->device->id];
 	ret = tcm_loop_issue_tmr(tl_tpg, tl_nexus, sc->device->lun,
-				 sc->tag, TMR_ABORT_TASK);
+				 sc->request->tag, TMR_ABORT_TASK);
 	return (ret == TMR_FUNCTION_COMPLETE) ? SUCCESS : FAILED;
 }
 
-- 
1.8.5.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 5/5] scsi: Remove scmd->tag
  2014-10-02 10:43 [RFC PATCH 0/5] Remove scmd->tag Hannes Reinecke
                   ` (3 preceding siblings ...)
  2014-10-02 10:43 ` [PATCH 4/5] tcm_loop: Fixup tag handling Hannes Reinecke
@ 2014-10-02 10:43 ` Hannes Reinecke
  2014-10-02 11:22   ` Christoph Hellwig
  2014-10-02 11:48   ` Finn Thain
  2014-10-02 11:20 ` [RFC PATCH 0/5] " Christoph Hellwig
  5 siblings, 2 replies; 12+ messages in thread
From: Hannes Reinecke @ 2014-10-02 10:43 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: James Bottomley, Sagi Grimberg, Webb Scales, linux-scsi, Hannes Reinecke

struct scsi_cmnd has a 'tag' field, which was supposed to be
used to support SCSI-II tagged command queueing.
In the end tagged command queueing support moved into the
block layer, with the tag number available in the request.
So the 'tag' field lost its original meaning and can be
removed.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/NCR5380.c        | 5 ++---
 drivers/scsi/fnic/fnic_scsi.c | 1 -
 drivers/scsi/scsi_lib.c       | 4 ----
 include/scsi/scsi_cmnd.h      | 2 --
 4 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index a0c8c5d..cb68089 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -1527,7 +1527,6 @@ part2:
 	tmp[0] = IDENTIFY(((instance->irq == SCSI_IRQ_NONE) ? 0 : 1), cmd->device->lun);
 
 	len = 1;
-	cmd->tag = 0;
 
 	/* Send message(s) */
 	data = tmp;
@@ -2563,7 +2562,7 @@ static void NCR5380_reselect(struct Scsi_Host *instance) {
 		do_abort(instance);
 	} else {
 		hostdata->connected = tmp;
-		dprintk(NDEBUG_RESELECTION, "scsi%d : nexus established, target = %d, lun = %llu, tag = %d\n", instance->host_no, tmp->device->id, tmp->device->lun, tmp->tag);
+		dprintk(NDEBUG_RESELECTION, "scsi%d : nexus established, target = %d, lun = %llu, tag = %d\n", instance->host_no, tmp->device->id, tmp->device->lun, tmp->request->tag);
 	}
 }
 
@@ -2748,7 +2747,7 @@ static int NCR5380_abort(Scsi_Cmnd * cmd) {
 		if (cmd == tmp) {
 			dprintk(NDEBUG_ABORT, "scsi%d : aborting disconnected command.\n", instance->host_no);
 
-			if (NCR5380_select(instance, cmd, (int) cmd->tag))
+			if (NCR5380_select(instance, cmd, cmd->request->tag))
 				return FAILED;
 			dprintk(NDEBUG_ABORT, "scsi%d : nexus reestablished.\n", instance->host_no);
 
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index 961bdf5..e54ace9 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -2137,7 +2137,6 @@ fnic_scsi_host_start_tag(struct fnic *fnic, struct scsi_cmnd *sc)
 
 	bqt->tag_index[tag] = sc->request;
 	sc->request->tag = tag;
-	sc->tag = tag;
 	if (!sc->request->special)
 		sc->request->special = sc;
 
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index b9a8ddd..a7d4d93 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1191,8 +1191,6 @@ static struct scsi_cmnd *scsi_get_cmd_from_req(struct scsi_device *sdev,
 		cmd = req->special;
 	}
 
-	/* pull a tag out of the request if we have one */
-	cmd->tag = req->tag;
 	cmd->request = req;
 
 	cmd->cmnd = req->cmd;
@@ -1808,8 +1806,6 @@ static int scsi_mq_prep_fn(struct request *req)
 	cmd->device = sdev;
 	cmd->sense_buffer = sense_buf;
 
-	cmd->tag = req->tag;
-
 	cmd->cmnd = req->cmd;
 	cmd->prot_op = SCSI_PROT_NORMAL;
 
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 73f3490..45c9eb0 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -130,8 +130,6 @@ struct scsi_cmnd {
 					 * to be at an address < 16Mb). */
 
 	int result;		/* Status code from lower level driver */
-
-	unsigned char tag;	/* SCSI-II queued command tag */
 };
 
 /*
-- 
1.8.5.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/5] NCR5380: Whitespace cleanup
  2014-10-02 10:43 ` [PATCH 1/5] NCR5380: Whitespace cleanup Hannes Reinecke
@ 2014-10-02 11:07   ` Finn Thain
  2014-10-02 11:12     ` Hannes Reinecke
  0 siblings, 1 reply; 12+ messages in thread
From: Finn Thain @ 2014-10-02 11:07 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Christoph Hellwig, James Bottomley, Sagi Grimberg, Webb Scales,
	linux-scsi


On Thu, 2 Oct 2014, Hannes Reinecke wrote:

> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>  drivers/scsi/NCR5380.c | 652 +++++++++++++++++++++++++------------------------
>  1 file changed, 333 insertions(+), 319 deletions(-)
> 

This is going to break about 30 or 40 patches that I'm working on. Can we 
not do this yet? The white space clean up is a smaller patch if it happens 
after all the other bug fixing and modernization work.

-- 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/5] NCR5380: Whitespace cleanup
  2014-10-02 11:07   ` Finn Thain
@ 2014-10-02 11:12     ` Hannes Reinecke
  0 siblings, 0 replies; 12+ messages in thread
From: Hannes Reinecke @ 2014-10-02 11:12 UTC (permalink / raw)
  To: Finn Thain
  Cc: Christoph Hellwig, James Bottomley, Sagi Grimberg, Webb Scales,
	linux-scsi

On 10/02/2014 01:07 PM, Finn Thain wrote:
> 
> On Thu, 2 Oct 2014, Hannes Reinecke wrote:
> 
>> Signed-off-by: Hannes Reinecke <hare@suse.de>
>> ---
>>  drivers/scsi/NCR5380.c | 652 +++++++++++++++++++++++++------------------------
>>  1 file changed, 333 insertions(+), 319 deletions(-)
>>
> 
> This is going to break about 30 or 40 patches that I'm working on. Can we 
> not do this yet? The white space clean up is a smaller patch if it happens 
> after all the other bug fixing and modernization work.
> 
Oh, you're most welcome.
I've just included it as my eyes nearly fell out when turning on
syntax highlighting.
The patch is an RFC anyway, so I doubt it'll be included in 3.18.

And indeed the NCR5380 is in dire need of modernization; having
three to four identical copies with just minor modifications
between each simply cries out for consolidation.

Thanks for doing that.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [RFC PATCH 0/5] Remove scmd->tag
  2014-10-02 10:43 [RFC PATCH 0/5] Remove scmd->tag Hannes Reinecke
                   ` (4 preceding siblings ...)
  2014-10-02 10:43 ` [PATCH 5/5] scsi: Remove scmd->tag Hannes Reinecke
@ 2014-10-02 11:20 ` Christoph Hellwig
  5 siblings, 0 replies; 12+ messages in thread
From: Christoph Hellwig @ 2014-10-02 11:20 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Christoph Hellwig, James Bottomley, Sagi Grimberg, Webb Scales,
	linux-scsi

This seems to miss a places, that mostly just seem to use scmd->tag
where they should be using scmd->request->tag:

 - acornscsi.c (and arm/queue.c)
 - fas216
 - qla1280

As well as virtio_scsi, which does a pointless assignment to scmd->tag.

It might be worth to push this out to somewhere where the buildbot
can find it while waiting for the NCR5380 overhaul.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 5/5] scsi: Remove scmd->tag
  2014-10-02 10:43 ` [PATCH 5/5] scsi: Remove scmd->tag Hannes Reinecke
@ 2014-10-02 11:22   ` Christoph Hellwig
  2014-10-02 11:36     ` Hannes Reinecke
  2014-10-02 11:48   ` Finn Thain
  1 sibling, 1 reply; 12+ messages in thread
From: Christoph Hellwig @ 2014-10-02 11:22 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Finn Thain, James Bottomley, Sagi Grimberg, Webb Scales, linux-scsi

> diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
> index a0c8c5d..cb68089 100644
> --- a/drivers/scsi/NCR5380.c
> +++ b/drivers/scsi/NCR5380.c
> @@ -1527,7 +1527,6 @@ part2:
>  	tmp[0] = IDENTIFY(((instance->irq == SCSI_IRQ_NONE) ? 0 : 1), cmd->device->lun);
>  
>  	len = 1;
> -	cmd->tag = 0;

The driver was explicitly setting the tag to zero here, so this needs
a good explanation instead of a blind removal.

But given how nice the code that Finn delivered in the past is I have high
hopes that his NCR5380 overhaul will get rid of a lot of this cruft :)


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 5/5] scsi: Remove scmd->tag
  2014-10-02 11:22   ` Christoph Hellwig
@ 2014-10-02 11:36     ` Hannes Reinecke
  0 siblings, 0 replies; 12+ messages in thread
From: Hannes Reinecke @ 2014-10-02 11:36 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Finn Thain, James Bottomley, Sagi Grimberg, Webb Scales, linux-scsi

On 10/02/2014 01:22 PM, Christoph Hellwig wrote:
>> diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
>> index a0c8c5d..cb68089 100644
>> --- a/drivers/scsi/NCR5380.c
>> +++ b/drivers/scsi/NCR5380.c
>> @@ -1527,7 +1527,6 @@ part2:
>>  	tmp[0] = IDENTIFY(((instance->irq == SCSI_IRQ_NONE) ? 0 : 1), cmd->device->lun);
>>  
>>  	len = 1;
>> -	cmd->tag = 0;
> 
> The driver was explicitly setting the tag to zero here, so this needs
> a good explanation instead of a blind removal.
> 
> But given how nice the code that Finn delivered in the past is I have high
> hopes that his NCR5380 overhaul will get rid of a lot of this cruft :)
> 
Yep. (Removing the above line shouldn't actually doing any harm, as
the tagged queueing support in NCR5380 is currently disabled anyway).
(Famous last words).

But this was just a test for the feasibility of scmd->tag removal.
Once Finn's patchset is posted we definitely should be revisiting
it.

And arguably the tcm_loop and vmw_pvscsi patches are real bugfixes,
so maybe they should be applied anyway.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 5/5] scsi: Remove scmd->tag
  2014-10-02 10:43 ` [PATCH 5/5] scsi: Remove scmd->tag Hannes Reinecke
  2014-10-02 11:22   ` Christoph Hellwig
@ 2014-10-02 11:48   ` Finn Thain
  1 sibling, 0 replies; 12+ messages in thread
From: Finn Thain @ 2014-10-02 11:48 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Christoph Hellwig, James Bottomley, Sagi Grimberg, Webb Scales,
	linux-scsi, Michael Schmitz


On Thu, 2 Oct 2014, Hannes Reinecke wrote:

> struct scsi_cmnd has a 'tag' field, which was supposed to be
> used to support SCSI-II tagged command queueing.
> In the end tagged command queueing support moved into the
> block layer, with the tag number available in the request.
> So the 'tag' field lost its original meaning and can be
> removed.

I'm pretty sure this patch will break atari_scsi. sun3_scsi does not 
define SUPPORT_TAGS, so it should be mostly unaffected.

We may need to comment out the #define SUPPORT_TAGS in atari_scsi until 
Michael and I figure out how to make the driver work with block layer 
tags.

> diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
> index a0c8c5d..cb68089 100644
> --- a/drivers/scsi/NCR5380.c
> +++ b/drivers/scsi/NCR5380.c

...

> @@ -2748,7 +2747,7 @@ static int NCR5380_abort(Scsi_Cmnd * cmd) {
>  		if (cmd == tmp) {
>  			dprintk(NDEBUG_ABORT, "scsi%d : aborting disconnected command.\n", instance->host_no);
>  
> -			if (NCR5380_select(instance, cmd, (int) cmd->tag))
> +			if (NCR5380_select(instance, cmd, cmd->request->tag))

NCR5380_select() does not use its tag parameter. I have a patch that 
removes it. I'll send the first set of patches I've been working on.

-- 

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-10-02 11:49 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-02 10:43 [RFC PATCH 0/5] Remove scmd->tag Hannes Reinecke
2014-10-02 10:43 ` [PATCH 1/5] NCR5380: Whitespace cleanup Hannes Reinecke
2014-10-02 11:07   ` Finn Thain
2014-10-02 11:12     ` Hannes Reinecke
2014-10-02 10:43 ` [PATCH 2/5] scsi: Remove references to linked commands Hannes Reinecke
2014-10-02 10:43 ` [PATCH 3/5] vmw_pvscsi: fixup tagging Hannes Reinecke
2014-10-02 10:43 ` [PATCH 4/5] tcm_loop: Fixup tag handling Hannes Reinecke
2014-10-02 10:43 ` [PATCH 5/5] scsi: Remove scmd->tag Hannes Reinecke
2014-10-02 11:22   ` Christoph Hellwig
2014-10-02 11:36     ` Hannes Reinecke
2014-10-02 11:48   ` Finn Thain
2014-10-02 11:20 ` [RFC PATCH 0/5] " Christoph Hellwig

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.