Skip to contentSkip to conversation

scsi/NCR5380: fix debugging macros and #include structure

PATCH In review Finn Thain 4 participants 22 messages Mar 19, 2014 – Apr 30, 2014 SCSI

lore
Share & tools
lore

Finn Thain

author
#0 lore raw

v2 cover scsi/NCR5380: fix debugging macros and #include structure

This patch series addresses several issues with NCR5380 drivers:

1. The complex network of #include directives.

2. Three inconsistent implementations of the core driver all attempting to share the same macro definitions in NCR5380.h.

3. Broken debugging code.

In the past these issues have led to compiler warnings and ugly hacks to fix build failures.

This patch series fixes the debugging code by reducing the divergence between the various core driver implementations.

The final two patches in the series further reduce divergence by refactoring sun3_scsi.c and sun3_scsi_vme.c so that they follow the same structure as the other NCR5380 drivers.

By the end of this patch series over 800 net lines of code have been removed. This is mostly duplicated code that's easily eliminated once the debugging code is made consistent (and some dead code is removed).

Better uniformity and less duplication should assist future work such as modernization and trivial clean-up.

To make code review easier I've tried to keep these patches succinct and free of extraneous changes. Though I did run checkpatch.pl, I've ignored whitespace issues in existing code. I will send separate patches for whitespace clean-up of NCR5380 drivers.

All NCR5380 drivers have been compile-tested with this patch series:
arm/cumana_1.c
arm/oak.c
atari_scsi.c
dmx3191d.c
dtc.c
g_NCR5380.c
g_NCR5380_mmio.c
mac_scsi.c
pas16.c
sun3_scsi.c
sun3_scsi_vme.c
t128.c

I've successfully regression tested this patch series using mac_scsi on a PowerBook 180. The debugging macros are now usable again.

Acked-by on v2 7/12
#8 lore raw

Re: [PATCH v2 07/12] scsi/NCR5380: adopt NCR5380_dprint() and NCR5380_dprint_phase()

Quoted 200 lines

All NCR5380 drivers already include the NCR5380.h header. Better to adopt those macros rather than have three variations on them.

Moreover, the macros in NCR5380.h are preferable anyway: the atari_NCR5380 and sun3_NCR5380 versions are inflexible. For example, they can't accomodate NCR5380_dprint(NDEBUG_MAIN | NDEBUG_QUEUES, ...)

Replace the NCR_PRINT* macros from atari_NCR5380.h and sun3_NCR5380.h with the equivalent macros from NCR5380.h.

---
  drivers/scsi/atari_NCR5380.c |   22 +++++++++++-----------
  drivers/scsi/sun3_NCR5380.c  |   22 +++++++++++-----------
  2 files changed, 22 insertions(+), 22 deletions(-)

Index: linux-m68k/drivers/scsi/atari_NCR5380.c
===================================================================

drivers/scsi/atari_NCR5380.c +11 -11
@@ -739,8 +739,8 @@ static void NCR5380_print_status(struct
  	Scsi_Cmnd *ptr;
  	unsigned long flags;
 
-	NCR_PRINT(NDEBUG_ANY);
-	NCR_PRINT_PHASE(NDEBUG_ANY);
+	NCR5380_dprint(NDEBUG_ANY, instance);
+	NCR5380_dprint_phase(NDEBUG_ANY, instance);
 
  	hostdata = (struct NCR5380_hostdata *)instance->hostdata;
 
@@ -1268,7 +1268,7 @@ static irqreturn_t NCR5380_intr(int irq,
  	INT_PRINTK("scsi%d: BASR=%02x\n", HOSTNO, basr);
  	/* dispatch to appropriate routine if found and done=0 */
  	if (basr & BASR_IRQ) {
-		NCR_PRINT(NDEBUG_INTR);
+		NCR5380_dprint(NDEBUG_INTR, instance);
  		if ((NCR5380_read(STATUS_REG) & (SR_SEL|SR_IO)) == (SR_SEL|SR_IO)) {
  			done = 0;
  			ENABLE_IRQ();
@@ -1396,7 +1396,7 @@ static int NCR5380_select(struct Scsi_Ho
  	unsigned long flags;
 
  	hostdata->restart_select = 0;
-	NCR_PRINT(NDEBUG_ARBITRATION);
+	NCR5380_dprint(NDEBUG_ARBITRATION, instance);
  	ARB_PRINTK("scsi%d: starting arbitration, id = %d\n", HOSTNO,
  		   instance->this_id);
 
@@ -1617,7 +1617,7 @@ static int NCR5380_select(struct Scsi_Ho
  			printk(KERN_ERR "scsi%d: weirdness\n", HOSTNO);
  			if (hostdata->restart_select)
  				printk(KERN_NOTICE "\trestart select\n");
-			NCR_PRINT(NDEBUG_ANY);
+			NCR5380_dprint(NDEBUG_ANY, instance);
  			NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
  			return -1;
  		}
@@ -1742,7 +1742,7 @@ static int NCR5380_transfer_pio(struct S
  		/* Check for phase mismatch */
  		if ((tmp & PHASE_MASK) != p) {
  			PIO_PRINTK("scsi%d: phase mismatch\n", HOSTNO);
-			NCR_PRINT_PHASE(NDEBUG_PIO);
+			NCR5380_dprint_phase(NDEBUG_PIO, instance);
  			break;
  		}
 
@@ -1764,18 +1764,18 @@ static int NCR5380_transfer_pio(struct S
  		if (!(p & SR_IO)) {
  			if (!((p & SR_MSG) && c > 1)) {
  				NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_DATA);
-				NCR_PRINT(NDEBUG_PIO);
+				NCR5380_dprint(NDEBUG_PIO, instance);
  				NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
  					      ICR_ASSERT_DATA | ICR_ASSERT_ACK);
  			} else {
  				NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
  					      ICR_ASSERT_DATA | ICR_ASSERT_ATN);
-				NCR_PRINT(NDEBUG_PIO);
+				NCR5380_dprint(NDEBUG_PIO, instance);
  				NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
  					      ICR_ASSERT_DATA | ICR_ASSERT_ATN | ICR_ASSERT_ACK);
  			}
  		} else {
-			NCR_PRINT(NDEBUG_PIO);
+			NCR5380_dprint(NDEBUG_PIO, instance);
  			NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ACK);
  		}
 
@@ -1997,7 +1997,7 @@ static void NCR5380_information_transfer
  			phase = (tmp & PHASE_MASK);
  			if (phase != old_phase) {
  				old_phase = phase;
-				NCR_PRINT_PHASE(NDEBUG_INFORMATION);
+				NCR5380_dprint_phase(NDEBUG_INFORMATION, instance);
  			}
 
  			if (sink && (phase != PHASE_MSGOUT)) {
@@ -2451,7 +2451,7 @@ static void NCR5380_information_transfer
  				break;
  			default:
  				printk("scsi%d: unknown phase\n", HOSTNO);
-				NCR_PRINT(NDEBUG_ANY);
+				NCR5380_dprint(NDEBUG_ANY, instance);
  			} /* switch(phase) */
  		} /* if (tmp * SR_REQ) */
  	} /* while (1) */

Index: linux-m68k/drivers/scsi/sun3_NCR5380.c
===================================================================

drivers/scsi/sun3_NCR5380.c +11 -11
@@ -681,8 +681,8 @@ static void NCR5380_print_status(struct
  	Scsi_Cmnd *ptr;
  	unsigned long flags;
 
-	NCR_PRINT(NDEBUG_ANY);
-	NCR_PRINT_PHASE(NDEBUG_ANY);
+	NCR5380_dprint(NDEBUG_ANY, instance);
+	NCR5380_dprint_phase(NDEBUG_ANY, instance);
 
  	hostdata = (struct NCR5380_hostdata *)instance->hostdata;
 
@@ -1192,7 +1192,7 @@ static irqreturn_t NCR5380_intr (int irq
      INT_PRINTK("scsi%d: BASR=%02x\n", HOSTNO, basr);
      /* dispatch to appropriate routine if found and done=0 */
      if (basr & BASR_IRQ) {
-	NCR_PRINT(NDEBUG_INTR);
+	NCR5380_dprint(NDEBUG_INTR, instance);
  	if ((NCR5380_read(STATUS_REG) & (SR_SEL|SR_IO)) == (SR_SEL|SR_IO)) {
  	    done = 0;
  //	    ENABLE_IRQ();
@@ -1334,7 +1334,7 @@ static int NCR5380_select(struct Scsi_Ho
      unsigned long flags;
 
      hostdata->restart_select = 0;
-    NCR_PRINT(NDEBUG_ARBITRATION);
+    NCR5380_dprint(NDEBUG_ARBITRATION, instance);
      ARB_PRINTK("scsi%d: starting arbitration, id = %d\n", HOSTNO,
  	       instance->this_id);
 
@@ -1555,7 +1555,7 @@ static int NCR5380_select(struct Scsi_Ho
  	    printk(KERN_ERR "scsi%d: weirdness\n", HOSTNO);
  	    if (hostdata->restart_select)
  		printk(KERN_NOTICE "\trestart select\n");
-	    NCR_PRINT(NDEBUG_ANY);
+	    NCR5380_dprint(NDEBUG_ANY, instance);
  	    NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
  	    return -1;
  	}
@@ -1681,7 +1681,7 @@ static int NCR5380_transfer_pio( struct
  	/* Check for phase mismatch */	
  	if ((tmp & PHASE_MASK) != p) {
  	    PIO_PRINTK("scsi%d: phase mismatch\n", HOSTNO);
-	    NCR_PRINT_PHASE(NDEBUG_PIO);
+	    NCR5380_dprint_phase(NDEBUG_PIO, instance);
  	    break;
  	}
 
@@ -1704,18 +1704,18 @@ static int NCR5380_transfer_pio( struct
  	    if (!((p & SR_MSG) && c > 1)) {
  		NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
  		    ICR_ASSERT_DATA);
-		NCR_PRINT(NDEBUG_PIO);
+		NCR5380_dprint(NDEBUG_PIO, instance);
  		NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
  			ICR_ASSERT_DATA | ICR_ASSERT_ACK);
  	    } else {
  		NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
  		    ICR_ASSERT_DATA | ICR_ASSERT_ATN);
-		NCR_PRINT(NDEBUG_PIO);
+		NCR5380_dprint(NDEBUG_PIO, instance);
  		NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
  		    ICR_ASSERT_DATA | ICR_ASSERT_ATN | ICR_ASSERT_ACK);
  	    }
  	} else {
-	    NCR_PRINT(NDEBUG_PIO);
+	    NCR5380_dprint(NDEBUG_PIO, instance);
  	    NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ACK);
  	}
 
@@ -1927,7 +1927,7 @@ static void NCR5380_information_transfer
  	    phase = (tmp & PHASE_MASK);
   	    if (phase != old_phase) {
  		old_phase = phase;
-		NCR_PRINT_PHASE(NDEBUG_INFORMATION);
+		NCR5380_dprint_phase(NDEBUG_INFORMATION, instance);
  	    }
 
  	    if(phase == PHASE_CMDOUT) {
@@ -2412,7 +2412,7 @@ static void NCR5380_information_transfer
  		break;
  	    default:
  		printk("scsi%d: unknown phase\n", HOSTNO);
-		NCR_PRINT(NDEBUG_ANY);
+		NCR5380_dprint(NDEBUG_ANY, instance);
  	    } /* switch(phase) */
  	} /* if (tmp * SR_REQ) */
      } /* while (1) */
Acked-by on v2 8/12
#10 lore raw

Re: [PATCH v2 08/12] scsi/NCR5380: adopt dprintk()

Quoted 1,147 lines

