Re: [PATCH v3 51/77] ncr5380: Remove command list debug code

2015-12-21 Thread Hannes Reinecke

On 12/22/2015 02:18 AM, Finn Thain wrote:

Some NCR5380 hosts offer a .show_info method to access the contents of
the various command list data structures from a procfs file. When NDEBUG
is set, the same information is sent to the console during EH.

The two core drivers, atari_NCR5380.c and NCR5380.c differ here. Because
it is just for debugging, the easiest way to fix the discrepancy is
simply remove this code.

The only remaining users of NCR5380_show_info() and NCR5380_write_info()
are drivers that define PSEUDO_DMA. The others have no use for the
.show_info method, so don't initialize it.

Signed-off-by: Finn Thain 

---
  drivers/scsi/NCR5380.c   |   70 ++--
  drivers/scsi/arm/oak.c   |2
  drivers/scsi/atari_NCR5380.c |   94 
+--
  drivers/scsi/atari_scsi.c|2
  drivers/scsi/g_NCR5380.c |1
  drivers/scsi/sun3_scsi.c |2
  6 files changed, 9 insertions(+), 162 deletions(-)


Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
--
Dr. Hannes Reinecke   zSeries & Storage
h...@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-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 51/77] ncr5380: Remove command list debug code

2015-12-21 Thread Finn Thain
Some NCR5380 hosts offer a .show_info method to access the contents of
the various command list data structures from a procfs file. When NDEBUG
is set, the same information is sent to the console during EH.

The two core drivers, atari_NCR5380.c and NCR5380.c differ here. Because
it is just for debugging, the easiest way to fix the discrepancy is
simply remove this code.

The only remaining users of NCR5380_show_info() and NCR5380_write_info()
are drivers that define PSEUDO_DMA. The others have no use for the
.show_info method, so don't initialize it.

Signed-off-by: Finn Thain 

---
 drivers/scsi/NCR5380.c   |   70 ++--
 drivers/scsi/arm/oak.c   |2 
 drivers/scsi/atari_NCR5380.c |   94 +--
 drivers/scsi/atari_scsi.c|2 
 drivers/scsi/g_NCR5380.c |1 
 drivers/scsi/sun3_scsi.c |2 
 6 files changed, 9 insertions(+), 162 deletions(-)

Index: linux/drivers/scsi/NCR5380.c
===
--- linux.orig/drivers/scsi/NCR5380.c   2015-12-22 12:16:47.0 +1100
+++ linux/drivers/scsi/NCR5380.c2015-12-22 12:16:49.0 +1100
@@ -558,22 +558,6 @@ static void prepare_info(struct Scsi_Hos
 "");
 }
 
-/**
- * NCR5380_print_status-   dump controller info
- * @instance: controller to dump
- *
- * Print commands in the various queues, called from NCR5380_abort 
- * and NCR5380_debug to aid debugging.
- *
- * Locks: called functions disable irqs
- */
-
-static void __maybe_unused NCR5380_print_status(struct Scsi_Host *instance)
-{
-   NCR5380_dprint(NDEBUG_ANY, instance);
-   NCR5380_dprint_phase(NDEBUG_ANY, instance);
-}
-
 #ifdef PSEUDO_DMA
 /**/
 /*
@@ -598,65 +582,19 @@ static int __maybe_unused NCR5380_write_
hostdata->spin_max_w = 0;
return 0;
 }
-#endif
-
-static
-void lprint_Scsi_Cmnd(struct scsi_cmnd *cmd, struct seq_file *m);
-static
-void lprint_command(unsigned char *cmd, struct seq_file *m);
-static
-void lprint_opcode(int opcode, struct seq_file *m);
 
 static int __maybe_unused NCR5380_show_info(struct seq_file *m,
struct Scsi_Host *instance)
 {
struct NCR5380_hostdata *hostdata;
-   struct scsi_cmnd *ptr;
-   unsigned long flags;
 
hostdata = (struct NCR5380_hostdata *) instance->hostdata;
 
-#ifdef PSEUDO_DMA
seq_printf(m, "Highwater I/O busy spin counts: write %d, read %d\n",
hostdata->spin_max_w, hostdata->spin_max_r);
-#endif
-   spin_lock_irqsave(&hostdata->lock, flags);
-   if (!hostdata->connected)
-   seq_printf(m, "scsi%d: no currently connected command\n", 
instance->host_no);
-   else
-   lprint_Scsi_Cmnd((struct scsi_cmnd *) hostdata->connected, m);
-   seq_printf(m, "scsi%d: issue_queue\n", instance->host_no);
-   for (ptr = (struct scsi_cmnd *) hostdata->issue_queue; ptr; ptr = 
(struct scsi_cmnd *) ptr->host_scribble)
-   lprint_Scsi_Cmnd(ptr, m);
-
-   seq_printf(m, "scsi%d: disconnected_queue\n", instance->host_no);
-   for (ptr = (struct scsi_cmnd *) hostdata->disconnected_queue; ptr; ptr 
= (struct scsi_cmnd *) ptr->host_scribble)
-   lprint_Scsi_Cmnd(ptr, m);
-   spin_unlock_irqrestore(&hostdata->lock, flags);
return 0;
 }
-
-static void lprint_Scsi_Cmnd(struct scsi_cmnd *cmd, struct seq_file *m)
-{
-   seq_printf(m, "scsi%d : destination target %d, lun %llu\n", 
cmd->device->host->host_no, cmd->device->id, cmd->device->lun);
-   seq_puts(m, "command = ");
-   lprint_command(cmd->cmnd, m);
-}
-
-static void lprint_command(unsigned char *command, struct seq_file *m)
-{
-   int i, s;
-   lprint_opcode(command[0], m);
-   for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i)
-   seq_printf(m, "%02x ", command[i]);
-   seq_putc(m, '\n');
-}
-
-static void lprint_opcode(int opcode, struct seq_file *m)
-{
-   seq_printf(m, "%2d (0x%02x)", opcode, opcode);
-}
-
+#endif
 
 /**
  * NCR5380_init-   initialise an NCR5380
@@ -2335,7 +2273,8 @@ static int NCR5380_abort(struct scsi_cmn
 
spin_lock_irqsave(&hostdata->lock, flags);
 
-   NCR5380_print_status(instance);
+   NCR5380_dprint(NDEBUG_ANY, instance);
+   NCR5380_dprint_phase(NDEBUG_ANY, instance);
 
dprintk(NDEBUG_ABORT, "scsi%d : abort called\n", instance->host_no);
dprintk(NDEBUG_ABORT, "basr 0x%X, sr 0x%X\n", 
NCR5380_read(BUS_AND_STATUS_REG), NCR5380_read(STATUS_REG));
@@ -2490,8 +2429,9 @@ static int NCR5380_bus_reset(struct scsi
 
 #if (NDEBUG & NDEBUG_ANY)
scmd_printk(KERN_INFO, cmd, "performing bus reset\n");
-   NCR5380_print_status(instance);
 #endif
+   NCR5380_dprint(NDEBUG_ANY, instance);
+   NCR5380_dprint_phase(NDEBUG_ANY, instance);
 
do_reset(instance);
 
Index: linux/drivers/sc