All NCR5380 drivers already include the NCR5380.h header. Better to adopt those macros rather than have three variations on them.

Moreover, the macros in NCR5380.h are preferable because the atari_NCR5380 and sun3_NCR5380 versions are inflexible. For example, they can't accomodate dprintk(NDEBUG_MAIN | NDEBUG_QUEUES, ...)

Replace the *_PRINTK macros from atari_NCR5380.h and sun3_NCR5380.h with the equivalent macros from NCR5380.h.

---
  drivers/scsi/atari_NCR5380.c |  130 +++++++++++++++++++++----------------------
  drivers/scsi/atari_scsi.c    |   16 ++---
  drivers/scsi/sun3_NCR5380.c  |  122 ++++++++++++++++++++--------------------
  3 files changed, 134 insertions(+), 134 deletions(-)

Index: linux-m68k/drivers/scsi/atari_NCR5380.c
===================================================================

drivers/scsi/atari_NCR5380.c +65 -65
@@ -370,7 +370,7 @@ static int is_lun_busy(Scsi_Cmnd *cmd, i
  		return 0;
  	if (TagAlloc[cmd->device->id][cmd->device->lun].nr_allocated >=
  	    TagAlloc[cmd->device->id][cmd->device->lun].queue_size) {
-		TAG_PRINTK("scsi%d: target %d lun %d: no free tags\n",
+		dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %d: no free tags\n",
  			   H_NO(cmd), cmd->device->id, cmd->device->lun);
  		return 1;
  	}
@@ -394,7 +394,7 @@ static void cmd_get_tag(Scsi_Cmnd *cmd,
  	    !setup_use_tagged_queuing || !cmd->device->tagged_supported) {
  		cmd->tag = TAG_NONE;
  		hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun);
-		TAG_PRINTK("scsi%d: target %d lun %d now allocated by untagged "
+		dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %d now allocated by untagged "
  			   "command\n", H_NO(cmd), cmd->device->id, cmd->device->lun);
  	} else {
  		TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun];
@@ -402,7 +402,7 @@ static void cmd_get_tag(Scsi_Cmnd *cmd,
  		cmd->tag = find_first_zero_bit(ta->allocated, MAX_TAGS);
  		set_bit(cmd->tag, ta->allocated);
  		ta->nr_allocated++;
-		TAG_PRINTK("scsi%d: using tag %d for target %d lun %d "
+		dprintk(NDEBUG_TAGS, "scsi%d: using tag %d for target %d lun %d "
  			   "(now %d tags in use)\n",
  			   H_NO(cmd), cmd->tag, cmd->device->id,
  			   cmd->device->lun, ta->nr_allocated);
@@ -420,7 +420,7 @@ static void cmd_free_tag(Scsi_Cmnd *cmd)
 
  	if (cmd->tag == TAG_NONE) {
  		hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
-		TAG_PRINTK("scsi%d: target %d lun %d untagged cmd finished\n",
+		dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %d untagged cmd finished\n",
  			   H_NO(cmd), cmd->device->id, cmd->device->lun);
  	} else if (cmd->tag >= MAX_TAGS) {
  		printk(KERN_NOTICE "scsi%d: trying to free bad tag %d!\n",
@@ -429,7 +429,7 @@ static void cmd_free_tag(Scsi_Cmnd *cmd)
  		TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun];
  		clear_bit(cmd->tag, ta->allocated);
  		ta->nr_allocated--;
-		TAG_PRINTK("scsi%d: freed tag %d for target %d lun %d\n",
+		dprintk(NDEBUG_TAGS, "scsi%d: freed tag %d for target %d lun %d\n",
  			   H_NO(cmd), cmd->tag, cmd->device->id, cmd->device->lun);
  	}
  }
@@ -478,7 +478,7 @@ static void merge_contiguous_buffers(Scs
  	for (endaddr = virt_to_phys(cmd->SCp.ptr + cmd->SCp.this_residual - 1) + 1;
  	     cmd->SCp.buffers_residual &&
  	     virt_to_phys(sg_virt(&cmd->SCp.buffer[1])) == endaddr;) {
-		MER_PRINTK("VTOP(%p) == %08lx -> merging\n",
+		dprintk(NDEBUG_MERGING, "VTOP(%p) == %08lx -> merging\n",
  			   page_address(sg_page(&cmd->SCp.buffer[1])), endaddr);
  #if (NDEBUG & NDEBUG_MERGING)
  		++cnt;
@@ -490,7 +490,7 @@ static void merge_contiguous_buffers(Scs
  	}
  #if (NDEBUG & NDEBUG_MERGING)
  	if (oldlen != cmd->SCp.this_residual)
-		MER_PRINTK("merged %d buffers from %p, new length %08x\n",
+		dprintk(NDEBUG_MERGING, "merged %d buffers from %p, new length %08x\n",
  			   cnt, cmd->SCp.ptr, cmd->SCp.this_residual);
  #endif
  }
@@ -676,7 +676,7 @@ static inline void NCR5380_all_init(void
  {
  	static int done = 0;
  	if (!done) {
-		INI_PRINTK("scsi : NCR5380_all_init()\n");
+		dprintk(NDEBUG_INIT, "scsi : NCR5380_all_init()\n");
  		done = 1;
  	}
  }
@@ -984,7 +984,7 @@ static int NCR5380_queue_command_lck(Scs
  	}
  	local_irq_restore(flags);
 
-	QU_PRINTK("scsi%d: command added to %s of queue\n", H_NO(cmd),
+	dprintk(NDEBUG_QUEUES, "scsi%d: command added to %s of queue\n", H_NO(cmd),
  		  (cmd->cmnd[0] == REQUEST_SENSE) ? "head" : "tail");
 
  	/* If queue_command() is called from an interrupt (real one or bottom
@@ -1054,7 +1054,7 @@ static void NCR5380_main(struct work_str
  		done = 1;
 
  		if (!hostdata->connected) {
-			MAIN_PRINTK("scsi%d: not connected\n", HOSTNO);
+			dprintk(NDEBUG_MAIN, "scsi%d: not connected\n", HOSTNO);
  			/*
  			 * Search through the issue_queue for a command destined
  			 * for a target that's not busy.
@@ -1107,7 +1107,7 @@ static void NCR5380_main(struct work_str
  					 * On failure, we must add the command back to the
  					 *   issue queue so we can keep trying.
  					 */
-					MAIN_PRINTK("scsi%d: main(): command for target %d "
+					dprintk(NDEBUG_MAIN, "scsi%d: main(): command for target %d "
  						    "lun %d removed from issue_queue\n",
  						    HOSTNO, tmp->device->id, tmp->device->lun);
  					/*
@@ -1140,7 +1140,7 @@ static void NCR5380_main(struct work_str
  #endif
  						falcon_dont_release--;
  						local_irq_restore(flags);
-						MAIN_PRINTK("scsi%d: main(): select() failed, "
+						dprintk(NDEBUG_MAIN, "scsi%d: main(): select() failed, "
  							    "returned to issue_queue\n", HOSTNO);
  						if (hostdata->connected)
  							break;
@@ -1155,10 +1155,10 @@ static void NCR5380_main(struct work_str
  #endif
  		    ) {
  			local_irq_restore(flags);
-			MAIN_PRINTK("scsi%d: main: performing information transfer\n",
+			dprintk(NDEBUG_MAIN, "scsi%d: main: performing information transfer\n",
  				    HOSTNO);
  			NCR5380_information_transfer(instance);
-			MAIN_PRINTK("scsi%d: main: done set false\n", HOSTNO);
+			dprintk(NDEBUG_MAIN, "scsi%d: main: done set false\n", HOSTNO);
  			done = 0;
  		}
  	} while (!done);
@@ -1204,12 +1204,12 @@ static void NCR5380_dma_complete(struct
  			    (BASR_PHASE_MATCH|BASR_ACK)) {
  				saved_data = NCR5380_read(INPUT_DATA_REG);
  				overrun = 1;
-				DMA_PRINTK("scsi%d: read overrun handled\n", HOSTNO);
+				dprintk(NDEBUG_DMA, "scsi%d: read overrun handled\n", HOSTNO);
  			}
  		}
  	}
 
-	DMA_PRINTK("scsi%d: real DMA transfer complete, basr 0x%X, sr 0x%X\n",
+	dprintk(NDEBUG_DMA, "scsi%d: real DMA transfer complete, basr 0x%X, sr 0x%X\n",
  		   HOSTNO, NCR5380_read(BUS_AND_STATUS_REG),
  		   NCR5380_read(STATUS_REG));
 
@@ -1229,13 +1229,13 @@ static void NCR5380_dma_complete(struct
  		if ((NCR5380_read(STATUS_REG) & PHASE_MASK) == p && (p & SR_IO)) {
  			cnt = toPIO = atari_read_overruns;
  			if (overrun) {
-				DMA_PRINTK("Got an input overrun, using saved byte\n");
+				dprintk(NDEBUG_DMA, "Got an input overrun, using saved byte\n");
  				*(*data)++ = saved_data;
  				(*count)--;
  				cnt--;
  				toPIO--;
  			}
-			DMA_PRINTK("Doing %d-byte PIO to 0x%08lx\n", cnt, (long)*data);
+			dprintk(NDEBUG_DMA, "Doing %d-byte PIO to 0x%08lx\n", cnt, (long)*data);
  			NCR5380_transfer_pio(instance, &p, &cnt, data);
  			*count -= toPIO - cnt;
  		}
@@ -1261,25 +1261,25 @@ static irqreturn_t NCR5380_intr(int irq,
  	int done = 1, handled = 0;
  	unsigned char basr;
 
-	INT_PRINTK("scsi%d: NCR5380 irq triggered\n", HOSTNO);
+	dprintk(NDEBUG_INTR, "scsi%d: NCR5380 irq triggered\n", HOSTNO);
 
  	/* Look for pending interrupts */
  	basr = NCR5380_read(BUS_AND_STATUS_REG);
-	INT_PRINTK("scsi%d: BASR=%02x\n", HOSTNO, basr);
+	dprintk(NDEBUG_INTR, "scsi%d: BASR=%02x\n", HOSTNO, basr);
  	/* dispatch to appropriate routine if found and done=0 */
  	if (basr & BASR_IRQ) {
  		NCR5380_dprint(NDEBUG_INTR, instance);
  		if ((NCR5380_read(STATUS_REG) & (SR_SEL|SR_IO)) == (SR_SEL|SR_IO)) {
  			done = 0;
  			ENABLE_IRQ();
-			INT_PRINTK("scsi%d: SEL interrupt\n", HOSTNO);
+			dprintk(NDEBUG_INTR, "scsi%d: SEL interrupt\n", HOSTNO);
  			NCR5380_reselect(instance);
  			(void)NCR5380_read(RESET_PARITY_INTERRUPT_REG);
  		} else if (basr & BASR_PARITY_ERROR) {
-			INT_PRINTK("scsi%d: PARITY interrupt\n", HOSTNO);
+			dprintk(NDEBUG_INTR, "scsi%d: PARITY interrupt\n", HOSTNO);
  			(void)NCR5380_read(RESET_PARITY_INTERRUPT_REG);
  		} else if ((NCR5380_read(STATUS_REG) & SR_RST) == SR_RST) {
-			INT_PRINTK("scsi%d: RESET interrupt\n", HOSTNO);
+			dprintk(NDEBUG_INTR, "scsi%d: RESET interrupt\n", HOSTNO);
  			(void)NCR5380_read(RESET_PARITY_INTERRUPT_REG);
  		} else {
  			/*
@@ -1298,7 +1298,7 @@ static irqreturn_t NCR5380_intr(int irq,
  			    ((basr & BASR_END_DMA_TRANSFER) ||
  			     !(basr & BASR_PHASE_MATCH))) {
 
-				INT_PRINTK("scsi%d: PHASE MISM or EOP interrupt\n", HOSTNO);
+				dprintk(NDEBUG_INTR, "scsi%d: PHASE MISM or EOP interrupt\n", HOSTNO);
  				NCR5380_dma_complete( instance );
  				done = 0;
  				ENABLE_IRQ();
@@ -1323,7 +1323,7 @@ static irqreturn_t NCR5380_intr(int irq,
  	}
 
  	if (!done) {
-		INT_PRINTK("scsi%d: in int routine, calling main\n", HOSTNO);
+		dprintk(NDEBUG_INTR, "scsi%d: in int routine, calling main\n", HOSTNO);
  		/* Put a call to NCR5380_main() on the queue... */
  		queue_main();
  	}
@@ -1397,7 +1397,7 @@ static int NCR5380_select(struct Scsi_Ho
 
  	hostdata->restart_select = 0;
  	NCR5380_dprint(NDEBUG_ARBITRATION, instance);
-	ARB_PRINTK("scsi%d: starting arbitration, id = %d\n", HOSTNO,
+	dprintk(NDEBUG_ARBITRATION, "scsi%d: starting arbitration, id = %d\n", HOSTNO,
  		   instance->this_id);
 
  	/*
@@ -1442,7 +1442,7 @@ static int NCR5380_select(struct Scsi_Ho
  		;
  #endif
 
-	ARB_PRINTK("scsi%d: arbitration complete\n", HOSTNO);
+	dprintk(NDEBUG_ARBITRATION, "scsi%d: arbitration complete\n", HOSTNO);
 
  	if (hostdata->connected) {
  		NCR5380_write(MODE_REG, MR_BASE);
@@ -1463,7 +1463,7 @@ static int NCR5380_select(struct Scsi_Ho
  	    (NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST) ||
  	    hostdata->connected) {
  		NCR5380_write(MODE_REG, MR_BASE);
-		ARB_PRINTK("scsi%d: lost arbitration, deasserting MR_ARBITRATE\n",
+		dprintk(NDEBUG_ARBITRATION, "scsi%d: lost arbitration, deasserting MR_ARBITRATE\n",
  			   HOSTNO);
  		return -1;
  	}
@@ -1478,7 +1478,7 @@ static int NCR5380_select(struct Scsi_Ho
  	    hostdata->connected) {
  		NCR5380_write(MODE_REG, MR_BASE);
  		NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
-		ARB_PRINTK("scsi%d: lost arbitration, deasserting ICR_ASSERT_SEL\n",
+		dprintk(NDEBUG_ARBITRATION, "scsi%d: lost arbitration, deasserting ICR_ASSERT_SEL\n",
  			   HOSTNO);
  		return -1;
  	}
@@ -1501,7 +1501,7 @@ static int NCR5380_select(struct Scsi_Ho
  		return -1;
  	}
 
-	ARB_PRINTK("scsi%d: won arbitration\n", HOSTNO);
+	dprintk(NDEBUG_ARBITRATION, "scsi%d: won arbitration\n", HOSTNO);
 
  	/*
  	 * Now that we have won arbitration, start Selection process, asserting
@@ -1561,7 +1561,7 @@ static int NCR5380_select(struct Scsi_Ho
 
  	udelay(1);
 
-	SEL_PRINTK("scsi%d: selecting target %d\n", HOSTNO, cmd->device->id);
+	dprintk(NDEBUG_SELECTION, "scsi%d: selecting target %d\n", HOSTNO, cmd->device->id);
 
  	/*
  	 * The SCSI specification calls for a 250 ms timeout for the actual
@@ -1630,7 +1630,7 @@ static int NCR5380_select(struct Scsi_Ho
  #endif
  		cmd->scsi_done(cmd);
  		NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
-		SEL_PRINTK("scsi%d: target did not respond within 250ms\n", HOSTNO);
+		dprintk(NDEBUG_SELECTION, "scsi%d: target did not respond within 250ms\n", HOSTNO);
  		NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
  		return 0;
  	}
@@ -1656,7 +1656,7 @@ static int NCR5380_select(struct Scsi_Ho
  	while (!(NCR5380_read(STATUS_REG) & SR_REQ))
  		;
 
-	SEL_PRINTK("scsi%d: target %d selected, going into MESSAGE OUT phase.\n",
+	dprintk(NDEBUG_SELECTION, "scsi%d: target %d selected, going into MESSAGE OUT phase.\n",
  		   HOSTNO, cmd->device->id);
  	tmp[0] = IDENTIFY(1, cmd->device->lun);
 
@@ -1676,7 +1676,7 @@ static int NCR5380_select(struct Scsi_Ho
  	data = tmp;
  	phase = PHASE_MSGOUT;
  	NCR5380_transfer_pio(instance, &phase, &len, &data);
-	SEL_PRINTK("scsi%d: nexus established.\n", HOSTNO);
+	dprintk(NDEBUG_SELECTION, "scsi%d: nexus established.\n", HOSTNO);
  	/* XXX need to handle errors here */
  	hostdata->connected = cmd;
  #ifndef SUPPORT_TAGS
@@ -1737,11 +1737,11 @@ static int NCR5380_transfer_pio(struct S
  		while (!((tmp = NCR5380_read(STATUS_REG)) & SR_REQ))
  			;
 
-		HSH_PRINTK("scsi%d: REQ detected\n", HOSTNO);
+		dprintk(NDEBUG_HANDSHAKE, "scsi%d: REQ detected\n", HOSTNO);
 
  		/* Check for phase mismatch */
  		if ((tmp & PHASE_MASK) != p) {
-			PIO_PRINTK("scsi%d: phase mismatch\n", HOSTNO);
+			dprintk(NDEBUG_PIO, "scsi%d: phase mismatch\n", HOSTNO);
  			NCR5380_dprint_phase(NDEBUG_PIO, instance);
  			break;
  		}
@@ -1782,7 +1782,7 @@ static int NCR5380_transfer_pio(struct S
  		while (NCR5380_read(STATUS_REG) & SR_REQ)
  			;
 
-		HSH_PRINTK("scsi%d: req false, handshake complete\n", HOSTNO);
+		dprintk(NDEBUG_HANDSHAKE, "scsi%d: req false, handshake complete\n", HOSTNO);
 
  		/*
  		 * We have several special cases to consider during REQ/ACK handshaking :
@@ -1803,7 +1803,7 @@ static int NCR5380_transfer_pio(struct S
  		}
  	} while (--c);
 
-	PIO_PRINTK("scsi%d: residual %d\n", HOSTNO, c);
+	dprintk(NDEBUG_PIO, "scsi%d: residual %d\n", HOSTNO, c);
 
  	*count = c;
  	*data = d;
@@ -1917,7 +1917,7 @@ static int NCR5380_transfer_dma(struct S
  	if (atari_read_overruns && (p & SR_IO))
  		c -= atari_read_overruns;
 
-	DMA_PRINTK("scsi%d: initializing DMA for %s, %d bytes %s %p\n",
+	dprintk(NDEBUG_DMA, "scsi%d: initializing DMA for %s, %d bytes %s %p\n",
  		   HOSTNO, (p & SR_IO) ? "reading" : "writing",
  		   c, (p & SR_IO) ? "to" : "from", d);
 
@@ -2039,7 +2039,7 @@ static void NCR5380_information_transfer
  					 * they are at contiguous physical addresses.
  					 */
  					merge_contiguous_buffers(cmd);
-					INF_PRINTK("scsi%d: %d bytes and %d buffers left\n",
+					dprintk(NDEBUG_INFORMATION, "scsi%d: %d bytes and %d buffers left\n",
  						   HOSTNO, cmd->SCp.this_residual,
  						   cmd->SCp.buffers_residual);
  				}
@@ -2123,7 +2123,7 @@ static void NCR5380_information_transfer
  					/* Accept message by clearing ACK */
  					NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
 
-					LNK_PRINTK("scsi%d: target %d lun %d linked command "
+					dprintk(NDEBUG_LINKED, "scsi%d: target %d lun %d linked command "
  						   "complete.\n", HOSTNO, cmd->device->id, cmd->device->lun);
 
  					/* Enable reselect interrupts */
@@ -2148,7 +2148,7 @@ static void NCR5380_information_transfer
  					 * and don't free it! */
  					cmd->next_link->tag = cmd->tag;
  					cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8);
-					LNK_PRINTK("scsi%d: target %d lun %d linked request "
+					dprintk(NDEBUG_LINKED, "scsi%d: target %d lun %d linked request "
  						   "done, calling scsi_done().\n",
  						   HOSTNO, cmd->device->id, cmd->device->lun);
  #ifdef NCR5380_STATS
@@ -2165,7 +2165,7 @@ static void NCR5380_information_transfer
  					/* ++guenther: possible race with Falcon locking */
  					falcon_dont_release++;
  					hostdata->connected = NULL;
-					QU_PRINTK("scsi%d: command for target %d, lun %d "
+					dprintk(NDEBUG_QUEUES, "scsi%d: command for target %d, lun %d "
  						  "completed\n", HOSTNO, cmd->device->id, cmd->device->lun);
  #ifdef SUPPORT_TAGS
  					cmd_free_tag(cmd);
@@ -2179,7 +2179,7 @@ static void NCR5380_information_transfer
  						/* ++Andreas: the mid level code knows about
  						   QUEUE_FULL now. */
  						TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun];
-						TAG_PRINTK("scsi%d: target %d lun %d returned "
+						dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %d returned "
  							   "QUEUE_FULL after %d commands\n",
  							   HOSTNO, cmd->device->id, cmd->device->lun,
  							   ta->nr_allocated);
@@ -2224,14 +2224,14 @@ static void NCR5380_information_transfer
  					    (status_byte(cmd->SCp.Status) == CHECK_CONDITION)) {
  						scsi_eh_prep_cmnd(cmd, &hostdata->ses, NULL, 0, ~0);
 
-						ASEN_PRINTK("scsi%d: performing request sense\n", HOSTNO);
+						dprintk(NDEBUG_AUTOSENSE, "scsi%d: performing request sense\n", HOSTNO);
 
  						local_irq_save(flags);
  						LIST(cmd,hostdata->issue_queue);
  						SET_NEXT(cmd, hostdata->issue_queue);
  						hostdata->issue_queue = (Scsi_Cmnd *) cmd;
  						local_irq_restore(flags);
-						QU_PRINTK("scsi%d: REQUEST SENSE added to head of "
+						dprintk(NDEBUG_QUEUES, "scsi%d: REQUEST SENSE added to head of "
  							  "issue queue\n", H_NO(cmd));
  					} else
  #endif /* def AUTOSENSE */
@@ -2277,7 +2277,7 @@ static void NCR5380_information_transfer
  						cmd->device->tagged_supported = 0;
  						hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun);
  						cmd->tag = TAG_NONE;
-						TAG_PRINTK("scsi%d: target %d lun %d rejected "
+						dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %d rejected "
  							   "QUEUE_TAG message; tagged queuing "
  							   "disabled\n",
  							   HOSTNO, cmd->device->id, cmd->device->lun);
@@ -2294,7 +2294,7 @@ static void NCR5380_information_transfer
  					hostdata->connected = NULL;
  					hostdata->disconnected_queue = cmd;
  					local_irq_restore(flags);
-					QU_PRINTK("scsi%d: command for target %d lun %d was "
+					dprintk(NDEBUG_QUEUES, "scsi%d: command for target %d lun %d was "
  						  "moved from connected to the "
  						  "disconnected_queue\n", HOSTNO,
  						  cmd->device->id, cmd->device->lun);
@@ -2344,13 +2344,13 @@ static void NCR5380_information_transfer
  					/* Accept first byte by clearing ACK */
  					NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
 
-					EXT_PRINTK("scsi%d: receiving extended message\n", HOSTNO);
+					dprintk(NDEBUG_EXTENDED, "scsi%d: receiving extended message\n", HOSTNO);
 
  					len = 2;
  					data = extended_msg + 1;
  					phase = PHASE_MSGIN;
  					NCR5380_transfer_pio(instance, &phase, &len, &data);
-					EXT_PRINTK("scsi%d: length=%d, code=0x%02x\n", HOSTNO,
+					dprintk(NDEBUG_EXTENDED, "scsi%d: length=%d, code=0x%02x\n", HOSTNO,
  						   (int)extended_msg[1], (int)extended_msg[2]);
 
  					if (!len && extended_msg[1] <=
@@ -2362,7 +2362,7 @@ static void NCR5380_information_transfer
  						phase = PHASE_MSGIN;
 
  						NCR5380_transfer_pio(instance, &phase, &len, &data);
-						EXT_PRINTK("scsi%d: message received, residual %d\n",
+						dprintk(NDEBUG_EXTENDED, "scsi%d: message received, residual %d\n",
  							   HOSTNO, len);
 
  						switch (extended_msg[2]) {
@@ -2493,7 +2493,7 @@ static void NCR5380_reselect(struct Scsi
 
  	target_mask = NCR5380_read(CURRENT_SCSI_DATA_REG) & ~(hostdata->id_mask);
 
-	RSL_PRINTK("scsi%d: reselect\n", HOSTNO);
+	dprintk(NDEBUG_RESELECTION, "scsi%d: reselect\n", HOSTNO);
 
  	/*
  	 * At this point, we have detected that our SCSI ID is on the bus,
@@ -2544,7 +2544,7 @@ static void NCR5380_reselect(struct Scsi
  		if (!NCR5380_transfer_pio(instance, &phase, &len, &data) &&
  		    msg[1] == SIMPLE_QUEUE_TAG)
  			tag = msg[2];
-		TAG_PRINTK("scsi%d: target mask %02x, lun %d sent tag %d at "
+		dprintk(NDEBUG_TAGS, "scsi%d: target mask %02x, lun %d sent tag %d at "
  			   "reselection\n", HOSTNO, target_mask, lun, tag);
  	}
  #endif
@@ -2598,7 +2598,7 @@ static void NCR5380_reselect(struct Scsi
  	NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
 
  	hostdata->connected = tmp;
-	RSL_PRINTK("scsi%d: nexus established, target = %d, lun = %d, tag = %d\n",
+	dprintk(NDEBUG_RESELECTION, "scsi%d: nexus established, target = %d, lun = %d, tag = %d\n",
  		   HOSTNO, tmp->device->id, tmp->device->lun, tmp->tag);
  	falcon_dont_release--;
  }
@@ -2640,7 +2640,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
  		printk(KERN_ERR "scsi%d: !!BINGO!! Falcon has no lock in NCR5380_abort\n",
  		       HOSTNO);
 
-	ABRT_PRINTK("scsi%d: abort called basr 0x%02x, sr 0x%02x\n", HOSTNO,
+	dprintk(NDEBUG_ABORT, "scsi%d: abort called basr 0x%02x, sr 0x%02x\n", HOSTNO,
  		    NCR5380_read(BUS_AND_STATUS_REG),
  		    NCR5380_read(STATUS_REG));
 
@@ -2653,7 +2653,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
 
  	if (hostdata->connected == cmd) {
 
-		ABRT_PRINTK("scsi%d: aborting connected command\n", HOSTNO);
+		dprintk(NDEBUG_ABORT, "scsi%d: aborting connected command\n", HOSTNO);
  		/*
  		 * We should perform BSY checking, and make sure we haven't slipped
  		 * into BUS FREE.
@@ -2705,7 +2705,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
  			SET_NEXT(tmp, NULL);
  			tmp->result = DID_ABORT << 16;
  			local_irq_restore(flags);
-			ABRT_PRINTK("scsi%d: abort removed command from issue queue.\n",
+			dprintk(NDEBUG_ABORT, "scsi%d: abort removed command from issue queue.\n",
  				    HOSTNO);
  			/* Tagged queuing note: no tag to free here, hasn't been assigned
  			 * yet... */
@@ -2728,7 +2728,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
 
  	if (hostdata->connected) {
  		local_irq_restore(flags);
-		ABRT_PRINTK("scsi%d: abort failed, command connected.\n", HOSTNO);
+		dprintk(NDEBUG_ABORT, "scsi%d: abort failed, command connected.\n", HOSTNO);
  		return SCSI_ABORT_SNOOZE;
  	}
 
@@ -2761,12 +2761,12 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
  	     tmp = NEXT(tmp)) {
  		if (cmd == tmp) {
  			local_irq_restore(flags);
-			ABRT_PRINTK("scsi%d: aborting disconnected command.\n", HOSTNO);
+			dprintk(NDEBUG_ABORT, "scsi%d: aborting disconnected command.\n", HOSTNO);
 
  			if (NCR5380_select(instance, cmd, (int)cmd->tag))
  				return SCSI_ABORT_BUSY;
 
-			ABRT_PRINTK("scsi%d: nexus reestablished.\n", HOSTNO);
+			dprintk(NDEBUG_ABORT, "scsi%d: nexus reestablished.\n", HOSTNO);
 
  			do_abort(instance);
 
@@ -2890,7 +2890,7 @@ static int NCR5380_bus_reset(Scsi_Cmnd *
  	 */
 
  	if ((cmd = connected)) {
-		ABRT_PRINTK("scsi%d: reset aborted a connected command\n", H_NO(cmd));
+		dprintk(NDEBUG_ABORT, "scsi%d: reset aborted a connected command\n", H_NO(cmd));
  		cmd->result = (cmd->result & 0xffff) | (DID_RESET << 16);
  		cmd->scsi_done(cmd);
  	}
@@ -2902,7 +2902,7 @@ static int NCR5380_bus_reset(Scsi_Cmnd *
  		cmd->scsi_done(cmd);
  	}
  	if (i > 0)
-		ABRT_PRINTK("scsi: reset aborted %d disconnected command(s)\n", i);
+		dprintk(NDEBUG_ABORT, "scsi: reset aborted %d disconnected command(s)\n", i);
 
  	/* The Falcon lock should be released after a reset...
  	 */
@@ -2942,11 +2942,11 @@ static int NCR5380_bus_reset(Scsi_Cmnd *
  	 */
 
  	if (hostdata->issue_queue)
-		ABRT_PRINTK("scsi%d: reset aborted issued command(s)\n", H_NO(cmd));
+		dprintk(NDEBUG_ABORT, "scsi%d: reset aborted issued command(s)\n", H_NO(cmd));
  	if (hostdata->connected)
-		ABRT_PRINTK("scsi%d: reset aborted a connected command\n", H_NO(cmd));
+		dprintk(NDEBUG_ABORT, "scsi%d: reset aborted a connected command\n", H_NO(cmd));
  	if (hostdata->disconnected_queue)
-		ABRT_PRINTK("scsi%d: reset aborted disconnected command(s)\n", H_NO(cmd));
+		dprintk(NDEBUG_ABORT, "scsi%d: reset aborted disconnected command(s)\n", H_NO(cmd));
 
  	local_irq_save(flags);
  	hostdata->issue_queue = NULL;

Index: linux-m68k/drivers/scsi/atari_scsi.c
===================================================================

drivers/scsi/atari_scsi.c +8 -8
@@ -313,7 +313,7 @@ static irqreturn_t scsi_tt_intr(int irq,
 
  	dma_stat = tt_scsi_dma.dma_ctrl;
 
-	INT_PRINTK("scsi%d: NCR5380 interrupt, DMA status = %02x\n",
+	dprintk(NDEBUG_INTR, "scsi%d: NCR5380 interrupt, DMA status = %02x\n",
  		   atari_scsi_host->host_no, dma_stat & 0xff);
 
  	/* Look if it was the DMA that has interrupted: First possibility
@@ -339,7 +339,7 @@ static irqreturn_t scsi_tt_intr(int irq,
  	if ((dma_stat & 0x02) && !(dma_stat & 0x40)) {
  		atari_dma_residual = HOSTDATA_DMALEN - (SCSI_DMA_READ_P(dma_addr) - atari_dma_startaddr);
 
-		DMA_PRINTK("SCSI DMA: There are %ld residual bytes.\n",
+		dprintk(NDEBUG_DMA, "SCSI DMA: There are %ld residual bytes.\n",
  			   atari_dma_residual);
 
  		if ((signed int)atari_dma_residual < 0)
@@ -370,7 +370,7 @@ static irqreturn_t scsi_tt_intr(int irq,
  			 * other command.  These shouldn't disconnect anyway.
  			 */
  			if (atari_dma_residual & 0x1ff) {
-				DMA_PRINTK("SCSI DMA: DMA bug corrected, "
+				dprintk(NDEBUG_DMA, "SCSI DMA: DMA bug corrected, "
  					   "difference %ld bytes\n",
  					   512 - (atari_dma_residual & 0x1ff));
  				atari_dma_residual = (atari_dma_residual + 511) & ~0x1ff;
@@ -437,7 +437,7 @@ static irqreturn_t scsi_falcon_intr(int
  			       "ST-DMA fifo\n", transferred & 15);
 
  		atari_dma_residual = HOSTDATA_DMALEN - transferred;
-		DMA_PRINTK("SCSI DMA: There are %ld residual bytes.\n",
+		dprintk(NDEBUG_DMA, "SCSI DMA: There are %ld residual bytes.\n",
  			   atari_dma_residual);
  	} else
  		atari_dma_residual = 0;
@@ -473,11 +473,11 @@ static void atari_scsi_fetch_restbytes(v
  		/* there are 'nr' bytes left for the last long address
  		   before the DMA pointer */
  		phys_dst ^= nr;
-		DMA_PRINTK("SCSI DMA: there are %d rest bytes for phys addr 0x%08lx",
+		dprintk(NDEBUG_DMA, "SCSI DMA: there are %d rest bytes for phys addr 0x%08lx",
  			   nr, phys_dst);
  		/* The content of the DMA pointer is a physical address!  */
  		dst = phys_to_virt(phys_dst);
-		DMA_PRINTK(" = virt addr %p\n", dst);
+		dprintk(NDEBUG_DMA, " = virt addr %p\n", dst);
  		for (src = (char *)&tt_scsi_dma.dma_restdata; nr != 0; --nr)
  			*dst++ = *src++;
  	}
@@ -877,7 +877,7 @@ static unsigned long atari_scsi_dma_setu
  {
  	unsigned long addr = virt_to_phys(data);
 
-	DMA_PRINTK("scsi%d: setting up dma, data = %p, phys = %lx, count = %ld, "
+	dprintk(NDEBUG_DMA, "scsi%d: setting up dma, data = %p, phys = %lx, count = %ld, "
  		   "dir = %d\n", instance->host_no, data, addr, count, dir);
 
  	if (!IS_A_TT() && !STRAM_ADDR(addr)) {
@@ -1057,7 +1057,7 @@ static unsigned long atari_dma_xfer_len(
  		possible_len = limit;
 
  	if (possible_len != wanted_len)
-		DMA_PRINTK("Sorry, must cut DMA transfer size to %ld bytes "
+		dprintk(NDEBUG_DMA, "Sorry, must cut DMA transfer size to %ld bytes "
  			   "instead of %ld\n", possible_len, wanted_len);
 
  	return possible_len;

Index: linux-m68k/drivers/scsi/sun3_NCR5380.c
===================================================================

drivers/scsi/sun3_NCR5380.c +61 -61
@@ -364,7 +364,7 @@ static int is_lun_busy(struct scsi_cmnd
  	return( 0 );
      if (TagAlloc[cmd->device->id][cmd->device->lun].nr_allocated >=
  	TagAlloc[cmd->device->id][cmd->device->lun].queue_size ) {
-	TAG_PRINTK( "scsi%d: target %d lun %d: no free tags\n",
+	dprintk(NDEBUG_TAGS,  "scsi%d: target %d lun %d: no free tags\n",
  		    H_NO(cmd), cmd->device->id, cmd->device->lun );
  	return( 1 );
      }
@@ -388,7 +388,7 @@ static void cmd_get_tag(struct scsi_cmnd
  	!setup_use_tagged_queuing || !cmd->device->tagged_supported) {
  	cmd->tag = TAG_NONE;
  	hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun);
-	TAG_PRINTK( "scsi%d: target %d lun %d now allocated by untagged "
+	dprintk(NDEBUG_TAGS,  "scsi%d: target %d lun %d now allocated by untagged "
  		    "command\n", H_NO(cmd), cmd->device->id, cmd->device->lun );
      }
      else {
@@ -397,7 +397,7 @@ static void cmd_get_tag(struct scsi_cmnd
  	cmd->tag = find_first_zero_bit( &ta->allocated, MAX_TAGS );
  	set_bit( cmd->tag, &ta->allocated );
  	ta->nr_allocated++;
-	TAG_PRINTK( "scsi%d: using tag %d for target %d lun %d "
+	dprintk(NDEBUG_TAGS,  "scsi%d: using tag %d for target %d lun %d "
  		    "(now %d tags in use)\n",
  		    H_NO(cmd), cmd->tag, cmd->device->id, cmd->device->lun,
  		    ta->nr_allocated );
@@ -415,7 +415,7 @@ static void cmd_free_tag(struct scsi_cmn
 
      if (cmd->tag == TAG_NONE) {
  	hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
-	TAG_PRINTK( "scsi%d: target %d lun %d untagged cmd finished\n",
+	dprintk(NDEBUG_TAGS,  "scsi%d: target %d lun %d untagged cmd finished\n",
  		    H_NO(cmd), cmd->device->id, cmd->device->lun );
      }
      else if (cmd->tag >= MAX_TAGS) {
@@ -426,7 +426,7 @@ static void cmd_free_tag(struct scsi_cmn
  	TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun];
  	clear_bit( cmd->tag, &ta->allocated );
  	ta->nr_allocated--;
-	TAG_PRINTK( "scsi%d: freed tag %d for target %d lun %d\n",
+	dprintk(NDEBUG_TAGS,  "scsi%d: freed tag %d for target %d lun %d\n",
  		    H_NO(cmd), cmd->tag, cmd->device->id, cmd->device->lun );
      }
  }
@@ -618,7 +618,7 @@ static inline void NCR5380_all_init (voi
  {
      static int done = 0;
      if (!done) {
-	INI_PRINTK("scsi : NCR5380_all_init()\n");
+	dprintk(NDEBUG_INIT, "scsi : NCR5380_all_init()\n");
  	done = 1;
      }
  }
@@ -928,7 +928,7 @@ static int NCR5380_queue_command_lck(str
 
      local_irq_restore(flags);
 
-    QU_PRINTK("scsi%d: command added to %s of queue\n", H_NO(cmd),
+    dprintk(NDEBUG_QUEUES, "scsi%d: command added to %s of queue\n", H_NO(cmd),
  	      (cmd->cmnd[0] == REQUEST_SENSE) ? "head" : "tail");
 
      /* If queue_command() is called from an interrupt (real one or bottom
@@ -998,7 +998,7 @@ static void NCR5380_main (struct work_st
  	done = 1;
 
  	if (!hostdata->connected) {
-	    MAIN_PRINTK( "scsi%d: not connected\n", HOSTNO );
+	    dprintk(NDEBUG_MAIN,  "scsi%d: not connected\n", HOSTNO );
  	    /*
  	     * Search through the issue_queue for a command destined
  	     * for a target that's not busy.
@@ -1043,7 +1043,7 @@ static void NCR5380_main (struct work_st
  		     * On failure, we must add the command back to the
  		     *   issue queue so we can keep trying.	
  		     */
-		    MAIN_PRINTK("scsi%d: main(): command for target %d "
+		    dprintk(NDEBUG_MAIN, "scsi%d: main(): command for target %d "
  				"lun %d removed from issue_queue\n",
  				HOSTNO, tmp->device->id, tmp->device->lun);
  		    /*
@@ -1072,7 +1072,7 @@ static void NCR5380_main (struct work_st
  			cmd_free_tag( tmp );
  #endif
  			local_irq_restore(flags);
-			MAIN_PRINTK("scsi%d: main(): select() failed, "
+			dprintk(NDEBUG_MAIN, "scsi%d: main(): select() failed, "
  				    "returned to issue_queue\n", HOSTNO);
  			if (hostdata->connected)
  			    break;
@@ -1086,10 +1086,10 @@ static void NCR5380_main (struct work_st
  #endif
  	    ) {
  	    local_irq_restore(flags);
-	    MAIN_PRINTK("scsi%d: main: performing information transfer\n",
+	    dprintk(NDEBUG_MAIN, "scsi%d: main: performing information transfer\n",
  			HOSTNO);
  	    NCR5380_information_transfer(instance);
-	    MAIN_PRINTK("scsi%d: main: done set false\n", HOSTNO);
+	    dprintk(NDEBUG_MAIN, "scsi%d: main: done set false\n", HOSTNO);
  	    done = 0;
  	}
      } while (!done);
@@ -1126,7 +1126,7 @@ static void NCR5380_dma_complete( struct
  	return;
      }
 
-    DMA_PRINTK("scsi%d: real DMA transfer complete, basr 0x%X, sr 0x%X\n",
+    dprintk(NDEBUG_DMA, "scsi%d: real DMA transfer complete, basr 0x%X, sr 0x%X\n",
  	       HOSTNO, NCR5380_read(BUS_AND_STATUS_REG),
  	       NCR5380_read(STATUS_REG));
 
@@ -1185,27 +1185,27 @@ static irqreturn_t NCR5380_intr (int irq
      int done = 1, handled = 0;
      unsigned char basr;
 
-    INT_PRINTK("scsi%d: NCR5380 irq triggered\n", HOSTNO);
+    dprintk(NDEBUG_INTR, "scsi%d: NCR5380 irq triggered\n", HOSTNO);
 
      /* Look for pending interrupts */
      basr = NCR5380_read(BUS_AND_STATUS_REG);
-    INT_PRINTK("scsi%d: BASR=%02x\n", HOSTNO, basr);
+    dprintk(NDEBUG_INTR, "scsi%d: BASR=%02x\n", HOSTNO, basr);
      /* dispatch to appropriate routine if found and done=0 */
      if (basr & BASR_IRQ) {
  	NCR5380_dprint(NDEBUG_INTR, instance);
  	if ((NCR5380_read(STATUS_REG) & (SR_SEL|SR_IO)) == (SR_SEL|SR_IO)) {
  	    done = 0;
  //	    ENABLE_IRQ();
-	    INT_PRINTK("scsi%d: SEL interrupt\n", HOSTNO);
+	    dprintk(NDEBUG_INTR, "scsi%d: SEL interrupt\n", HOSTNO);
  	    NCR5380_reselect(instance);
  	    (void) NCR5380_read(RESET_PARITY_INTERRUPT_REG);
  	}
  	else if (basr & BASR_PARITY_ERROR) {
-	    INT_PRINTK("scsi%d: PARITY interrupt\n", HOSTNO);
+	    dprintk(NDEBUG_INTR, "scsi%d: PARITY interrupt\n", HOSTNO);
  	    (void) NCR5380_read(RESET_PARITY_INTERRUPT_REG);
  	}
  	else if ((NCR5380_read(STATUS_REG) & SR_RST) == SR_RST) {
-	    INT_PRINTK("scsi%d: RESET interrupt\n", HOSTNO);
+	    dprintk(NDEBUG_INTR, "scsi%d: RESET interrupt\n", HOSTNO);
  	    (void)NCR5380_read(RESET_PARITY_INTERRUPT_REG);
  	}
  	else {
@@ -1225,7 +1225,7 @@ static irqreturn_t NCR5380_intr (int irq
  		((basr & BASR_END_DMA_TRANSFER) ||
  		 !(basr & BASR_PHASE_MATCH))) {
 
-		INT_PRINTK("scsi%d: PHASE MISM or EOP interrupt\n", HOSTNO);
+		dprintk(NDEBUG_INTR, "scsi%d: PHASE MISM or EOP interrupt\n", HOSTNO);
  		NCR5380_dma_complete( instance );
  		done = 0;
  //		ENABLE_IRQ();
@@ -1234,7 +1234,7 @@ static irqreturn_t NCR5380_intr (int irq
  	    {
  /* MS: Ignore unknown phase mismatch interrupts (caused by EOP interrupt) */
  		if (basr & BASR_PHASE_MATCH)
-		   INT_PRINTK("scsi%d: unknown interrupt, "
+		   dprintk(NDEBUG_INTR, "scsi%d: unknown interrupt, "
  			   "BASR 0x%x, MR 0x%x, SR 0x%x\n",
  			   HOSTNO, basr, NCR5380_read(MODE_REG),
  			   NCR5380_read(STATUS_REG));
@@ -1258,7 +1258,7 @@ static irqreturn_t NCR5380_intr (int irq
      }
 
      if (!done) {
-	INT_PRINTK("scsi%d: in int routine, calling main\n", HOSTNO);
+	dprintk(NDEBUG_INTR, "scsi%d: in int routine, calling main\n", HOSTNO);
  	/* Put a call to NCR5380_main() on the queue... */
  	queue_main();
      }
@@ -1335,7 +1335,7 @@ static int NCR5380_select(struct Scsi_Ho
 
      hostdata->restart_select = 0;
      NCR5380_dprint(NDEBUG_ARBITRATION, instance);
-    ARB_PRINTK("scsi%d: starting arbitration, id = %d\n", HOSTNO,
+    dprintk(NDEBUG_ARBITRATION, "scsi%d: starting arbitration, id = %d\n", HOSTNO,
  	       instance->this_id);
 
      /*
@@ -1381,7 +1381,7 @@ static int NCR5380_select(struct Scsi_Ho
  	 && !hostdata->connected);
  #endif
 
-    ARB_PRINTK("scsi%d: arbitration complete\n", HOSTNO);
+    dprintk(NDEBUG_ARBITRATION, "scsi%d: arbitration complete\n", HOSTNO);
 
      if (hostdata->connected) {
  	NCR5380_write(MODE_REG, MR_BASE);
@@ -1402,7 +1402,7 @@ static int NCR5380_select(struct Scsi_Ho
  	(NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST) ||
  	hostdata->connected) {
  	NCR5380_write(MODE_REG, MR_BASE);
-	ARB_PRINTK("scsi%d: lost arbitration, deasserting MR_ARBITRATE\n",
+	dprintk(NDEBUG_ARBITRATION, "scsi%d: lost arbitration, deasserting MR_ARBITRATE\n",
  		   HOSTNO);
  	return -1;
      }
@@ -1417,7 +1417,7 @@ static int NCR5380_select(struct Scsi_Ho
  	hostdata->connected) {
  	NCR5380_write(MODE_REG, MR_BASE);
  	NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
-	ARB_PRINTK("scsi%d: lost arbitration, deasserting ICR_ASSERT_SEL\n",
+	dprintk(NDEBUG_ARBITRATION, "scsi%d: lost arbitration, deasserting ICR_ASSERT_SEL\n",
  		   HOSTNO);
  	return -1;
      }
@@ -1440,7 +1440,7 @@ static int NCR5380_select(struct Scsi_Ho
  	return -1;
      }
 
-    ARB_PRINTK("scsi%d: won arbitration\n", HOSTNO);
+    dprintk(NDEBUG_ARBITRATION, "scsi%d: won arbitration\n", HOSTNO);
 
      /*
       * Now that we have won arbitration, start Selection process, asserting
@@ -1500,7 +1500,7 @@ static int NCR5380_select(struct Scsi_Ho
 
      udelay(1);
 
-    SEL_PRINTK("scsi%d: selecting target %d\n", HOSTNO, cmd->device->id);
+    dprintk(NDEBUG_SELECTION, "scsi%d: selecting target %d\n", HOSTNO, cmd->device->id);
 
      /*
       * The SCSI specification calls for a 250 ms timeout for the actual
@@ -1568,7 +1568,7 @@ static int NCR5380_select(struct Scsi_Ho
  #endif
  	cmd->scsi_done(cmd);
  	NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
-	SEL_PRINTK("scsi%d: target did not respond within 250ms\n", HOSTNO);
+	dprintk(NDEBUG_SELECTION, "scsi%d: target did not respond within 250ms\n", HOSTNO);
  	NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
  	return 0;
      }
@@ -1593,7 +1593,7 @@ static int NCR5380_select(struct Scsi_Ho
      /* Wait for start of REQ/ACK handshake */
      while (!(NCR5380_read(STATUS_REG) & SR_REQ));
 
-    SEL_PRINTK("scsi%d: target %d selected, going into MESSAGE OUT phase.\n",
+    dprintk(NDEBUG_SELECTION, "scsi%d: target %d selected, going into MESSAGE OUT phase.\n",
  	       HOSTNO, cmd->device->id);
      tmp[0] = IDENTIFY(1, cmd->device->lun);
 
@@ -1613,7 +1613,7 @@ static int NCR5380_select(struct Scsi_Ho
      data = tmp;
      phase = PHASE_MSGOUT;
      NCR5380_transfer_pio(instance, &phase, &len, &data);
-    SEL_PRINTK("scsi%d: nexus established.\n", HOSTNO);
+    dprintk(NDEBUG_SELECTION, "scsi%d: nexus established.\n", HOSTNO);
      /* XXX need to handle errors here */
      hostdata->connected = cmd;
  #ifndef SUPPORT_TAGS
@@ -1676,11 +1676,11 @@ static int NCR5380_transfer_pio( struct
  	 */
  	while (!((tmp = NCR5380_read(STATUS_REG)) & SR_REQ));
 
-	HSH_PRINTK("scsi%d: REQ detected\n", HOSTNO);
+	dprintk(NDEBUG_HANDSHAKE, "scsi%d: REQ detected\n", HOSTNO);
 
  	/* Check for phase mismatch */	
  	if ((tmp & PHASE_MASK) != p) {
-	    PIO_PRINTK("scsi%d: phase mismatch\n", HOSTNO);
+	    dprintk(NDEBUG_PIO, "scsi%d: phase mismatch\n", HOSTNO);
  	    NCR5380_dprint_phase(NDEBUG_PIO, instance);
  	    break;
  	}
@@ -1721,7 +1721,7 @@ static int NCR5380_transfer_pio( struct
 
  	while (NCR5380_read(STATUS_REG) & SR_REQ);
 
-	HSH_PRINTK("scsi%d: req false, handshake complete\n", HOSTNO);
+	dprintk(NDEBUG_HANDSHAKE, "scsi%d: req false, handshake complete\n", HOSTNO);
 
  /*
   * We have several special cases to consider during REQ/ACK handshaking :
@@ -1742,7 +1742,7 @@ static int NCR5380_transfer_pio( struct
  	}
      } while (--c);
 
-    PIO_PRINTK("scsi%d: residual %d\n", HOSTNO, c);
+    dprintk(NDEBUG_PIO, "scsi%d: residual %d\n", HOSTNO, c);
 
      *count = c;
      *data = d;
@@ -1850,7 +1850,7 @@ static int NCR5380_transfer_dma( struct
      }
      hostdata->dma_len = c;
 
-    DMA_PRINTK("scsi%d: initializing DMA for %s, %d bytes %s %p\n",
+    dprintk(NDEBUG_DMA, "scsi%d: initializing DMA for %s, %d bytes %s %p\n",
  	       HOSTNO, (p & SR_IO) ? "reading" : "writing",
  	       c, (p & SR_IO) ? "to" : "from", *data);
 
@@ -1992,7 +1992,7 @@ static void NCR5380_information_transfer
  		    --cmd->SCp.buffers_residual;
  		    cmd->SCp.this_residual = cmd->SCp.buffer->length;
  		    cmd->SCp.ptr = SGADDR(cmd->SCp.buffer);
-		    INF_PRINTK("scsi%d: %d bytes and %d buffers left\n",
+		    dprintk(NDEBUG_INFORMATION, "scsi%d: %d bytes and %d buffers left\n",
  			       HOSTNO, cmd->SCp.this_residual,
  			       cmd->SCp.buffers_residual);
  		}
@@ -2084,7 +2084,7 @@ static void NCR5380_information_transfer
  		    /* Accept message by clearing ACK */
  		    NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
 
-		    LNK_PRINTK("scsi%d: target %d lun %d linked command "
+		    dprintk(NDEBUG_LINKED, "scsi%d: target %d lun %d linked command "
  			       "complete.\n", HOSTNO, cmd->device->id, cmd->device->lun);
 
  		    /* Enable reselect interrupts */
@@ -2109,7 +2109,7 @@ static void NCR5380_information_transfer
  		     * and don't free it! */
  		    cmd->next_link->tag = cmd->tag;
  		    cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8);
-		    LNK_PRINTK("scsi%d: target %d lun %d linked request "
+		    dprintk(NDEBUG_LINKED, "scsi%d: target %d lun %d linked request "
  			       "done, calling scsi_done().\n",
  			       HOSTNO, cmd->device->id, cmd->device->lun);
  #ifdef NCR5380_STATS
@@ -2124,7 +2124,7 @@ static void NCR5380_information_transfer
  		    /* Accept message by clearing ACK */
  		    NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
  		    hostdata->connected = NULL;
-		    QU_PRINTK("scsi%d: command for target %d, lun %d "
+		    dprintk(NDEBUG_QUEUES, "scsi%d: command for target %d, lun %d "
  			      "completed\n", HOSTNO, cmd->device->id, cmd->device->lun);
  #ifdef SUPPORT_TAGS
  		    cmd_free_tag( cmd );
@@ -2138,7 +2138,7 @@ static void NCR5380_information_transfer
  			/* ++Andreas: the mid level code knows about
  			   QUEUE_FULL now. */
  			TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun];
-			TAG_PRINTK("scsi%d: target %d lun %d returned "
+			dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %d returned "
  				   "QUEUE_FULL after %d commands\n",
  				   HOSTNO, cmd->device->id, cmd->device->lun,
  				   ta->nr_allocated);
@@ -2182,7 +2182,7 @@ static void NCR5380_information_transfer
  		    if ((cmd->cmnd[0] != REQUEST_SENSE) &&
  			(status_byte(cmd->SCp.Status) == CHECK_CONDITION)) {
  			scsi_eh_prep_cmnd(cmd, &hostdata->ses, NULL, 0, ~0);
-			ASEN_PRINTK("scsi%d: performing request sense\n",
+			dprintk(NDEBUG_AUTOSENSE, "scsi%d: performing request sense\n",
  				    HOSTNO);
  			/* this is initialized from initialize_SCp
  			cmd->SCp.buffer = NULL;
@@ -2194,7 +2194,7 @@ static void NCR5380_information_transfer
  			SET_NEXT(cmd, hostdata->issue_queue);
  		        hostdata->issue_queue = (struct scsi_cmnd *) cmd;
  		        local_irq_restore(flags);
-			QU_PRINTK("scsi%d: REQUEST SENSE added to head of "
+			dprintk(NDEBUG_QUEUES, "scsi%d: REQUEST SENSE added to head of "
  				  "issue queue\n", H_NO(cmd));
  		   } else
  #endif /* def AUTOSENSE */
@@ -2234,7 +2234,7 @@ static void NCR5380_information_transfer
  			cmd->device->tagged_supported = 0;
  			hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun);
  			cmd->tag = TAG_NONE;
-			TAG_PRINTK("scsi%d: target %d lun %d rejected "
+			dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %d rejected "
  				   "QUEUE_TAG message; tagged queuing "
  				   "disabled\n",
  				   HOSTNO, cmd->device->id, cmd->device->lun);
@@ -2251,7 +2251,7 @@ static void NCR5380_information_transfer
  		    hostdata->connected = NULL;
  		    hostdata->disconnected_queue = cmd;
  		    local_irq_restore(flags);
-		    QU_PRINTK("scsi%d: command for target %d lun %d was "
+		    dprintk(NDEBUG_QUEUES, "scsi%d: command for target %d lun %d was "
  			      "moved from connected to the "
  			      "disconnected_queue\n", HOSTNO,
  			      cmd->device->id, cmd->device->lun);
@@ -2304,13 +2304,13 @@ static void NCR5380_information_transfer
  		    /* Accept first byte by clearing ACK */
  		    NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
 
-		    EXT_PRINTK("scsi%d: receiving extended message\n", HOSTNO);
+		    dprintk(NDEBUG_EXTENDED, "scsi%d: receiving extended message\n", HOSTNO);
 
  		    len = 2;
  		    data = extended_msg + 1;
  		    phase = PHASE_MSGIN;
  		    NCR5380_transfer_pio(instance, &phase, &len, &data);
-		    EXT_PRINTK("scsi%d: length=%d, code=0x%02x\n", HOSTNO,
+		    dprintk(NDEBUG_EXTENDED, "scsi%d: length=%d, code=0x%02x\n", HOSTNO,
  			       (int)extended_msg[1], (int)extended_msg[2]);
 
  		    if (!len && extended_msg[1] <=
@@ -2322,7 +2322,7 @@ static void NCR5380_information_transfer
  			phase = PHASE_MSGIN;
 
  			NCR5380_transfer_pio(instance, &phase, &len, &data);
-			EXT_PRINTK("scsi%d: message received, residual %d\n",
+			dprintk(NDEBUG_EXTENDED, "scsi%d: message received, residual %d\n",
  				   HOSTNO, len);
 
  			switch (extended_msg[2]) {
@@ -2454,7 +2454,7 @@ static void NCR5380_reselect (struct Scs
 
      target_mask = NCR5380_read(CURRENT_SCSI_DATA_REG) & ~(hostdata->id_mask);
 
-    RSL_PRINTK("scsi%d: reselect\n", HOSTNO);
+    dprintk(NDEBUG_RESELECTION, "scsi%d: reselect\n", HOSTNO);
 
      /*
       * At this point, we have detected that our SCSI ID is on the bus,
@@ -2576,13 +2576,13 @@ static void NCR5380_reselect (struct Scs
  	if (!NCR5380_transfer_pio(instance, &phase, &len, &data) &&
  	    msg[1] == SIMPLE_QUEUE_TAG)
  	    tag = msg[2];
-	TAG_PRINTK("scsi%d: target mask %02x, lun %d sent tag %d at "
+	dprintk(NDEBUG_TAGS, "scsi%d: target mask %02x, lun %d sent tag %d at "
  		   "reselection\n", HOSTNO, target_mask, lun, tag);
      }
  #endif
 
      hostdata->connected = tmp;
-    RSL_PRINTK("scsi%d: nexus established, target = %d, lun = %d, tag = %d\n",
+    dprintk(NDEBUG_RESELECTION, "scsi%d: nexus established, target = %d, lun = %d, tag = %d\n",
  	       HOSTNO, tmp->device->id, tmp->device->lun, tmp->tag);
  }
 
@@ -2618,7 +2618,7 @@ static int NCR5380_abort(struct scsi_cmn
 
      local_irq_save(flags);
 
-    ABRT_PRINTK("scsi%d: abort called basr 0x%02x, sr 0x%02x\n", HOSTNO,
+    dprintk(NDEBUG_ABORT, "scsi%d: abort called basr 0x%02x, sr 0x%02x\n", HOSTNO,
  		NCR5380_read(BUS_AND_STATUS_REG),
  		NCR5380_read(STATUS_REG));
 
@@ -2631,7 +2631,7 @@ static int NCR5380_abort(struct scsi_cmn
 
      if (hostdata->connected == cmd) {
 
-	ABRT_PRINTK("scsi%d: aborting connected command\n", HOSTNO);
+	dprintk(NDEBUG_ABORT, "scsi%d: aborting connected command\n", HOSTNO);
  /*
   * We should perform BSY checking, and make sure we haven't slipped
   * into BUS FREE.
@@ -2682,7 +2682,7 @@ static int NCR5380_abort(struct scsi_cmn
  	    SET_NEXT(tmp, NULL);
  	    tmp->result = DID_ABORT << 16;
  	    local_irq_restore(flags);
-	    ABRT_PRINTK("scsi%d: abort removed command from issue queue.\n",
+	    dprintk(NDEBUG_ABORT, "scsi%d: abort removed command from issue queue.\n",
  			HOSTNO);
  	    /* Tagged queuing note: no tag to free here, hasn't been assigned
  	     * yet... */
@@ -2703,7 +2703,7 @@ static int NCR5380_abort(struct scsi_cmn
 
      if (hostdata->connected) {
  	local_irq_restore(flags);
-	ABRT_PRINTK("scsi%d: abort failed, command connected.\n", HOSTNO);
+	dprintk(NDEBUG_ABORT, "scsi%d: abort failed, command connected.\n", HOSTNO);
          return SCSI_ABORT_SNOOZE;
      }
 
@@ -2736,12 +2736,12 @@ static int NCR5380_abort(struct scsi_cmn
  	 tmp = NEXT(tmp))
          if (cmd == tmp) {
              local_irq_restore(flags);
-	    ABRT_PRINTK("scsi%d: aborting disconnected command.\n", HOSTNO);
+	    dprintk(NDEBUG_ABORT, "scsi%d: aborting disconnected command.\n", HOSTNO);
 
              if (NCR5380_select (instance, cmd, (int) cmd->tag))
  		return SCSI_ABORT_BUSY;
 
-	    ABRT_PRINTK("scsi%d: nexus reestablished.\n", HOSTNO);
+	    dprintk(NDEBUG_ABORT, "scsi%d: nexus reestablished.\n", HOSTNO);
 
  	    do_abort (instance);
 
@@ -2853,7 +2853,7 @@ static int NCR5380_bus_reset(struct scsi
       */
 
      if ((cmd = connected)) {
-	ABRT_PRINTK("scsi%d: reset aborted a connected command\n", H_NO(cmd));
+	dprintk(NDEBUG_ABORT, "scsi%d: reset aborted a connected command\n", H_NO(cmd));
  	cmd->result = (cmd->result & 0xffff) | (DID_RESET << 16);
  	cmd->scsi_done( cmd );
      }
@@ -2865,7 +2865,7 @@ static int NCR5380_bus_reset(struct scsi
  	cmd->scsi_done( cmd );
      }
      if (i > 0)
-	ABRT_PRINTK("scsi: reset aborted %d disconnected command(s)\n", i);
+	dprintk(NDEBUG_ABORT, "scsi: reset aborted %d disconnected command(s)\n", i);
 
 
      /* since all commands have been explicitly terminated, we need to tell
@@ -2899,11 +2899,11 @@ static int NCR5380_bus_reset(struct scsi
       */
 
      if (hostdata->issue_queue)
-	ABRT_PRINTK("scsi%d: reset aborted issued command(s)\n", H_NO(cmd));
+	dprintk(NDEBUG_ABORT, "scsi%d: reset aborted issued command(s)\n", H_NO(cmd));
      if (hostdata->connected)
-	ABRT_PRINTK("scsi%d: reset aborted a connected command\n", H_NO(cmd));
+	dprintk(NDEBUG_ABORT, "scsi%d: reset aborted a connected command\n", H_NO(cmd));
      if (hostdata->disconnected_queue)
-	ABRT_PRINTK("scsi%d: reset aborted disconnected command(s)\n", H_NO(cmd));
+	dprintk(NDEBUG_ABORT, "scsi%d: reset aborted disconnected command(s)\n", H_NO(cmd));
 
      local_irq_save(flags);
      hostdata->issue_queue = NULL;
Acked-by on v2 10/12
#13 lore raw

Re: [PATCH v2 10/12] scsi/NCR5380: remove unused macro definitions

Quoted 309 lines

Remove the unused (and divergent) debugging macro definitions from the sun3_NCR5380 and atari_NCR5380 drivers. These drivers have been converted to use the common macros in NCR5380.h.

---
  drivers/scsi/atari_scsi.h |   93 -----------------------
  drivers/scsi/sun3_scsi.h  |  181 ----------------------------------------------
  2 files changed, 274 deletions(-)

Index: linux-m68k/drivers/scsi/atari_scsi.h
===================================================================

drivers/scsi/atari_scsi.h +0 -93
@@ -80,99 +80,6 @@
  #define SCSI_RESET_HOST_RESET 0x200
  #define SCSI_RESET_ACTION   0xff
 
-/* Debugging printk definitions:
- *
- *  ARB  -> arbitration
- *  ASEN -> auto-sense
- *  DMA  -> DMA
- *  HSH  -> PIO handshake
- *  INF  -> information transfer
- *  INI  -> initialization
- *  INT  -> interrupt
- *  LNK  -> linked commands
- *  MAIN -> NCR5380_main() control flow
- *  NDAT -> no data-out phase
- *  NWR  -> no write commands
- *  PIO  -> PIO transfers
- *  PDMA -> pseudo DMA (unused on Atari)
- *  QU   -> queues
- *  RSL  -> reselections
- *  SEL  -> selections
- *  USL  -> usleep cpde (unused on Atari)
- *  LBS  -> last byte sent (unused on Atari)
- *  RSS  -> restarting of selections
- *  EXT  -> extended messages
- *  ABRT -> aborting and resetting
- *  TAG  -> queue tag handling
- *  MER  -> merging of consec. buffers
- *
- */
-
-#define dprint(flg, format...)			\
-({						\
-	if (NDEBUG & (flg))			\
-		printk(KERN_DEBUG format);	\
-})
-
-#define ARB_PRINTK(format, args...) \
-	dprint(NDEBUG_ARBITRATION, format , ## args)
-#define ASEN_PRINTK(format, args...) \
-	dprint(NDEBUG_AUTOSENSE, format , ## args)
-#define DMA_PRINTK(format, args...) \
-	dprint(NDEBUG_DMA, format , ## args)
-#define HSH_PRINTK(format, args...) \
-	dprint(NDEBUG_HANDSHAKE, format , ## args)
-#define INF_PRINTK(format, args...) \
-	dprint(NDEBUG_INFORMATION, format , ## args)
-#define INI_PRINTK(format, args...) \
-	dprint(NDEBUG_INIT, format , ## args)
-#define INT_PRINTK(format, args...) \
-	dprint(NDEBUG_INTR, format , ## args)
-#define LNK_PRINTK(format, args...) \
-	dprint(NDEBUG_LINKED, format , ## args)
-#define MAIN_PRINTK(format, args...) \
-	dprint(NDEBUG_MAIN, format , ## args)
-#define NDAT_PRINTK(format, args...) \
-	dprint(NDEBUG_NO_DATAOUT, format , ## args)
-#define NWR_PRINTK(format, args...) \
-	dprint(NDEBUG_NO_WRITE, format , ## args)
-#define PIO_PRINTK(format, args...) \
-	dprint(NDEBUG_PIO, format , ## args)
-#define PDMA_PRINTK(format, args...) \
-	dprint(NDEBUG_PSEUDO_DMA, format , ## args)
-#define QU_PRINTK(format, args...) \
-	dprint(NDEBUG_QUEUES, format , ## args)
-#define RSL_PRINTK(format, args...) \
-	dprint(NDEBUG_RESELECTION, format , ## args)
-#define SEL_PRINTK(format, args...) \
-	dprint(NDEBUG_SELECTION, format , ## args)
-#define USL_PRINTK(format, args...) \
-	dprint(NDEBUG_USLEEP, format , ## args)
-#define LBS_PRINTK(format, args...) \
-	dprint(NDEBUG_LAST_BYTE_SENT, format , ## args)
-#define RSS_PRINTK(format, args...) \
-	dprint(NDEBUG_RESTART_SELECT, format , ## args)
-#define EXT_PRINTK(format, args...) \
-	dprint(NDEBUG_EXTENDED, format , ## args)
-#define ABRT_PRINTK(format, args...) \
-	dprint(NDEBUG_ABORT, format , ## args)
-#define TAG_PRINTK(format, args...) \
-	dprint(NDEBUG_TAGS, format , ## args)
-#define MER_PRINTK(format, args...) \
-	dprint(NDEBUG_MERGING, format , ## args)
-
-/* conditional macros for NCR5380_print_{,phase,status} */
-
-#define NCR_PRINT(mask)	\
-	((NDEBUG & (mask)) ? NCR5380_print(instance) : (void)0)
-
-#define NCR_PRINT_PHASE(mask) \
-	((NDEBUG & (mask)) ? NCR5380_print_phase(instance) : (void)0)
-
-#define NCR_PRINT_STATUS(mask) \
-	((NDEBUG & (mask)) ? NCR5380_print_status(instance) : (void)0)
-
-
  #endif /* ndef ASM */
  #endif /* ATARI_SCSI_H */
 

Index: linux-m68k/drivers/scsi/sun3_scsi.h
===================================================================

drivers/scsi/sun3_scsi.h +0 -181
@@ -182,188 +182,7 @@ struct sun3_udc_regs {
 
  #define VME_DATA24 0x3d00
 
-// debugging printk's, taken from atari_scsi.h
-/* Debugging printk definitions:
- *
- *  ARB  -> arbitration
- *  ASEN -> auto-sense
- *  DMA  -> DMA
- *  HSH  -> PIO handshake
- *  INF  -> information transfer
- *  INI  -> initialization
- *  INT  -> interrupt
- *  LNK  -> linked commands
- *  MAIN -> NCR5380_main() control flow
- *  NDAT -> no data-out phase
- *  NWR  -> no write commands
- *  PIO  -> PIO transfers
- *  PDMA -> pseudo DMA (unused on Atari)
- *  QU   -> queues
- *  RSL  -> reselections
- *  SEL  -> selections
- *  USL  -> usleep cpde (unused on Atari)
- *  LBS  -> last byte sent (unused on Atari)
- *  RSS  -> restarting of selections
- *  EXT  -> extended messages
- *  ABRT -> aborting and resetting
- *  TAG  -> queue tag handling
- *  MER  -> merging of consec. buffers
- *
- */
-
  #include "NCR5380.h"
 
-#if NDEBUG & NDEBUG_ARBITRATION
-#define ARB_PRINTK(format, args...) \
-	printk(KERN_DEBUG format , ## args)
-#else
-#define ARB_PRINTK(format, args...)
-#endif
-#if NDEBUG & NDEBUG_AUTOSENSE
-#define ASEN_PRINTK(format, args...) \
-	printk(KERN_DEBUG format , ## args)
-#else
-#define ASEN_PRINTK(format, args...)
-#endif
-#if NDEBUG & NDEBUG_DMA
-#define DMA_PRINTK(format, args...) \
-	printk(KERN_DEBUG format , ## args)
-#else
-#define DMA_PRINTK(format, args...)
-#endif
-#if NDEBUG & NDEBUG_HANDSHAKE
-#define HSH_PRINTK(format, args...) \
-	printk(KERN_DEBUG format , ## args)
-#else
-#define HSH_PRINTK(format, args...)
-#endif
-#if NDEBUG & NDEBUG_INFORMATION
-#define INF_PRINTK(format, args...) \
-	printk(KERN_DEBUG format , ## args)
-#else
-#define INF_PRINTK(format, args...)
-#endif
-#if NDEBUG & NDEBUG_INIT
-#define INI_PRINTK(format, args...) \
-	printk(KERN_DEBUG format , ## args)
-#else
-#define INI_PRINTK(format, args...)
-#endif
-#if NDEBUG & NDEBUG_INTR
-#define INT_PRINTK(format, args...) \
-	printk(KERN_DEBUG format , ## args)
-#else
-#define INT_PRINTK(format, args...)
-#endif
-#if NDEBUG & NDEBUG_LINKED
-#define LNK_PRINTK(format, args...) \
-	printk(KERN_DEBUG format , ## args)
-#else
-#define LNK_PRINTK(format, args...)
-#endif
-#if NDEBUG & NDEBUG_MAIN
-#define MAIN_PRINTK(format, args...) \
-	printk(KERN_DEBUG format , ## args)
-#else
-#define MAIN_PRINTK(format, args...)
-#endif
-#if NDEBUG & NDEBUG_NO_DATAOUT
-#define NDAT_PRINTK(format, args...) \
-	printk(KERN_DEBUG format , ## args)
-#else
-#define NDAT_PRINTK(format, args...)
-#endif
-#if NDEBUG & NDEBUG_NO_WRITE
-#define NWR_PRINTK(format, args...) \
-	printk(KERN_DEBUG format , ## args)
-#else
-#define NWR_PRINTK(format, args...)
-#endif
-#if NDEBUG & NDEBUG_PIO
-#define PIO_PRINTK(format, args...) \
-	printk(KERN_DEBUG format , ## args)
-#else
-#define PIO_PRINTK(format, args...)
-#endif
-#if NDEBUG & NDEBUG_PSEUDO_DMA
-#define PDMA_PRINTK(format, args...) \
-	printk(KERN_DEBUG format , ## args)
-#else
-#define PDMA_PRINTK(format, args...)
-#endif
-#if NDEBUG & NDEBUG_QUEUES
-#define QU_PRINTK(format, args...) \
-	printk(KERN_DEBUG format , ## args)
-#else
-#define QU_PRINTK(format, args...)
-#endif
-#if NDEBUG & NDEBUG_RESELECTION
-#define RSL_PRINTK(format, args...) \
-	printk(KERN_DEBUG format , ## args)
-#else
-#define RSL_PRINTK(format, args...)
-#endif
-#if NDEBUG & NDEBUG_SELECTION
-#define SEL_PRINTK(format, args...) \
-	printk(KERN_DEBUG format , ## args)
-#else
-#define SEL_PRINTK(format, args...)
-#endif
-#if NDEBUG & NDEBUG_USLEEP
-#define USL_PRINTK(format, args...) \
-	printk(KERN_DEBUG format , ## args)
-#else
-#define USL_PRINTK(format, args...)
-#endif
-#if NDEBUG & NDEBUG_LAST_BYTE_SENT
-#define LBS_PRINTK(format, args...) \
-	printk(KERN_DEBUG format , ## args)
-#else
-#define LBS_PRINTK(format, args...)
-#endif
-#if NDEBUG & NDEBUG_RESTART_SELECT
-#define RSS_PRINTK(format, args...) \
-	printk(KERN_DEBUG format , ## args)
-#else
-#define RSS_PRINTK(format, args...)
-#endif
-#if NDEBUG & NDEBUG_EXTENDED
-#define EXT_PRINTK(format, args...) \
-	printk(KERN_DEBUG format , ## args)
-#else
-#define EXT_PRINTK(format, args...)
-#endif
-#if NDEBUG & NDEBUG_ABORT
-#define ABRT_PRINTK(format, args...) \
-	printk(KERN_DEBUG format , ## args)
-#else
-#define ABRT_PRINTK(format, args...)
-#endif
-#if NDEBUG & NDEBUG_TAGS
-#define TAG_PRINTK(format, args...) \
-	printk(KERN_DEBUG format , ## args)
-#else
-#define TAG_PRINTK(format, args...)
-#endif
-#if NDEBUG & NDEBUG_MERGING
-#define MER_PRINTK(format, args...) \
-	printk(KERN_DEBUG format , ## args)
-#else
-#define MER_PRINTK(format, args...)
-#endif
-
-/* conditional macros for NCR5380_print_{,phase,status} */
-
-#define NCR_PRINT(mask)	\
-	((NDEBUG & (mask)) ? NCR5380_print(instance) : (void)0)
-
-#define NCR_PRINT_PHASE(mask) \
-	((NDEBUG & (mask)) ? NCR5380_print_phase(instance) : (void)0)
-
-#define NCR_PRINT_STATUS(mask) \
-	((NDEBUG & (mask)) ? NCR5380_print_status(instance) : (void)0)
-
-
-
  #endif /* SUN3_NCR5380_H */
 
Acked-by on the v2 series
#16 lore raw
In reply to Finn Thain
Quoted 48 lines · Finn Thain

This patch series addresses several issues with NCR5380 drivers:

1. The complex network of #include directives.

2. Three inconsistent implementations of the core driver all attempting to share the same macro definitions in NCR5380.h.

3. Broken debugging code.

In the past these issues have led to compiler warnings and ugly hacks to fix build failures.

This patch series fixes the debugging code by reducing the divergence between the various core driver implementations.

The final two patches in the series further reduce divergence by refactoring sun3_scsi.c and sun3_scsi_vme.c so that they follow the same structure as the other NCR5380 drivers.

By the end of this patch series over 800 net lines of code have been removed. This is mostly duplicated code that's easily eliminated once the debugging code is made consistent (and some dead code is removed).

Better uniformity and less duplication should assist future work such as modernization and trivial clean-up.

To make code review easier I've tried to keep these patches succinct and free of extraneous changes. Though I did run checkpatch.pl, I've ignored whitespace issues in existing code. I will send separate patches for whitespace clean-up of NCR5380 drivers.

All NCR5380 drivers have been compile-tested with this patch series:
arm/cumana_1.c
arm/oak.c
atari_scsi.c
dmx3191d.c
dtc.c
g_NCR5380.c
g_NCR5380_mmio.c
mac_scsi.c
pas16.c
sun3_scsi.c
sun3_scsi_vme.c
t128.c

I've successfully regression tested this patch series using mac_scsi on a PowerBook 180. The debugging macros are now usable again.

maintainer
#17 lore raw
In reply to Finn Thain
Quoted 45 lines · Finn Thain

This patch series addresses several issues with NCR5380 drivers:

1. The complex network of #include directives.

2. Three inconsistent implementations of the core driver all attempting to share the same macro definitions in NCR5380.h.

3. Broken debugging code.

In the past these issues have led to compiler warnings and ugly hacks to fix build failures.

This patch series fixes the debugging code by reducing the divergence between the various core driver implementations.

The final two patches in the series further reduce divergence by refactoring sun3_scsi.c and sun3_scsi_vme.c so that they follow the same structure as the other NCR5380 drivers.

By the end of this patch series over 800 net lines of code have been removed. This is mostly duplicated code that's easily eliminated once the debugging code is made consistent (and some dead code is removed).

Better uniformity and less duplication should assist future work such as modernization and trivial clean-up.

To make code review easier I've tried to keep these patches succinct and free of extraneous changes. Though I did run checkpatch.pl, I've ignored whitespace issues in existing code. I will send separate patches for whitespace clean-up of NCR5380 drivers.

All NCR5380 drivers have been compile-tested with this patch series:
arm/cumana_1.c
arm/oak.c
atari_scsi.c
dmx3191d.c
dtc.c
g_NCR5380.c
g_NCR5380_mmio.c
mac_scsi.c
pas16.c
sun3_scsi.c
sun3_scsi_vme.c
t128.c

Quoted 2 lines

I've successfully regression tested this patch series using mac_scsi on a PowerBook 180. The debugging macros are now usable again.

OK, so this is a pretty big change to an unmaintained driver. I'll take it if you're willing to maintain the driver afterwards ... in which case I need another patch to add you to the MAINTAINERS file.

James

author
#18 lore raw
Quoted 3 lines · James Bottomley

OK, so this is a pretty big change to an unmaintained driver. I'll take it if you're willing to maintain the driver afterwards ... in which case I need another patch to add you to the MAINTAINERS file.

Sure, I'm happy to support these patches and future work I plan to do on the driver.

What additional responsibilities would come with adding my name the MAINTAINERS file?

Perhaps Michael and Sam would be interested in sharing the role, for atari and sun3 NCR5380 drivers (?)

I only have hardware to test mac_scsi but I can obtain a Domex DMX3191D PCI card on ebay.

--

#19 lore raw

Finn,

Quoted 7 lines · Finn Thain
Quoted 3 lines · James Bottomley

OK, so this is a pretty big change to an unmaintained driver. I'll take it if you're willing to maintain the driver afterwards ... in which case I need another patch to add you to the MAINTAINERS file.

Quoted 8 lines

Sure, I'm happy to support these patches and future work I plan to do on the driver.

What additional responsibilities would come with adding my name the MAINTAINERS file?

Perhaps Michael and Sam would be interested in sharing the role, for atari and sun3 NCR5380 drivers (?)

If you insist ...

(kidding - I"m OK with it if James thinks it's worth it)

Cheers,

Michael

Quoted 5 lines

I only have hardware to test mac_scsi but I can obtain a Domex DMX3191D PCI card on ebay.

--

maintainer
#20 lore raw
Quoted 16 lines · Michael Schmitz

Finn,

Quoted 13 lines · Finn Thain
Quoted 3 lines · James Bottomley

OK, so this is a pretty big change to an unmaintained driver. I'll take it if you're willing to maintain the driver afterwards ... in which case I need another patch to add you to the MAINTAINERS file.

Sure, I'm happy to support these patches and future work I plan to do on the driver.

What additional responsibilities would come with adding my name the MAINTAINERS file?

Quoted 6 lines
Quoted 2 lines

Perhaps Michael and Sam would be interested in sharing the role, for atari and sun3 NCR5380 drivers (?)

If you insist ...

(kidding - I"m OK with it if James thinks it's worth it)

As long as you understand how it works and how to fix it, the more the merrier. It gives me more people to yell at if something goes wrong with the driver.

James

#21 lore raw

Hi James,

Quoted 8 lines

Perhaps Michael and Sam would be interested in sharing the role, for atari and sun3 NCR5380 drivers (?)

Quoted 3 lines

If you insist ...

(kidding - I"m OK with it if James thinks it's worth it)

As long as you understand how it works and how to fix it, the more the merrier. It gives me more people to yell at if something goes wrong with the driver.

I used to have a fair understanding of the Atari driver years back - just need to get my head around all the midlevel and error handling changes since.

You'll be yelling at me regarding any breakage in the Atari NCR5380 driver anyway in the end - count me in.

Cheers,

Michael