LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 0/7] scsi: Some seq_file cleanups/optimizations
@ 2014-11-29  0:34 Rasmus Villemoes
  2014-11-29  0:34 ` [PATCH 1/7] scsi: Remove SPRINTF macro Rasmus Villemoes
                   ` (8 more replies)
  0 siblings, 9 replies; 26+ messages in thread
From: Rasmus Villemoes @ 2014-11-29  0:34 UTC (permalink / raw)
  To: James E.J. Bottomley; +Cc: linux-scsi, linux-kernel

These patches mostly replace seq_printf with simpler and faster
equivalents, e.g. seq_printf(m, "something") => seq_puts(m,
"something") and seq_printf(m, "\n") => seq_putc(m, '\n). But before
my Coccinelle scripts could be unleashed I had to clean up some
unnecessary, and in the PRINTP case quite obfuscating, macros.

The patches don't change the semantics of the code (well, that's the
idea anyway), but should make it slightly smaller and faster.

Rasmus Villemoes (7):
  scsi: Remove SPRINTF macro
  scsi/g_NCR5380: Remove obfuscating macros
  scsi/advansys: Replace seq_printf with seq_puts
  scsi/aha152x: Replace seq_printf with seq_puts
  scsi: misc:  Replace seq_printf with seq_puts
  scsi: misc: Merge consecutive seq_puts calls
  scsi: misc: Print single-character strings with seq_putc

 drivers/scsi/BusLogic.c             |  10 +-
 drivers/scsi/NCR5380.c              |  42 +++--
 drivers/scsi/advansys.c             | 145 ++++++++---------
 drivers/scsi/aha152x.c              | 301 ++++++++++++++++++------------------
 drivers/scsi/aic7xxx/aic79xx_proc.c |  38 +++--
 drivers/scsi/aic7xxx/aic7xxx_proc.c |  24 +--
 drivers/scsi/arm/fas216.c           |   6 +-
 drivers/scsi/atari_NCR5380.c        |   4 +-
 drivers/scsi/atp870u.c              |   5 +-
 drivers/scsi/dc395x.c               |  78 +++++-----
 drivers/scsi/dpt_i2o.c              |   2 +-
 drivers/scsi/eata_pio.c             |   2 +-
 drivers/scsi/esas2r/esas2r_main.c   |   2 +-
 drivers/scsi/g_NCR5380.c            |  66 ++++----
 drivers/scsi/gdth_proc.c            |  24 +--
 drivers/scsi/in2000.c               |  18 +--
 drivers/scsi/ips.c                  |   7 +-
 drivers/scsi/megaraid.c             |   2 +-
 drivers/scsi/nsp32.c                |  41 +++--
 drivers/scsi/pcmcia/nsp_cs.c        |  50 +++---
 drivers/scsi/qla2xxx/qla_dfs.c      |   8 +-
 drivers/scsi/scsi_proc.c            |  22 +--
 drivers/scsi/scsi_trace.c           |   6 +-
 drivers/scsi/sun3_NCR5380.c         |   4 +-
 drivers/scsi/wd33c93.c              |  18 +--
 drivers/scsi/wd7000.c               |  41 +++--
 26 files changed, 460 insertions(+), 506 deletions(-)

-- 
2.0.4


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

* [PATCH 1/7] scsi: Remove SPRINTF macro
  2014-11-29  0:34 [PATCH 0/7] scsi: Some seq_file cleanups/optimizations Rasmus Villemoes
@ 2014-11-29  0:34 ` Rasmus Villemoes
  2014-11-29  0:34 ` [PATCH 2/7] scsi/g_NCR5380: Remove obfuscating macros Rasmus Villemoes
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 26+ messages in thread
From: Rasmus Villemoes @ 2014-11-29  0:34 UTC (permalink / raw)
  To: James E.J. Bottomley; +Cc: linux-scsi, linux-kernel

The macro SPRINTF doesn't save a lot of typing or make the code more
readable, and depending on a specific identifier (m) in the
surrounding scope is generally frowned upon. Nuke it.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 drivers/scsi/NCR5380.c       |  42 +++---
 drivers/scsi/aha152x.c       | 301 +++++++++++++++++++++----------------------
 drivers/scsi/dc395x.c        |  78 ++++++-----
 drivers/scsi/nsp32.c         |  41 +++---
 drivers/scsi/pcmcia/nsp_cs.c |  50 ++++---
 drivers/scsi/wd7000.c        |  41 +++---
 6 files changed, 266 insertions(+), 287 deletions(-)

diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index 45da3c8..8395930 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -698,8 +698,6 @@ static int __maybe_unused NCR5380_write_info(struct Scsi_Host *instance,
 	return (-ENOSYS);	/* Currently this is a no-op */
 }
 
-#undef SPRINTF
-#define SPRINTF(args...) seq_printf(m, ## args)
 static
 void lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, struct seq_file *m);
 static
@@ -715,45 +713,45 @@ static int __maybe_unused NCR5380_show_info(struct seq_file *m,
 
 	hostdata = (struct NCR5380_hostdata *) instance->hostdata;
 
-	SPRINTF("NCR5380 core release=%d.   ", NCR5380_PUBLIC_RELEASE);
+	seq_printf(m, "NCR5380 core release=%d.   ", NCR5380_PUBLIC_RELEASE);
 	if (((struct NCR5380_hostdata *) instance->hostdata)->flags & FLAG_NCR53C400)
-		SPRINTF("ncr53c400 release=%d.  ", NCR53C400_PUBLIC_RELEASE);
+		seq_printf(m, "ncr53c400 release=%d.  ", NCR53C400_PUBLIC_RELEASE);
 #ifdef DTC_PUBLIC_RELEASE
-	SPRINTF("DTC 3180/3280 release %d", DTC_PUBLIC_RELEASE);
+	seq_printf(m, "DTC 3180/3280 release %d", DTC_PUBLIC_RELEASE);
 #endif
 #ifdef T128_PUBLIC_RELEASE
-	SPRINTF("T128 release %d", T128_PUBLIC_RELEASE);
+	seq_printf(m, "T128 release %d", T128_PUBLIC_RELEASE);
 #endif
 #ifdef GENERIC_NCR5380_PUBLIC_RELEASE
-	SPRINTF("Generic5380 release %d", GENERIC_NCR5380_PUBLIC_RELEASE);
+	seq_printf(m, "Generic5380 release %d", GENERIC_NCR5380_PUBLIC_RELEASE);
 #endif
 #ifdef PAS16_PUBLIC_RELEASE
-	SPRINTF("PAS16 release=%d", PAS16_PUBLIC_RELEASE);
+	seq_printf(m, "PAS16 release=%d", PAS16_PUBLIC_RELEASE);
 #endif
 
-	SPRINTF("\nBase Addr: 0x%05lX    ", (long) instance->base);
-	SPRINTF("io_port: %04x      ", (int) instance->io_port);
+	seq_printf(m, "\nBase Addr: 0x%05lX    ", (long) instance->base);
+	seq_printf(m, "io_port: %04x      ", (int) instance->io_port);
 	if (instance->irq == SCSI_IRQ_NONE)
-		SPRINTF("IRQ: None.\n");
+		seq_printf(m, "IRQ: None.\n");
 	else
-		SPRINTF("IRQ: %d.\n", instance->irq);
+		seq_printf(m, "IRQ: %d.\n", instance->irq);
 
 #ifdef DTC_PUBLIC_RELEASE
-	SPRINTF("Highwater I/O busy_spin_counts -- write: %d  read: %d\n", dtc_wmaxi, dtc_maxi);
+	seq_printf(m, "Highwater I/O busy_spin_counts -- write: %d  read: %d\n", dtc_wmaxi, dtc_maxi);
 #endif
 #ifdef PAS16_PUBLIC_RELEASE
-	SPRINTF("Highwater I/O busy_spin_counts -- write: %d  read: %d\n", pas_wmaxi, pas_maxi);
+	seq_printf(m, "Highwater I/O busy_spin_counts -- write: %d  read: %d\n", pas_wmaxi, pas_maxi);
 #endif
 	spin_lock_irq(instance->host_lock);
 	if (!hostdata->connected)
-		SPRINTF("scsi%d: no currently connected command\n", instance->host_no);
+		seq_printf(m, "scsi%d: no currently connected command\n", instance->host_no);
 	else
 		lprint_Scsi_Cmnd((Scsi_Cmnd *) hostdata->connected, m);
-	SPRINTF("scsi%d: issue_queue\n", instance->host_no);
+	seq_printf(m, "scsi%d: issue_queue\n", instance->host_no);
 	for (ptr = (Scsi_Cmnd *) hostdata->issue_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble)
 		lprint_Scsi_Cmnd(ptr, m);
 
-	SPRINTF("scsi%d: disconnected_queue\n", instance->host_no);
+	seq_printf(m, "scsi%d: disconnected_queue\n", instance->host_no);
 	for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble)
 		lprint_Scsi_Cmnd(ptr, m);
 	spin_unlock_irq(instance->host_lock);
@@ -762,8 +760,8 @@ static int __maybe_unused NCR5380_show_info(struct seq_file *m,
 
 static void lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, struct seq_file *m)
 {
-	SPRINTF("scsi%d : destination target %d, lun %llu\n", cmd->device->host->host_no, cmd->device->id, cmd->device->lun);
-	SPRINTF("        command = ");
+	seq_printf(m, "scsi%d : destination target %d, lun %llu\n", cmd->device->host->host_no, cmd->device->id, cmd->device->lun);
+	seq_printf(m, "        command = ");
 	lprint_command(cmd->cmnd, m);
 }
 
@@ -772,13 +770,13 @@ 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)
-		SPRINTF("%02x ", command[i]);
-	SPRINTF("\n");
+		seq_printf(m, "%02x ", command[i]);
+	seq_printf(m, "\n");
 }
 
 static void lprint_opcode(int opcode, struct seq_file *m)
 {
-	SPRINTF("%2d (0x%02x)", opcode, opcode);
+	seq_printf(m, "%2d (0x%02x)", opcode, opcode);
 }
 
 
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index e77b72f..80823ac 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -2976,299 +2976,296 @@ static void show_queues(struct Scsi_Host *shpnt)
 	disp_enintr(shpnt);
 }
 
-#undef SPRINTF
-#define SPRINTF(args...) seq_printf(m, ##args)
-
 static void get_command(struct seq_file *m, Scsi_Cmnd * ptr)
 {
 	int i;
 
-	SPRINTF("%p: target=%d; lun=%d; cmnd=( ",
+	seq_printf(m, "%p: target=%d; lun=%d; cmnd=( ",
 		ptr, ptr->device->id, (u8)ptr->device->lun);
 
 	for (i = 0; i < COMMAND_SIZE(ptr->cmnd[0]); i++)
-		SPRINTF("0x%02x ", ptr->cmnd[i]);
+		seq_printf(m, "0x%02x ", ptr->cmnd[i]);
 
-	SPRINTF("); resid=%d; residual=%d; buffers=%d; phase |",
+	seq_printf(m, "); resid=%d; residual=%d; buffers=%d; phase |",
 		scsi_get_resid(ptr), ptr->SCp.this_residual,
 		ptr->SCp.buffers_residual);
 
 	if (ptr->SCp.phase & not_issued)
-		SPRINTF("not issued|");
+		seq_printf(m, "not issued|");
 	if (ptr->SCp.phase & selecting)
-		SPRINTF("selecting|");
+		seq_printf(m, "selecting|");
 	if (ptr->SCp.phase & disconnected)
-		SPRINTF("disconnected|");
+		seq_printf(m, "disconnected|");
 	if (ptr->SCp.phase & aborted)
-		SPRINTF("aborted|");
+		seq_printf(m, "aborted|");
 	if (ptr->SCp.phase & identified)
-		SPRINTF("identified|");
+		seq_printf(m, "identified|");
 	if (ptr->SCp.phase & completed)
-		SPRINTF("completed|");
+		seq_printf(m, "completed|");
 	if (ptr->SCp.phase & spiordy)
-		SPRINTF("spiordy|");
+		seq_printf(m, "spiordy|");
 	if (ptr->SCp.phase & syncneg)
-		SPRINTF("syncneg|");
-	SPRINTF("; next=0x%p\n", SCNEXT(ptr));
+		seq_printf(m, "syncneg|");
+	seq_printf(m, "; next=0x%p\n", SCNEXT(ptr));
 }
 
 static void get_ports(struct seq_file *m, struct Scsi_Host *shpnt)
 {
 	int s;
 
-	SPRINTF("\n%s: %s(%s) ", CURRENT_SC ? "on bus" : "waiting", states[STATE].name, states[PREVSTATE].name);
+	seq_printf(m, "\n%s: %s(%s) ", CURRENT_SC ? "on bus" : "waiting", states[STATE].name, states[PREVSTATE].name);
 
 	s = GETPORT(SCSISEQ);
-	SPRINTF("SCSISEQ( ");
+	seq_printf(m, "SCSISEQ( ");
 	if (s & TEMODEO)
-		SPRINTF("TARGET MODE ");
+		seq_printf(m, "TARGET MODE ");
 	if (s & ENSELO)
-		SPRINTF("SELO ");
+		seq_printf(m, "SELO ");
 	if (s & ENSELI)
-		SPRINTF("SELI ");
+		seq_printf(m, "SELI ");
 	if (s & ENRESELI)
-		SPRINTF("RESELI ");
+		seq_printf(m, "RESELI ");
 	if (s & ENAUTOATNO)
-		SPRINTF("AUTOATNO ");
+		seq_printf(m, "AUTOATNO ");
 	if (s & ENAUTOATNI)
-		SPRINTF("AUTOATNI ");
+		seq_printf(m, "AUTOATNI ");
 	if (s & ENAUTOATNP)
-		SPRINTF("AUTOATNP ");
+		seq_printf(m, "AUTOATNP ");
 	if (s & SCSIRSTO)
-		SPRINTF("SCSIRSTO ");
-	SPRINTF(");");
+		seq_printf(m, "SCSIRSTO ");
+	seq_printf(m, ");");
 
-	SPRINTF(" SCSISIG(");
+	seq_printf(m, " SCSISIG(");
 	s = GETPORT(SCSISIG);
 	switch (s & P_MASK) {
 	case P_DATAO:
-		SPRINTF("DATA OUT");
+		seq_printf(m, "DATA OUT");
 		break;
 	case P_DATAI:
-		SPRINTF("DATA IN");
+		seq_printf(m, "DATA IN");
 		break;
 	case P_CMD:
-		SPRINTF("COMMAND");
+		seq_printf(m, "COMMAND");
 		break;
 	case P_STATUS:
-		SPRINTF("STATUS");
+		seq_printf(m, "STATUS");
 		break;
 	case P_MSGO:
-		SPRINTF("MESSAGE OUT");
+		seq_printf(m, "MESSAGE OUT");
 		break;
 	case P_MSGI:
-		SPRINTF("MESSAGE IN");
+		seq_printf(m, "MESSAGE IN");
 		break;
 	default:
-		SPRINTF("*invalid*");
+		seq_printf(m, "*invalid*");
 		break;
 	}
 
-	SPRINTF("); ");
+	seq_printf(m, "); ");
 
-	SPRINTF("INTSTAT (%s); ", TESTHI(DMASTAT, INTSTAT) ? "hi" : "lo");
+	seq_printf(m, "INTSTAT (%s); ", TESTHI(DMASTAT, INTSTAT) ? "hi" : "lo");
 
-	SPRINTF("SSTAT( ");
+	seq_printf(m, "SSTAT( ");
 	s = GETPORT(SSTAT0);
 	if (s & TARGET)
-		SPRINTF("TARGET ");
+		seq_printf(m, "TARGET ");
 	if (s & SELDO)
-		SPRINTF("SELDO ");
+		seq_printf(m, "SELDO ");
 	if (s & SELDI)
-		SPRINTF("SELDI ");
+		seq_printf(m, "SELDI ");
 	if (s & SELINGO)
-		SPRINTF("SELINGO ");
+		seq_printf(m, "SELINGO ");
 	if (s & SWRAP)
-		SPRINTF("SWRAP ");
+		seq_printf(m, "SWRAP ");
 	if (s & SDONE)
-		SPRINTF("SDONE ");
+		seq_printf(m, "SDONE ");
 	if (s & SPIORDY)
-		SPRINTF("SPIORDY ");
+		seq_printf(m, "SPIORDY ");
 	if (s & DMADONE)
-		SPRINTF("DMADONE ");
+		seq_printf(m, "DMADONE ");
 
 	s = GETPORT(SSTAT1);
 	if (s & SELTO)
-		SPRINTF("SELTO ");
+		seq_printf(m, "SELTO ");
 	if (s & ATNTARG)
-		SPRINTF("ATNTARG ");
+		seq_printf(m, "ATNTARG ");
 	if (s & SCSIRSTI)
-		SPRINTF("SCSIRSTI ");
+		seq_printf(m, "SCSIRSTI ");
 	if (s & PHASEMIS)
-		SPRINTF("PHASEMIS ");
+		seq_printf(m, "PHASEMIS ");
 	if (s & BUSFREE)
-		SPRINTF("BUSFREE ");
+		seq_printf(m, "BUSFREE ");
 	if (s & SCSIPERR)
-		SPRINTF("SCSIPERR ");
+		seq_printf(m, "SCSIPERR ");
 	if (s & PHASECHG)
-		SPRINTF("PHASECHG ");
+		seq_printf(m, "PHASECHG ");
 	if (s & REQINIT)
-		SPRINTF("REQINIT ");
-	SPRINTF("); ");
+		seq_printf(m, "REQINIT ");
+	seq_printf(m, "); ");
 
 
-	SPRINTF("SSTAT( ");
+	seq_printf(m, "SSTAT( ");
 
 	s = GETPORT(SSTAT0) & GETPORT(SIMODE0);
 
 	if (s & TARGET)
-		SPRINTF("TARGET ");
+		seq_printf(m, "TARGET ");
 	if (s & SELDO)
-		SPRINTF("SELDO ");
+		seq_printf(m, "SELDO ");
 	if (s & SELDI)
-		SPRINTF("SELDI ");
+		seq_printf(m, "SELDI ");
 	if (s & SELINGO)
-		SPRINTF("SELINGO ");
+		seq_printf(m, "SELINGO ");
 	if (s & SWRAP)
-		SPRINTF("SWRAP ");
+		seq_printf(m, "SWRAP ");
 	if (s & SDONE)
-		SPRINTF("SDONE ");
+		seq_printf(m, "SDONE ");
 	if (s & SPIORDY)
-		SPRINTF("SPIORDY ");
+		seq_printf(m, "SPIORDY ");
 	if (s & DMADONE)
-		SPRINTF("DMADONE ");
+		seq_printf(m, "DMADONE ");
 
 	s = GETPORT(SSTAT1) & GETPORT(SIMODE1);
 
 	if (s & SELTO)
-		SPRINTF("SELTO ");
+		seq_printf(m, "SELTO ");
 	if (s & ATNTARG)
-		SPRINTF("ATNTARG ");
+		seq_printf(m, "ATNTARG ");
 	if (s & SCSIRSTI)
-		SPRINTF("SCSIRSTI ");
+		seq_printf(m, "SCSIRSTI ");
 	if (s & PHASEMIS)
-		SPRINTF("PHASEMIS ");
+		seq_printf(m, "PHASEMIS ");
 	if (s & BUSFREE)
-		SPRINTF("BUSFREE ");
+		seq_printf(m, "BUSFREE ");
 	if (s & SCSIPERR)
-		SPRINTF("SCSIPERR ");
+		seq_printf(m, "SCSIPERR ");
 	if (s & PHASECHG)
-		SPRINTF("PHASECHG ");
+		seq_printf(m, "PHASECHG ");
 	if (s & REQINIT)
-		SPRINTF("REQINIT ");
-	SPRINTF("); ");
+		seq_printf(m, "REQINIT ");
+	seq_printf(m, "); ");
 
-	SPRINTF("SXFRCTL0( ");
+	seq_printf(m, "SXFRCTL0( ");
 
 	s = GETPORT(SXFRCTL0);
 	if (s & SCSIEN)
-		SPRINTF("SCSIEN ");
+		seq_printf(m, "SCSIEN ");
 	if (s & DMAEN)
-		SPRINTF("DMAEN ");
+		seq_printf(m, "DMAEN ");
 	if (s & CH1)
-		SPRINTF("CH1 ");
+		seq_printf(m, "CH1 ");
 	if (s & CLRSTCNT)
-		SPRINTF("CLRSTCNT ");
+		seq_printf(m, "CLRSTCNT ");
 	if (s & SPIOEN)
-		SPRINTF("SPIOEN ");
+		seq_printf(m, "SPIOEN ");
 	if (s & CLRCH1)
-		SPRINTF("CLRCH1 ");
-	SPRINTF("); ");
+		seq_printf(m, "CLRCH1 ");
+	seq_printf(m, "); ");
 
-	SPRINTF("SIGNAL( ");
+	seq_printf(m, "SIGNAL( ");
 
 	s = GETPORT(SCSISIG);
 	if (s & SIG_ATNI)
-		SPRINTF("ATNI ");
+		seq_printf(m, "ATNI ");
 	if (s & SIG_SELI)
-		SPRINTF("SELI ");
+		seq_printf(m, "SELI ");
 	if (s & SIG_BSYI)
-		SPRINTF("BSYI ");
+		seq_printf(m, "BSYI ");
 	if (s & SIG_REQI)
-		SPRINTF("REQI ");
+		seq_printf(m, "REQI ");
 	if (s & SIG_ACKI)
-		SPRINTF("ACKI ");
-	SPRINTF("); ");
+		seq_printf(m, "ACKI ");
+	seq_printf(m, "); ");
 
-	SPRINTF("SELID(%02x), ", GETPORT(SELID));
+	seq_printf(m, "SELID(%02x), ", GETPORT(SELID));
 
-	SPRINTF("STCNT(%d), ", GETSTCNT());
+	seq_printf(m, "STCNT(%d), ", GETSTCNT());
 
-	SPRINTF("SSTAT2( ");
+	seq_printf(m, "SSTAT2( ");
 
 	s = GETPORT(SSTAT2);
 	if (s & SOFFSET)
-		SPRINTF("SOFFSET ");
+		seq_printf(m, "SOFFSET ");
 	if (s & SEMPTY)
-		SPRINTF("SEMPTY ");
+		seq_printf(m, "SEMPTY ");
 	if (s & SFULL)
-		SPRINTF("SFULL ");
-	SPRINTF("); SFCNT (%d); ", s & (SFULL | SFCNT));
+		seq_printf(m, "SFULL ");
+	seq_printf(m, "); SFCNT (%d); ", s & (SFULL | SFCNT));
 
 	s = GETPORT(SSTAT3);
-	SPRINTF("SCSICNT (%d), OFFCNT(%d), ", (s & 0xf0) >> 4, s & 0x0f);
+	seq_printf(m, "SCSICNT (%d), OFFCNT(%d), ", (s & 0xf0) >> 4, s & 0x0f);
 
-	SPRINTF("SSTAT4( ");
+	seq_printf(m, "SSTAT4( ");
 	s = GETPORT(SSTAT4);
 	if (s & SYNCERR)
-		SPRINTF("SYNCERR ");
+		seq_printf(m, "SYNCERR ");
 	if (s & FWERR)
-		SPRINTF("FWERR ");
+		seq_printf(m, "FWERR ");
 	if (s & FRERR)
-		SPRINTF("FRERR ");
-	SPRINTF("); ");
+		seq_printf(m, "FRERR ");
+	seq_printf(m, "); ");
 
-	SPRINTF("DMACNTRL0( ");
+	seq_printf(m, "DMACNTRL0( ");
 	s = GETPORT(DMACNTRL0);
-	SPRINTF("%s ", s & _8BIT ? "8BIT" : "16BIT");
-	SPRINTF("%s ", s & DMA ? "DMA" : "PIO");
-	SPRINTF("%s ", s & WRITE_READ ? "WRITE" : "READ");
+	seq_printf(m, "%s ", s & _8BIT ? "8BIT" : "16BIT");
+	seq_printf(m, "%s ", s & DMA ? "DMA" : "PIO");
+	seq_printf(m, "%s ", s & WRITE_READ ? "WRITE" : "READ");
 	if (s & ENDMA)
-		SPRINTF("ENDMA ");
+		seq_printf(m, "ENDMA ");
 	if (s & INTEN)
-		SPRINTF("INTEN ");
+		seq_printf(m, "INTEN ");
 	if (s & RSTFIFO)
-		SPRINTF("RSTFIFO ");
+		seq_printf(m, "RSTFIFO ");
 	if (s & SWINT)
-		SPRINTF("SWINT ");
-	SPRINTF("); ");
+		seq_printf(m, "SWINT ");
+	seq_printf(m, "); ");
 
-	SPRINTF("DMASTAT( ");
+	seq_printf(m, "DMASTAT( ");
 	s = GETPORT(DMASTAT);
 	if (s & ATDONE)
-		SPRINTF("ATDONE ");
+		seq_printf(m, "ATDONE ");
 	if (s & WORDRDY)
-		SPRINTF("WORDRDY ");
+		seq_printf(m, "WORDRDY ");
 	if (s & DFIFOFULL)
-		SPRINTF("DFIFOFULL ");
+		seq_printf(m, "DFIFOFULL ");
 	if (s & DFIFOEMP)
-		SPRINTF("DFIFOEMP ");
-	SPRINTF(")\n");
+		seq_printf(m, "DFIFOEMP ");
+	seq_printf(m, ")\n");
 
-	SPRINTF("enabled interrupts( ");
+	seq_printf(m, "enabled interrupts( ");
 
 	s = GETPORT(SIMODE0);
 	if (s & ENSELDO)
-		SPRINTF("ENSELDO ");
+		seq_printf(m, "ENSELDO ");
 	if (s & ENSELDI)
-		SPRINTF("ENSELDI ");
+		seq_printf(m, "ENSELDI ");
 	if (s & ENSELINGO)
-		SPRINTF("ENSELINGO ");
+		seq_printf(m, "ENSELINGO ");
 	if (s & ENSWRAP)
-		SPRINTF("ENSWRAP ");
+		seq_printf(m, "ENSWRAP ");
 	if (s & ENSDONE)
-		SPRINTF("ENSDONE ");
+		seq_printf(m, "ENSDONE ");
 	if (s & ENSPIORDY)
-		SPRINTF("ENSPIORDY ");
+		seq_printf(m, "ENSPIORDY ");
 	if (s & ENDMADONE)
-		SPRINTF("ENDMADONE ");
+		seq_printf(m, "ENDMADONE ");
 
 	s = GETPORT(SIMODE1);
 	if (s & ENSELTIMO)
-		SPRINTF("ENSELTIMO ");
+		seq_printf(m, "ENSELTIMO ");
 	if (s & ENATNTARG)
-		SPRINTF("ENATNTARG ");
+		seq_printf(m, "ENATNTARG ");
 	if (s & ENPHASEMIS)
-		SPRINTF("ENPHASEMIS ");
+		seq_printf(m, "ENPHASEMIS ");
 	if (s & ENBUSFREE)
-		SPRINTF("ENBUSFREE ");
+		seq_printf(m, "ENBUSFREE ");
 	if (s & ENSCSIPERR)
-		SPRINTF("ENSCSIPERR ");
+		seq_printf(m, "ENSCSIPERR ");
 	if (s & ENPHASECHG)
-		SPRINTF("ENPHASECHG ");
+		seq_printf(m, "ENPHASECHG ");
 	if (s & ENREQINIT)
-		SPRINTF("ENREQINIT ");
-	SPRINTF(")\n");
+		seq_printf(m, "ENREQINIT ");
+	seq_printf(m, ")\n");
 }
 
 static int aha152x_set_info(struct Scsi_Host *shpnt, char *buffer, int length)
@@ -3320,24 +3317,24 @@ static int aha152x_show_info(struct seq_file *m, struct Scsi_Host *shpnt)
 	Scsi_Cmnd *ptr;
 	unsigned long flags;
 
-	SPRINTF(AHA152X_REVID "\n");
+	seq_printf(m, AHA152X_REVID "\n");
 
-	SPRINTF("ioports 0x%04lx to 0x%04lx\n",
+	seq_printf(m, "ioports 0x%04lx to 0x%04lx\n",
 		shpnt->io_port, shpnt->io_port + shpnt->n_io_port - 1);
-	SPRINTF("interrupt 0x%02x\n", shpnt->irq);
-	SPRINTF("disconnection/reconnection %s\n",
+	seq_printf(m, "interrupt 0x%02x\n", shpnt->irq);
+	seq_printf(m, "disconnection/reconnection %s\n",
 		RECONNECT ? "enabled" : "disabled");
-	SPRINTF("parity checking %s\n",
+	seq_printf(m, "parity checking %s\n",
 		PARITY ? "enabled" : "disabled");
-	SPRINTF("synchronous transfers %s\n",
+	seq_printf(m, "synchronous transfers %s\n",
 		SYNCHRONOUS ? "enabled" : "disabled");
-	SPRINTF("%d commands currently queued\n", HOSTDATA(shpnt)->commands);
+	seq_printf(m, "%d commands currently queued\n", HOSTDATA(shpnt)->commands);
 
 	if(SYNCHRONOUS) {
-		SPRINTF("synchronously operating targets (tick=50 ns):\n");
+		seq_printf(m, "synchronously operating targets (tick=50 ns):\n");
 		for (i = 0; i < 8; i++)
 			if (HOSTDATA(shpnt)->syncrate[i] & 0x7f)
-				SPRINTF("target %d: period %dT/%dns; req/ack offset %d\n",
+				seq_printf(m, "target %d: period %dT/%dns; req/ack offset %d\n",
 					i,
 					(((HOSTDATA(shpnt)->syncrate[i] & 0x70) >> 4) + 2),
 					(((HOSTDATA(shpnt)->syncrate[i] & 0x70) >> 4) + 2) * 50,
@@ -3345,9 +3342,9 @@ static int aha152x_show_info(struct seq_file *m, struct Scsi_Host *shpnt)
 	}
 #if defined(AHA152X_DEBUG)
 #define PDEBUG(flags,txt) \
-	if(HOSTDATA(shpnt)->debug & flags) SPRINTF("(%s) ", txt);
+	if (HOSTDATA(shpnt)->debug & flags) seq_printf(m, "(%s) ", txt);
 
-	SPRINTF("enabled debugging options: ");
+	seq_printf(m, "enabled debugging options: ");
 
 	PDEBUG(debug_procinfo, "procinfo");
 	PDEBUG(debug_queue, "queue");
@@ -3363,36 +3360,36 @@ static int aha152x_show_info(struct seq_file *m, struct Scsi_Host *shpnt)
 	PDEBUG(debug_locking, "locks");
 	PDEBUG(debug_phases, "phases");
 
-	SPRINTF("\n");
+	seq_printf(m, "\n");
 #endif
 
-	SPRINTF("\nqueue status:\n");
+	seq_printf(m, "\nqueue status:\n");
 	DO_LOCK(flags);
 	if (ISSUE_SC) {
-		SPRINTF("not yet issued commands:\n");
+		seq_printf(m, "not yet issued commands:\n");
 		for (ptr = ISSUE_SC; ptr; ptr = SCNEXT(ptr))
 			get_command(m, ptr);
 	} else
-		SPRINTF("no not yet issued commands\n");
+		seq_printf(m, "no not yet issued commands\n");
 	DO_UNLOCK(flags);
 
 	if (CURRENT_SC) {
-		SPRINTF("current command:\n");
+		seq_printf(m, "current command:\n");
 		get_command(m, CURRENT_SC);
 	} else
-		SPRINTF("no current command\n");
+		seq_printf(m, "no current command\n");
 
 	if (DISCONNECTED_SC) {
-		SPRINTF("disconnected commands:\n");
+		seq_printf(m, "disconnected commands:\n");
 		for (ptr = DISCONNECTED_SC; ptr; ptr = SCNEXT(ptr))
 			get_command(m, ptr);
 	} else
-		SPRINTF("no disconnected commands\n");
+		seq_printf(m, "no disconnected commands\n");
 
 	get_ports(m, shpnt);
 
 #if defined(AHA152X_STAT)
-	SPRINTF("statistics:\n"
+	seq_printf(m, "statistics:\n"
 	        "total commands:               %d\n"
 	        "disconnections:               %d\n"
 		"busfree with check condition: %d\n"
@@ -3412,7 +3409,7 @@ static int aha152x_show_info(struct seq_file *m, struct Scsi_Host *shpnt)
 		HOSTDATA(shpnt)->busfree_without_done_command,
 		HOSTDATA(shpnt)->busfree_without_any_action);
 	for(i=0; i<maxstate; i++) {
-		SPRINTF("%-10s %-12d %-12d %-12ld\n",
+		seq_printf(m, "%-10s %-12d %-12d %-12ld\n",
 		        states[i].name,
 			HOSTDATA(shpnt)->count_trans[i],
 			HOSTDATA(shpnt)->count[i],
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
index 0c6be0a..0a1ed50 100644
--- a/drivers/scsi/dc395x.c
+++ b/drivers/scsi/dc395x.c
@@ -4610,13 +4610,10 @@ static void adapter_uninit(struct AdapterCtlBlk *acb)
 }
 
 
-#undef SPRINTF
-#define SPRINTF(args...) seq_printf(m,##args)
-
 #undef YESNO
 #define YESNO(YN) \
- if (YN) SPRINTF(" Yes ");\
- else SPRINTF(" No  ")
+ if (YN) seq_printf(m, " Yes ");\
+ else seq_printf(m, " No  ")
 
 static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
 {
@@ -4626,47 +4623,44 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
 	unsigned long flags;
 	int dev;
 
-	SPRINTF(DC395X_BANNER " PCI SCSI Host Adapter\n");
-	SPRINTF(" Driver Version " DC395X_VERSION "\n");
+	seq_printf(m, DC395X_BANNER " PCI SCSI Host Adapter\n");
+	seq_printf(m, " Driver Version " DC395X_VERSION "\n");
 
 	DC395x_LOCK_IO(acb->scsi_host, flags);
 
-	SPRINTF("SCSI Host Nr %i, ", host->host_no);
-	SPRINTF("DC395U/UW/F DC315/U %s\n",
+	seq_printf(m, "SCSI Host Nr %i, ", host->host_no);
+	seq_printf(m, "DC395U/UW/F DC315/U %s\n",
 		(acb->config & HCC_WIDE_CARD) ? "Wide" : "");
-	SPRINTF("io_port_base 0x%04lx, ", acb->io_port_base);
-	SPRINTF("irq_level 0x%04x, ", acb->irq_level);
-	SPRINTF(" SelTimeout %ims\n", (1638 * acb->sel_timeout) / 1000);
+	seq_printf(m, "io_port_base 0x%04lx, ", acb->io_port_base);
+	seq_printf(m, "irq_level 0x%04x, ", acb->irq_level);
+	seq_printf(m, " SelTimeout %ims\n", (1638 * acb->sel_timeout) / 1000);
 
-	SPRINTF("MaxID %i, MaxLUN %llu, ", host->max_id, host->max_lun);
-	SPRINTF("AdapterID %i\n", host->this_id);
+	seq_printf(m, "MaxID %i, MaxLUN %llu, ", host->max_id, host->max_lun);
+	seq_printf(m, "AdapterID %i\n", host->this_id);
 
-	SPRINTF("tag_max_num %i", acb->tag_max_num);
-	/*SPRINTF(", DMA_Status %i\n", DC395x_read8(acb, TRM_S1040_DMA_STATUS)); */
-	SPRINTF(", FilterCfg 0x%02x",
+	seq_printf(m, "tag_max_num %i", acb->tag_max_num);
+	/*seq_printf(m, ", DMA_Status %i\n", DC395x_read8(acb, TRM_S1040_DMA_STATUS)); */
+	seq_printf(m, ", FilterCfg 0x%02x",
 		DC395x_read8(acb, TRM_S1040_SCSI_CONFIG1));
-	SPRINTF(", DelayReset %is\n", acb->eeprom.delay_time);
-	/*SPRINTF("\n"); */
+	seq_printf(m, ", DelayReset %is\n", acb->eeprom.delay_time);
+	/*seq_printf(m, "\n"); */
 
-	SPRINTF("Nr of DCBs: %i\n", list_size(&acb->dcb_list));
-	SPRINTF
-	    ("Map of attached LUNs: %02x %02x %02x %02x %02x %02x %02x %02x\n",
+	seq_printf(m, "Nr of DCBs: %i\n", list_size(&acb->dcb_list));
+	seq_printf(m, "Map of attached LUNs: %02x %02x %02x %02x %02x %02x %02x %02x\n",
 	     acb->dcb_map[0], acb->dcb_map[1], acb->dcb_map[2],
 	     acb->dcb_map[3], acb->dcb_map[4], acb->dcb_map[5],
 	     acb->dcb_map[6], acb->dcb_map[7]);
-	SPRINTF
-	    ("                      %02x %02x %02x %02x %02x %02x %02x %02x\n",
+	seq_printf(m, "                      %02x %02x %02x %02x %02x %02x %02x %02x\n",
 	     acb->dcb_map[8], acb->dcb_map[9], acb->dcb_map[10],
 	     acb->dcb_map[11], acb->dcb_map[12], acb->dcb_map[13],
 	     acb->dcb_map[14], acb->dcb_map[15]);
 
-	SPRINTF
-	    ("Un ID LUN Prty Sync Wide DsCn SndS TagQ nego_period SyncFreq SyncOffs MaxCmd\n");
+	seq_printf(m, "Un ID LUN Prty Sync Wide DsCn SndS TagQ nego_period SyncFreq SyncOffs MaxCmd\n");
 
 	dev = 0;
 	list_for_each_entry(dcb, &acb->dcb_list, list) {
 		int nego_period;
-		SPRINTF("%02i %02i  %02i ", dev, dcb->target_id,
+		seq_printf(m, "%02i %02i  %02i ", dev, dcb->target_id,
 			dcb->target_lun);
 		YESNO(dcb->dev_mode & NTC_DO_PARITY_CHK);
 		YESNO(dcb->sync_offset);
@@ -4676,53 +4670,53 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
 		YESNO(dcb->sync_mode & EN_TAG_QUEUEING);
 		nego_period = clock_period[dcb->sync_period & 0x07] << 2;
 		if (dcb->sync_offset)
-			SPRINTF("  %03i ns ", nego_period);
+			seq_printf(m, "  %03i ns ", nego_period);
 		else
-			SPRINTF(" (%03i ns)", (dcb->min_nego_period << 2));
+			seq_printf(m, " (%03i ns)", (dcb->min_nego_period << 2));
 
 		if (dcb->sync_offset & 0x0f) {
 			spd = 1000 / (nego_period);
 			spd1 = 1000 % (nego_period);
 			spd1 = (spd1 * 10 + nego_period / 2) / (nego_period);
-			SPRINTF("   %2i.%1i M     %02i ", spd, spd1,
+			seq_printf(m, "   %2i.%1i M     %02i ", spd, spd1,
 				(dcb->sync_offset & 0x0f));
 		} else
-			SPRINTF("                 ");
+			seq_printf(m, "                 ");
 
 		/* Add more info ... */
-		SPRINTF("     %02i\n", dcb->max_command);
+		seq_printf(m, "     %02i\n", dcb->max_command);
 		dev++;
 	}
 
 	if (timer_pending(&acb->waiting_timer))
-		SPRINTF("Waiting queue timer running\n");
+		seq_printf(m, "Waiting queue timer running\n");
 	else
-		SPRINTF("\n");
+		seq_printf(m, "\n");
 
 	list_for_each_entry(dcb, &acb->dcb_list, list) {
 		struct ScsiReqBlk *srb;
 		if (!list_empty(&dcb->srb_waiting_list))
-			SPRINTF("DCB (%02i-%i): Waiting: %i:",
+			seq_printf(m, "DCB (%02i-%i): Waiting: %i:",
 				dcb->target_id, dcb->target_lun,
 				list_size(&dcb->srb_waiting_list));
                 list_for_each_entry(srb, &dcb->srb_waiting_list, list)
-			SPRINTF(" %p", srb->cmd);
+			seq_printf(m, " %p", srb->cmd);
 		if (!list_empty(&dcb->srb_going_list))
-			SPRINTF("\nDCB (%02i-%i): Going  : %i:",
+			seq_printf(m, "\nDCB (%02i-%i): Going  : %i:",
 				dcb->target_id, dcb->target_lun,
 				list_size(&dcb->srb_going_list));
 		list_for_each_entry(srb, &dcb->srb_going_list, list)
-			SPRINTF(" %p", srb->cmd);
+			seq_printf(m, " %p", srb->cmd);
 		if (!list_empty(&dcb->srb_waiting_list) || !list_empty(&dcb->srb_going_list))
-			SPRINTF("\n");
+			seq_printf(m, "\n");
 	}
 
 	if (debug_enabled(DBG_1)) {
-		SPRINTF("DCB list for ACB %p:\n", acb);
+		seq_printf(m, "DCB list for ACB %p:\n", acb);
 		list_for_each_entry(dcb, &acb->dcb_list, list) {
-			SPRINTF("%p -> ", dcb);
+			seq_printf(m, "%p -> ", dcb);
 		}
-		SPRINTF("END\n");
+		seq_printf(m, "END\n");
 	}
 
 	DC395x_UNLOCK_IO(acb->scsi_host, flags);
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
index 90abb03..3e77551 100644
--- a/drivers/scsi/nsp32.c
+++ b/drivers/scsi/nsp32.c
@@ -1441,8 +1441,6 @@ static irqreturn_t do_nsp32_isr(int irq, void *dev_id)
 	return IRQ_RETVAL(handled);
 }
 
-#undef SPRINTF
-#define SPRINTF(args...) seq_printf(m, ##args)
 
 static int nsp32_show_info(struct seq_file *m, struct Scsi_Host *host)
 {
@@ -1458,64 +1456,63 @@ static int nsp32_show_info(struct seq_file *m, struct Scsi_Host *host)
 	data = (nsp32_hw_data *)host->hostdata;
 	base = host->io_port;
 
-	SPRINTF("NinjaSCSI-32 status\n\n");
-	SPRINTF("Driver version:        %s, $Revision: 1.33 $\n", nsp32_release_version);
-	SPRINTF("SCSI host No.:         %d\n",		hostno);
-	SPRINTF("IRQ:                   %d\n",		host->irq);
-	SPRINTF("IO:                    0x%lx-0x%lx\n", host->io_port, host->io_port + host->n_io_port - 1);
-	SPRINTF("MMIO(virtual address): 0x%lx-0x%lx\n",	host->base, host->base + data->MmioLength - 1);
-	SPRINTF("sg_tablesize:          %d\n",		host->sg_tablesize);
-	SPRINTF("Chip revision:         0x%x\n",       	(nsp32_read2(base, INDEX_REG) >> 8) & 0xff);
+	seq_printf(m, "NinjaSCSI-32 status\n\n");
+	seq_printf(m, "Driver version:        %s, $Revision: 1.33 $\n", nsp32_release_version);
+	seq_printf(m, "SCSI host No.:         %d\n",		hostno);
+	seq_printf(m, "IRQ:                   %d\n",		host->irq);
+	seq_printf(m, "IO:                    0x%lx-0x%lx\n", host->io_port, host->io_port + host->n_io_port - 1);
+	seq_printf(m, "MMIO(virtual address): 0x%lx-0x%lx\n",	host->base, host->base + data->MmioLength - 1);
+	seq_printf(m, "sg_tablesize:          %d\n",		host->sg_tablesize);
+	seq_printf(m, "Chip revision:         0x%x\n",		(nsp32_read2(base, INDEX_REG) >> 8) & 0xff);
 
 	mode_reg = nsp32_index_read1(base, CHIP_MODE);
 	model    = data->pci_devid->driver_data;
 
 #ifdef CONFIG_PM
-	SPRINTF("Power Management:      %s\n",          (mode_reg & OPTF) ? "yes" : "no");
+	seq_printf(m, "Power Management:      %s\n",          (mode_reg & OPTF) ? "yes" : "no");
 #endif
-	SPRINTF("OEM:                   %ld, %s\n",     (mode_reg & (OEM0|OEM1)), nsp32_model[model]);
+	seq_printf(m, "OEM:                   %ld, %s\n",     (mode_reg & (OEM0|OEM1)), nsp32_model[model]);
 
 	spin_lock_irqsave(&(data->Lock), flags);
-	SPRINTF("CurrentSC:             0x%p\n\n",      data->CurrentSC);
+	seq_printf(m, "CurrentSC:             0x%p\n\n",      data->CurrentSC);
 	spin_unlock_irqrestore(&(data->Lock), flags);
 
 
-	SPRINTF("SDTR status\n");
+	seq_printf(m, "SDTR status\n");
 	for (id = 0; id < ARRAY_SIZE(data->target); id++) {
 
-                SPRINTF("id %d: ", id);
+		seq_printf(m, "id %d: ", id);
 
 		if (id == host->this_id) {
-			SPRINTF("----- NinjaSCSI-32 host adapter\n");
+			seq_printf(m, "----- NinjaSCSI-32 host adapter\n");
 			continue;
 		}
 
 		if (data->target[id].sync_flag == SDTR_DONE) {
 			if (data->target[id].period == 0            &&
 			    data->target[id].offset == ASYNC_OFFSET ) {
-				SPRINTF("async");
+				seq_printf(m, "async");
 			} else {
-				SPRINTF(" sync");
+				seq_printf(m, " sync");
 			}
 		} else {
-			SPRINTF(" none");
+			seq_printf(m, " none");
 		}
 
 		if (data->target[id].period != 0) {
 
 			speed = 1000000 / (data->target[id].period * 4);
 
-			SPRINTF(" transfer %d.%dMB/s, offset %d",
+			seq_printf(m, " transfer %d.%dMB/s, offset %d",
 				speed / 1000,
 				speed % 1000,
 				data->target[id].offset
 				);
 		}
-		SPRINTF("\n");
+		seq_printf(m, "\n");
 	}
 	return 0;
 }
-#undef SPRINTF
 
 
 
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index 34aad32..83db942 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -1364,9 +1364,6 @@ static const char *nsp_info(struct Scsi_Host *shpnt)
 	return data->nspinfo;
 }
 
-#undef SPRINTF
-#define SPRINTF(args...) seq_printf(m, ##args)
-
 static int nsp_show_info(struct seq_file *m, struct Scsi_Host *host)
 {
 	int id;
@@ -1378,75 +1375,74 @@ static int nsp_show_info(struct seq_file *m, struct Scsi_Host *host)
 	hostno = host->host_no;
 	data = (nsp_hw_data *)host->hostdata;
 
-	SPRINTF("NinjaSCSI status\n\n");
-	SPRINTF("Driver version:        $Revision: 1.23 $\n");
-	SPRINTF("SCSI host No.:         %d\n",          hostno);
-	SPRINTF("IRQ:                   %d\n",          host->irq);
-	SPRINTF("IO:                    0x%lx-0x%lx\n", host->io_port, host->io_port + host->n_io_port - 1);
-	SPRINTF("MMIO(virtual address): 0x%lx-0x%lx\n", host->base, host->base + data->MmioLength - 1);
-	SPRINTF("sg_tablesize:          %d\n",          host->sg_tablesize);
+	seq_printf(m, "NinjaSCSI status\n\n");
+	seq_printf(m, "Driver version:        $Revision: 1.23 $\n");
+	seq_printf(m, "SCSI host No.:         %d\n",          hostno);
+	seq_printf(m, "IRQ:                   %d\n",          host->irq);
+	seq_printf(m, "IO:                    0x%lx-0x%lx\n", host->io_port, host->io_port + host->n_io_port - 1);
+	seq_printf(m, "MMIO(virtual address): 0x%lx-0x%lx\n", host->base, host->base + data->MmioLength - 1);
+	seq_printf(m, "sg_tablesize:          %d\n",          host->sg_tablesize);
 
-	SPRINTF("burst transfer mode:   ");
+	seq_printf(m, "burst transfer mode:   ");
 	switch (nsp_burst_mode) {
 	case BURST_IO8:
-		SPRINTF("io8");
+		seq_printf(m, "io8");
 		break;
 	case BURST_IO32:
-		SPRINTF("io32");
+		seq_printf(m, "io32");
 		break;
 	case BURST_MEM32:
-		SPRINTF("mem32");
+		seq_printf(m, "mem32");
 		break;
 	default:
-		SPRINTF("???");
+		seq_printf(m, "???");
 		break;
 	}
-	SPRINTF("\n");
+	seq_printf(m, "\n");
 
 
 	spin_lock_irqsave(&(data->Lock), flags);
-	SPRINTF("CurrentSC:             0x%p\n\n",      data->CurrentSC);
+	seq_printf(m, "CurrentSC:             0x%p\n\n",      data->CurrentSC);
 	spin_unlock_irqrestore(&(data->Lock), flags);
 
-	SPRINTF("SDTR status\n");
+	seq_printf(m, "SDTR status\n");
 	for(id = 0; id < ARRAY_SIZE(data->Sync); id++) {
 
-		SPRINTF("id %d: ", id);
+		seq_printf(m, "id %d: ", id);
 
 		if (id == host->this_id) {
-			SPRINTF("----- NinjaSCSI-3 host adapter\n");
+			seq_printf(m, "----- NinjaSCSI-3 host adapter\n");
 			continue;
 		}
 
 		switch(data->Sync[id].SyncNegotiation) {
 		case SYNC_OK:
-			SPRINTF(" sync");
+			seq_printf(m, " sync");
 			break;
 		case SYNC_NG:
-			SPRINTF("async");
+			seq_printf(m, "async");
 			break;
 		case SYNC_NOT_YET:
-			SPRINTF(" none");
+			seq_printf(m, " none");
 			break;
 		default:
-			SPRINTF("?????");
+			seq_printf(m, "?????");
 			break;
 		}
 
 		if (data->Sync[id].SyncPeriod != 0) {
 			speed = 1000000 / (data->Sync[id].SyncPeriod * 4);
 
-			SPRINTF(" transfer %d.%dMB/s, offset %d",
+			seq_printf(m, " transfer %d.%dMB/s, offset %d",
 				speed / 1000,
 				speed % 1000,
 				data->Sync[id].SyncOffset
 				);
 		}
-		SPRINTF("\n");
+		seq_printf(m, "\n");
 	}
 	return 0;
 }
-#undef SPRINTF
 
 /*---------------------------------------------------------------*/
 /* error handler                                                 */
diff --git a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c
index 3267423..6f5adaa 100644
--- a/drivers/scsi/wd7000.c
+++ b/drivers/scsi/wd7000.c
@@ -1295,9 +1295,6 @@ static void wd7000_revision(Adapter * host)
 }
 
 
-#undef SPRINTF
-#define SPRINTF(args...) { seq_printf(m, ## args); }
-
 static int wd7000_set_info(struct Scsi_Host *host, char *buffer, int length)
 {
 	dprintk("Buffer = <%.*s>, length = %d\n", length, buffer, length);
@@ -1320,43 +1317,43 @@ static int wd7000_show_info(struct seq_file *m, struct Scsi_Host *host)
 #endif
 
 	spin_lock_irqsave(host->host_lock, flags);
-	SPRINTF("Host scsi%d: Western Digital WD-7000 (rev %d.%d)\n", host->host_no, adapter->rev1, adapter->rev2);
-	SPRINTF("  IO base:      0x%x\n", adapter->iobase);
-	SPRINTF("  IRQ:          %d\n", adapter->irq);
-	SPRINTF("  DMA channel:  %d\n", adapter->dma);
-	SPRINTF("  Interrupts:   %d\n", adapter->int_counter);
-	SPRINTF("  BUS_ON time:  %d nanoseconds\n", adapter->bus_on * 125);
-	SPRINTF("  BUS_OFF time: %d nanoseconds\n", adapter->bus_off * 125);
+	seq_printf(m, "Host scsi%d: Western Digital WD-7000 (rev %d.%d)\n", host->host_no, adapter->rev1, adapter->rev2);
+	seq_printf(m, "  IO base:      0x%x\n", adapter->iobase);
+	seq_printf(m, "  IRQ:          %d\n", adapter->irq);
+	seq_printf(m, "  DMA channel:  %d\n", adapter->dma);
+	seq_printf(m, "  Interrupts:   %d\n", adapter->int_counter);
+	seq_printf(m, "  BUS_ON time:  %d nanoseconds\n", adapter->bus_on * 125);
+	seq_printf(m, "  BUS_OFF time: %d nanoseconds\n", adapter->bus_off * 125);
 
 #ifdef WD7000_DEBUG
 	ogmbs = adapter->mb.ogmb;
 	icmbs = adapter->mb.icmb;
 
-	SPRINTF("\nControl port value: 0x%x\n", adapter->control);
-	SPRINTF("Incoming mailbox:\n");
-	SPRINTF("  size: %d\n", ICMB_CNT);
-	SPRINTF("  queued messages: ");
+	seq_printf(m, "\nControl port value: 0x%x\n", adapter->control);
+	seq_printf(m, "Incoming mailbox:\n");
+	seq_printf(m, "  size: %d\n", ICMB_CNT);
+	seq_printf(m, "  queued messages: ");
 
 	for (i = count = 0; i < ICMB_CNT; i++)
 		if (icmbs[i].status) {
 			count++;
-			SPRINTF("0x%x ", i);
+			seq_printf(m, "0x%x ", i);
 		}
 
-	SPRINTF(count ? "\n" : "none\n");
+	seq_printf(m, count ? "\n" : "none\n");
 
-	SPRINTF("Outgoing mailbox:\n");
-	SPRINTF("  size: %d\n", OGMB_CNT);
-	SPRINTF("  next message: 0x%x\n", adapter->next_ogmb);
-	SPRINTF("  queued messages: ");
+	seq_printf(m, "Outgoing mailbox:\n");
+	seq_printf(m, "  size: %d\n", OGMB_CNT);
+	seq_printf(m, "  next message: 0x%x\n", adapter->next_ogmb);
+	seq_printf(m, "  queued messages: ");
 
 	for (i = count = 0; i < OGMB_CNT; i++)
 		if (ogmbs[i].status) {
 			count++;
-			SPRINTF("0x%x ", i);
+			seq_printf(m, "0x%x ", i);
 		}
 
-	SPRINTF(count ? "\n" : "none\n");
+	seq_printf(m, count ? "\n" : "none\n");
 #endif
 
 	spin_unlock_irqrestore(host->host_lock, flags);
-- 
2.0.4


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

* [PATCH 2/7] scsi/g_NCR5380: Remove obfuscating macros
  2014-11-29  0:34 [PATCH 0/7] scsi: Some seq_file cleanups/optimizations Rasmus Villemoes
  2014-11-29  0:34 ` [PATCH 1/7] scsi: Remove SPRINTF macro Rasmus Villemoes
@ 2014-11-29  0:34 ` Rasmus Villemoes
  2014-11-29  0:34 ` [PATCH 3/7] scsi/advansys: Replace seq_printf with seq_puts Rasmus Villemoes
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 26+ messages in thread
From: Rasmus Villemoes @ 2014-11-29  0:34 UTC (permalink / raw)
  To: James E.J. Bottomley; +Cc: linux-scsi, linux-kernel

The macros PRINTP/ANDP make the code harder to read and depend on a
specific identifier name in the surrounding scope. Nuke them.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 drivers/scsi/g_NCR5380.c | 66 ++++++++++++++++++++++--------------------------
 1 file changed, 30 insertions(+), 36 deletions(-)

diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index b331272..802b64c 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -741,12 +741,9 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src,
  
 #include "NCR5380.c"
 
-#define PRINTP(x) seq_printf(m, x)
-#define ANDP ,
-
 static void sprint_opcode(struct seq_file *m, int opcode)
 {
-	PRINTP("0x%02x " ANDP opcode);
+	seq_printf(m, "0x%02x ", opcode);
 }
 
 static void sprint_command(struct seq_file *m, unsigned char *command)
@@ -754,8 +751,8 @@ static void sprint_command(struct seq_file *m, unsigned char *command)
 	int i, s;
 	sprint_opcode(m, command[0]);
 	for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i)
-		PRINTP("%02x " ANDP command[i]);
-	PRINTP("\n");
+		seq_printf(m, "%02x ", command[i]);
+	seq_printf(m, "\n");
 }
 
 /**
@@ -768,8 +765,8 @@ static void sprint_command(struct seq_file *m, unsigned char *command)
 
 static void sprint_Scsi_Cmnd(struct seq_file *m, Scsi_Cmnd * cmd)
 {
-	PRINTP("host number %d destination target %d, lun %llu\n" ANDP cmd->device->host->host_no ANDP cmd->device->id ANDP cmd->device->lun);
-	PRINTP("        command = ");
+	seq_printf(m, "host number %d destination target %d, lun %llu\n", cmd->device->host->host_no, cmd->device->id, cmd->device->lun);
+	seq_printf(m, "        command = ");
 	sprint_command(m, cmd->cmnd);
 }
 
@@ -806,40 +803,40 @@ static int generic_NCR5380_show_info(struct seq_file *m, struct Scsi_Host *scsi_
 	hostdata = (struct NCR5380_hostdata *) scsi_ptr->hostdata;
 
 	spin_lock_irqsave(scsi_ptr->host_lock, flags);
-	PRINTP("SCSI host number %d : %s\n" ANDP scsi_ptr->host_no ANDP scsi_ptr->hostt->name);
-	PRINTP("Generic NCR5380 driver version %d\n" ANDP GENERIC_NCR5380_PUBLIC_RELEASE);
-	PRINTP("NCR5380 core version %d\n" ANDP NCR5380_PUBLIC_RELEASE);
+	seq_printf(m, "SCSI host number %d : %s\n", scsi_ptr->host_no, scsi_ptr->hostt->name);
+	seq_printf(m, "Generic NCR5380 driver version %d\n", GENERIC_NCR5380_PUBLIC_RELEASE);
+	seq_printf(m, "NCR5380 core version %d\n", NCR5380_PUBLIC_RELEASE);
 #ifdef NCR53C400
-	PRINTP("NCR53C400 extension version %d\n" ANDP NCR53C400_PUBLIC_RELEASE);
-	PRINTP("NCR53C400 card%s detected\n" ANDP(((struct NCR5380_hostdata *) scsi_ptr->hostdata)->flags & FLAG_NCR53C400) ? "" : " not");
+	seq_printf(m, "NCR53C400 extension version %d\n", NCR53C400_PUBLIC_RELEASE);
+	seq_printf(m, "NCR53C400 card%s detected\n", (((struct NCR5380_hostdata *) scsi_ptr->hostdata)->flags & FLAG_NCR53C400) ? "" : " not");
 # if NCR53C400_PSEUDO_DMA
-	PRINTP("NCR53C400 pseudo DMA used\n");
+	seq_printf(m, "NCR53C400 pseudo DMA used\n");
 # endif
 #else
-	PRINTP("NO NCR53C400 driver extensions\n");
+	seq_printf(m, "NO NCR53C400 driver extensions\n");
 #endif
-	PRINTP("Using %s mapping at %s 0x%lx, " ANDP STRVAL(NCR5380_map_config) ANDP STRVAL(NCR5380_map_name) ANDP scsi_ptr->NCR5380_instance_name);
+	seq_printf(m, "Using %s mapping at %s 0x%lx, ", STRVAL(NCR5380_map_config), STRVAL(NCR5380_map_name), scsi_ptr->NCR5380_instance_name);
 	if (scsi_ptr->irq == SCSI_IRQ_NONE)
-		PRINTP("no interrupt\n");
+		seq_printf(m, "no interrupt\n");
 	else
-		PRINTP("on interrupt %d\n" ANDP scsi_ptr->irq);
+		seq_printf(m, "on interrupt %d\n", scsi_ptr->irq);
 
 #ifdef NCR5380_STATS
 	if (hostdata->connected || hostdata->issue_queue || hostdata->disconnected_queue)
-		PRINTP("There are commands pending, transfer rates may be crud\n");
+		seq_printf(m, "There are commands pending, transfer rates may be crud\n");
 	if (hostdata->pendingr)
-		PRINTP("  %d pending reads" ANDP hostdata->pendingr);
+		seq_printf(m, "  %d pending reads", hostdata->pendingr);
 	if (hostdata->pendingw)
-		PRINTP("  %d pending writes" ANDP hostdata->pendingw);
+		seq_printf(m, "  %d pending writes", hostdata->pendingw);
 	if (hostdata->pendingr || hostdata->pendingw)
-		PRINTP("\n");
+		seq_printf(m, "\n");
 	shost_for_each_device(dev, scsi_ptr) {
 		unsigned long br = hostdata->bytes_read[dev->id];
 		unsigned long bw = hostdata->bytes_write[dev->id];
 		long tr = hostdata->time_read[dev->id] / HZ;
 		long tw = hostdata->time_write[dev->id] / HZ;
 
-		PRINTP("  T:%d %s " ANDP dev->id ANDP scsi_device_type(dev->type));
+		seq_printf(m, "  T:%d %s ", dev->id, scsi_device_type(dev->type));
 		for (i = 0; i < 8; i++)
 			if (dev->vendor[i] >= 0x20)
 				seq_putc(m, dev->vendor[i]);
@@ -853,37 +850,37 @@ static int generic_NCR5380_show_info(struct seq_file *m, struct Scsi_Host *scsi_
 				seq_putc(m, dev->rev[i]);
 		seq_putc(m, ' ');
 
-		PRINTP("\n%10ld kb read    in %5ld secs" ANDP br / 1024 ANDP tr);
+		seq_printf(m, "\n%10ld kb read    in %5ld secs", br / 1024, tr);
 		if (tr)
-			PRINTP(" @ %5ld bps" ANDP br / tr);
+			seq_printf(m, " @ %5ld bps", br / tr);
 
-		PRINTP("\n%10ld kb written in %5ld secs" ANDP bw / 1024 ANDP tw);
+		seq_printf(m, "\n%10ld kb written in %5ld secs", bw / 1024, tw);
 		if (tw)
-			PRINTP(" @ %5ld bps" ANDP bw / tw);
-		PRINTP("\n");
+			seq_printf(m, " @ %5ld bps", bw / tw);
+		seq_printf(m, "\n");
 	}
 #endif
 
 	status = NCR5380_read(STATUS_REG);
 	if (!(status & SR_REQ))
-		PRINTP("REQ not asserted, phase unknown.\n");
+		seq_printf(m, "REQ not asserted, phase unknown.\n");
 	else {
 		for (i = 0; (phases[i].value != PHASE_UNKNOWN) && (phases[i].value != (status & PHASE_MASK)); ++i);
-		PRINTP("Phase %s\n" ANDP phases[i].name);
+		seq_printf(m, "Phase %s\n", phases[i].name);
 	}
 
 	if (!hostdata->connected) {
-		PRINTP("No currently connected command\n");
+		seq_printf(m, "No currently connected command\n");
 	} else {
 		sprint_Scsi_Cmnd(m, (Scsi_Cmnd *) hostdata->connected);
 	}
 
-	PRINTP("issue_queue\n");
+	seq_printf(m, "issue_queue\n");
 
 	for (ptr = (Scsi_Cmnd *) hostdata->issue_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble)
 		sprint_Scsi_Cmnd(m, ptr);
 
-	PRINTP("disconnected_queue\n");
+	seq_printf(m, "disconnected_queue\n");
 
 	for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble)
 		sprint_Scsi_Cmnd(m, ptr);
@@ -892,9 +889,6 @@ static int generic_NCR5380_show_info(struct seq_file *m, struct Scsi_Host *scsi_
 	return 0;
 }
 
-#undef PRINTP
-#undef ANDP
-
 static struct scsi_host_template driver_template = {
 	.show_info      	= generic_NCR5380_show_info,
 	.name           	= "Generic NCR5380/NCR53C400 Scsi Driver",
-- 
2.0.4


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

* [PATCH 3/7] scsi/advansys: Replace seq_printf with seq_puts
  2014-11-29  0:34 [PATCH 0/7] scsi: Some seq_file cleanups/optimizations Rasmus Villemoes
  2014-11-29  0:34 ` [PATCH 1/7] scsi: Remove SPRINTF macro Rasmus Villemoes
  2014-11-29  0:34 ` [PATCH 2/7] scsi/g_NCR5380: Remove obfuscating macros Rasmus Villemoes
@ 2014-11-29  0:34 ` Rasmus Villemoes
  2014-11-29  0:34 ` [PATCH 4/7] scsi/aha152x: " Rasmus Villemoes
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 26+ messages in thread
From: Rasmus Villemoes @ 2014-11-29  0:34 UTC (permalink / raw)
  To: James E.J. Bottomley; +Cc: linux-scsi, linux-kernel

Using seq_printf to print a simple string is a lot more expensive than
it needs to be, since seq_puts exists. Replace seq_printf with
seq_puts when possible.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 drivers/scsi/advansys.c | 157 ++++++++++++++++++++++++------------------------
 1 file changed, 77 insertions(+), 80 deletions(-)

diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 43761c1..720faea 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -2880,7 +2880,7 @@ static void asc_prt_board_devices(struct seq_file *m, struct Scsi_Host *shost)
 		chip_scsi_id = boardp->dvc_var.adv_dvc_var.chip_scsi_id;
 	}
 
-	seq_printf(m, "Target IDs Detected:");
+	seq_puts(m, "Target IDs Detected:");
 	for (i = 0; i <= ADV_MAX_TID; i++) {
 		if (boardp->init_tidmask & ADV_TID_TO_TIDMASK(i))
 			seq_printf(m, " %X,", i);
@@ -2896,18 +2896,18 @@ static void asc_prt_adv_bios(struct seq_file *m, struct Scsi_Host *shost)
 	struct asc_board *boardp = shost_priv(shost);
 	ushort major, minor, letter;
 
-	seq_printf(m, "\nROM BIOS Version: ");
+	seq_puts(m, "\nROM BIOS Version: ");
 
 	/*
 	 * If the BIOS saved a valid signature, then fill in
 	 * the BIOS code segment base address.
 	 */
 	if (boardp->bios_signature != 0x55AA) {
-		seq_printf(m, "Disabled or Pre-3.1\n");
-		seq_printf(m,
-			  "BIOS either disabled or Pre-3.1. If it is pre-3.1, then a newer version\n");
-		seq_printf(m,
-			  "can be found at the ConnectCom FTP site: ftp://ftp.connectcom.net/pub\n");
+		seq_puts(m, "Disabled or Pre-3.1\n");
+		seq_puts(m,
+			 "BIOS either disabled or Pre-3.1. If it is pre-3.1, then a newer version\n");
+		seq_puts(m,
+			 "can be found at the ConnectCom FTP site: ftp://ftp.connectcom.net/pub\n");
 	} else {
 		major = (boardp->bios_version >> 12) & 0xF;
 		minor = (boardp->bios_version >> 8) & 0xF;
@@ -2923,10 +2923,9 @@ static void asc_prt_adv_bios(struct seq_file *m, struct Scsi_Host *shost)
 		 */
 		if (major < 3 || (major <= 3 && minor < 1) ||
 		    (major <= 3 && minor <= 1 && letter < ('I' - 'A'))) {
-			seq_printf(m,
-				   "Newer version of ROM BIOS is available at the ConnectCom FTP site:\n");
-			seq_printf(m,
-				   "ftp://ftp.connectcom.net/pub\n");
+			seq_puts(m,
+				 "Newer version of ROM BIOS is available at the ConnectCom FTP site:\n");
+			seq_puts(m, "ftp://ftp.connectcom.net/pub\n");
 		}
 	}
 }
@@ -3056,11 +3055,10 @@ static void asc_prt_asc_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 	    == ASC_TRUE)
 		seq_printf(m, " Serial Number: %s\n", serialstr);
 	else if (ep->adapter_info[5] == 0xBB)
-		seq_printf(m,
-			   " Default Settings Used for EEPROM-less Adapter.\n");
+		seq_puts(m,
+			 " Default Settings Used for EEPROM-less Adapter.\n");
 	else
-		seq_printf(m,
-			   " Serial Number Signature Not Present.\n");
+		seq_puts(m, " Serial Number Signature Not Present.\n");
 
 	seq_printf(m,
 		   " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n",
@@ -3070,34 +3068,34 @@ static void asc_prt_asc_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 	seq_printf(m,
 		   " cntl 0x%x, no_scam 0x%x\n", ep->cntl, ep->no_scam);
 
-	seq_printf(m, " Target ID:           ");
+	seq_puts(m, " Target ID:           ");
 	for (i = 0; i <= ASC_MAX_TID; i++)
 		seq_printf(m, " %d", i);
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
-	seq_printf(m, " Disconnects:         ");
+	seq_puts(m, " Disconnects:         ");
 	for (i = 0; i <= ASC_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (ep->disc_enable & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
-	seq_printf(m, " Command Queuing:     ");
+	seq_puts(m, " Command Queuing:     ");
 	for (i = 0; i <= ASC_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (ep->use_cmd_qng & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
-	seq_printf(m, " Start Motor:         ");
+	seq_puts(m, " Start Motor:         ");
 	for (i = 0; i <= ASC_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (ep->start_motor & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
-	seq_printf(m, " Synchronous Transfer:");
+	seq_puts(m, " Synchronous Transfer:");
 	for (i = 0; i <= ASC_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (ep->init_sdtr & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 #ifdef CONFIG_ISA
 	if (asc_dvc_varp->bus_type & ASC_IS_ISA) {
@@ -3151,7 +3149,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 	if (asc_get_eeprom_string(wordp, serialstr) == ASC_TRUE)
 		seq_printf(m, " Serial Number: %s\n", serialstr);
 	else
-		seq_printf(m, " Serial Number Signature Not Present.\n");
+		seq_puts(m, " Serial Number Signature Not Present.\n");
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550)
 		seq_printf(m,
@@ -3209,10 +3207,10 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 			   ep_38C1600->termination_lvd, termstr,
 			   ep_38C1600->bios_ctrl);
 
-	seq_printf(m, " Target ID:           ");
+	seq_puts(m, " Target ID:           ");
 	for (i = 0; i <= ADV_MAX_TID; i++)
 		seq_printf(m, " %X", i);
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
 		word = ep_3550->disc_enable;
@@ -3221,11 +3219,11 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 	} else {
 		word = ep_38C1600->disc_enable;
 	}
-	seq_printf(m, " Disconnects:         ");
+	seq_puts(m, " Disconnects:         ");
 	for (i = 0; i <= ADV_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
 		word = ep_3550->tagqng_able;
@@ -3234,11 +3232,11 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 	} else {
 		word = ep_38C1600->tagqng_able;
 	}
-	seq_printf(m, " Command Queuing:     ");
+	seq_puts(m, " Command Queuing:     ");
 	for (i = 0; i <= ADV_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
 		word = ep_3550->start_motor;
@@ -3247,28 +3245,28 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 	} else {
 		word = ep_38C1600->start_motor;
 	}
-	seq_printf(m, " Start Motor:         ");
+	seq_puts(m, " Start Motor:         ");
 	for (i = 0; i <= ADV_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
-		seq_printf(m, " Synchronous Transfer:");
+		seq_puts(m, " Synchronous Transfer:");
 		for (i = 0; i <= ADV_MAX_TID; i++)
 			seq_printf(m, " %c",
 				   (ep_3550->sdtr_able & ADV_TID_TO_TIDMASK(i)) ?
 				   'Y' : 'N');
-		seq_printf(m, "\n");
+		seq_puts(m, "\n");
 	}
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
-		seq_printf(m, " Ultra Transfer:      ");
+		seq_puts(m, " Ultra Transfer:      ");
 		for (i = 0; i <= ADV_MAX_TID; i++)
 			seq_printf(m, " %c",
 				   (ep_3550->ultra_able & ADV_TID_TO_TIDMASK(i))
 				   ? 'Y' : 'N');
-		seq_printf(m, "\n");
+		seq_puts(m, "\n");
 	}
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
@@ -3278,16 +3276,15 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 	} else {
 		word = ep_38C1600->wdtr_able;
 	}
-	seq_printf(m, " Wide Transfer:       ");
+	seq_puts(m, " Wide Transfer:       ");
 	for (i = 0; i <= ADV_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800 ||
 	    adv_dvc_varp->chip_type == ADV_CHIP_ASC38C1600) {
-		seq_printf(m,
-			   " Synchronous Transfer Speed (Mhz):\n  ");
+		seq_puts(m, " Synchronous Transfer Speed (Mhz):\n  ");
 		for (i = 0; i <= ADV_MAX_TID; i++) {
 			char *speed_str;
 
@@ -3325,10 +3322,10 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 			}
 			seq_printf(m, "%X:%s ", i, speed_str);
 			if (i == 7)
-				seq_printf(m, "\n  ");
+				seq_puts(m, "\n  ");
 			sdtr_speed >>= 4;
 		}
-		seq_printf(m, "\n");
+		seq_puts(m, "\n");
 	}
 }
 
@@ -3403,7 +3400,7 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
 	seq_printf(m,
 		   " Total Command Pending: %d\n", v->cur_total_qng);
 
-	seq_printf(m, " Command Queuing:");
+	seq_puts(m, " Command Queuing:");
 	for (i = 0; i <= ASC_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3413,10 +3410,10 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
 			   i,
 			   (v->use_tagged_qng & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	/* Current number of commands waiting for a device. */
-	seq_printf(m, " Command Queue Pending:");
+	seq_puts(m, " Command Queue Pending:");
 	for (i = 0; i <= ASC_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3424,10 +3421,10 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
 		}
 		seq_printf(m, " %X:%u", i, v->cur_dvc_qng[i]);
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	/* Current limit on number of commands that can be sent to a device. */
-	seq_printf(m, " Command Queue Limit:");
+	seq_puts(m, " Command Queue Limit:");
 	for (i = 0; i <= ASC_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3435,10 +3432,10 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
 		}
 		seq_printf(m, " %X:%u", i, v->max_dvc_qng[i]);
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	/* Indicate whether the device has returned queue full status. */
-	seq_printf(m, " Command Queue Full:");
+	seq_puts(m, " Command Queue Full:");
 	for (i = 0; i <= ASC_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3450,9 +3447,9 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
 		else
 			seq_printf(m, " %X:N", i);
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
-	seq_printf(m, " Synchronous Transfer:");
+	seq_puts(m, " Synchronous Transfer:");
 	for (i = 0; i <= ASC_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3462,7 +3459,7 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
 			   i,
 			   (v->sdtr_done & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	for (i = 0; i <= ASC_MAX_TID; i++) {
 		uchar syn_period_ix;
@@ -3476,7 +3473,7 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
 		seq_printf(m, "  %X:", i);
 
 		if ((boardp->sdtr_data[i] & ASC_SYN_MAX_OFFSET) == 0) {
-			seq_printf(m, " Asynchronous");
+			seq_puts(m, " Asynchronous");
 		} else {
 			syn_period_ix =
 			    (boardp->sdtr_data[i] >> 4) & (v->max_sdtr_index -
@@ -3494,16 +3491,16 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
 		}
 
 		if ((v->sdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) {
-			seq_printf(m, "*\n");
+			seq_puts(m, "*\n");
 			renegotiate = 1;
 		} else {
-			seq_printf(m, "\n");
+			seq_puts(m, "\n");
 		}
 	}
 
 	if (renegotiate) {
-		seq_printf(m,
-			   " * = Re-negotiation pending before next command.\n");
+		seq_puts(m,
+			 " * = Re-negotiation pending before next command.\n");
 	}
 }
 
@@ -3548,7 +3545,7 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 		   c->mcode_date, c->mcode_version);
 
 	AdvReadWordLram(iop_base, ASC_MC_TAGQNG_ABLE, tagqng_able);
-	seq_printf(m, " Queuing Enabled:");
+	seq_puts(m, " Queuing Enabled:");
 	for (i = 0; i <= ADV_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3559,9 +3556,9 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 			   i,
 			   (tagqng_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
-	seq_printf(m, " Queue Limit:");
+	seq_puts(m, " Queue Limit:");
 	for (i = 0; i <= ADV_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3573,9 +3570,9 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 
 		seq_printf(m, " %X:%d", i, lrambyte);
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
-	seq_printf(m, " Command Pending:");
+	seq_puts(m, " Command Pending:");
 	for (i = 0; i <= ADV_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3587,10 +3584,10 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 
 		seq_printf(m, " %X:%d", i, lrambyte);
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able);
-	seq_printf(m, " Wide Enabled:");
+	seq_puts(m, " Wide Enabled:");
 	for (i = 0; i <= ADV_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3601,10 +3598,10 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 			   i,
 			   (wdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	AdvReadWordLram(iop_base, ASC_MC_WDTR_DONE, wdtr_done);
-	seq_printf(m, " Transfer Bit Width:");
+	seq_puts(m, " Transfer Bit Width:");
 	for (i = 0; i <= ADV_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3620,14 +3617,14 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 
 		if ((wdtr_able & ADV_TID_TO_TIDMASK(i)) &&
 		    (wdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) {
-			seq_printf(m, "*");
+			seq_puts(m, "*");
 			renegotiate = 1;
 		}
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able);
-	seq_printf(m, " Synchronous Enabled:");
+	seq_puts(m, " Synchronous Enabled:");
 	for (i = 0; i <= ADV_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3638,7 +3635,7 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 			   i,
 			   (sdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	AdvReadWordLram(iop_base, ASC_MC_SDTR_DONE, sdtr_done);
 	for (i = 0; i <= ADV_MAX_TID; i++) {
@@ -3657,14 +3654,14 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 		seq_printf(m, "  %X:", i);
 
 		if ((lramword & 0x1F) == 0) {	/* Check for REQ/ACK Offset 0. */
-			seq_printf(m, " Asynchronous");
+			seq_puts(m, " Asynchronous");
 		} else {
-			seq_printf(m, " Transfer Period Factor: ");
+			seq_puts(m, " Transfer Period Factor: ");
 
 			if ((lramword & 0x1F00) == 0x1100) {	/* 80 Mhz */
-				seq_printf(m, "9 (80.0 Mhz),");
+				seq_puts(m, "9 (80.0 Mhz),");
 			} else if ((lramword & 0x1F00) == 0x1000) {	/* 40 Mhz */
-				seq_printf(m, "10 (40.0 Mhz),");
+				seq_puts(m, "10 (40.0 Mhz),");
 			} else {	/* 20 Mhz or below. */
 
 				period = (((lramword >> 8) * 25) + 50) / 4;
@@ -3684,16 +3681,16 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 		}
 
 		if ((sdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) {
-			seq_printf(m, "*\n");
+			seq_puts(m, "*\n");
 			renegotiate = 1;
 		} else {
-			seq_printf(m, "\n");
+			seq_puts(m, "\n");
 		}
 	}
 
 	if (renegotiate) {
-		seq_printf(m,
-			   " * = Re-negotiation pending before next command.\n");
+		seq_puts(m,
+			 " * = Re-negotiation pending before next command.\n");
 	}
 }
 
-- 
2.0.4


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

* [PATCH 4/7] scsi/aha152x: Replace seq_printf with seq_puts
  2014-11-29  0:34 [PATCH 0/7] scsi: Some seq_file cleanups/optimizations Rasmus Villemoes
                   ` (2 preceding siblings ...)
  2014-11-29  0:34 ` [PATCH 3/7] scsi/advansys: Replace seq_printf with seq_puts Rasmus Villemoes
@ 2014-11-29  0:34 ` Rasmus Villemoes
  2014-11-29  0:34 ` [PATCH 5/7] scsi: misc: " Rasmus Villemoes
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 26+ messages in thread
From: Rasmus Villemoes @ 2014-11-29  0:34 UTC (permalink / raw)
  To: James E.J. Bottomley; +Cc: linux-scsi, linux-kernel

Using seq_printf to print a simple string is a lot more expensive than
it needs to be, since seq_puts exists. Replace seq_printf with
seq_puts when possible.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 drivers/scsi/aha152x.c | 252 ++++++++++++++++++++++++-------------------------
 1 file changed, 126 insertions(+), 126 deletions(-)

diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index 80823ac..05cad58 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -2991,21 +2991,21 @@ static void get_command(struct seq_file *m, Scsi_Cmnd * ptr)
 		ptr->SCp.buffers_residual);
 
 	if (ptr->SCp.phase & not_issued)
-		seq_printf(m, "not issued|");
+		seq_puts(m, "not issued|");
 	if (ptr->SCp.phase & selecting)
-		seq_printf(m, "selecting|");
+		seq_puts(m, "selecting|");
 	if (ptr->SCp.phase & disconnected)
-		seq_printf(m, "disconnected|");
+		seq_puts(m, "disconnected|");
 	if (ptr->SCp.phase & aborted)
-		seq_printf(m, "aborted|");
+		seq_puts(m, "aborted|");
 	if (ptr->SCp.phase & identified)
-		seq_printf(m, "identified|");
+		seq_puts(m, "identified|");
 	if (ptr->SCp.phase & completed)
-		seq_printf(m, "completed|");
+		seq_puts(m, "completed|");
 	if (ptr->SCp.phase & spiordy)
-		seq_printf(m, "spiordy|");
+		seq_puts(m, "spiordy|");
 	if (ptr->SCp.phase & syncneg)
-		seq_printf(m, "syncneg|");
+		seq_puts(m, "syncneg|");
 	seq_printf(m, "; next=0x%p\n", SCNEXT(ptr));
 }
 
@@ -3016,256 +3016,256 @@ static void get_ports(struct seq_file *m, struct Scsi_Host *shpnt)
 	seq_printf(m, "\n%s: %s(%s) ", CURRENT_SC ? "on bus" : "waiting", states[STATE].name, states[PREVSTATE].name);
 
 	s = GETPORT(SCSISEQ);
-	seq_printf(m, "SCSISEQ( ");
+	seq_puts(m, "SCSISEQ( ");
 	if (s & TEMODEO)
-		seq_printf(m, "TARGET MODE ");
+		seq_puts(m, "TARGET MODE ");
 	if (s & ENSELO)
-		seq_printf(m, "SELO ");
+		seq_puts(m, "SELO ");
 	if (s & ENSELI)
-		seq_printf(m, "SELI ");
+		seq_puts(m, "SELI ");
 	if (s & ENRESELI)
-		seq_printf(m, "RESELI ");
+		seq_puts(m, "RESELI ");
 	if (s & ENAUTOATNO)
-		seq_printf(m, "AUTOATNO ");
+		seq_puts(m, "AUTOATNO ");
 	if (s & ENAUTOATNI)
-		seq_printf(m, "AUTOATNI ");
+		seq_puts(m, "AUTOATNI ");
 	if (s & ENAUTOATNP)
-		seq_printf(m, "AUTOATNP ");
+		seq_puts(m, "AUTOATNP ");
 	if (s & SCSIRSTO)
-		seq_printf(m, "SCSIRSTO ");
-	seq_printf(m, ");");
+		seq_puts(m, "SCSIRSTO ");
+	seq_puts(m, ");");
 
-	seq_printf(m, " SCSISIG(");
+	seq_puts(m, " SCSISIG(");
 	s = GETPORT(SCSISIG);
 	switch (s & P_MASK) {
 	case P_DATAO:
-		seq_printf(m, "DATA OUT");
+		seq_puts(m, "DATA OUT");
 		break;
 	case P_DATAI:
-		seq_printf(m, "DATA IN");
+		seq_puts(m, "DATA IN");
 		break;
 	case P_CMD:
-		seq_printf(m, "COMMAND");
+		seq_puts(m, "COMMAND");
 		break;
 	case P_STATUS:
-		seq_printf(m, "STATUS");
+		seq_puts(m, "STATUS");
 		break;
 	case P_MSGO:
-		seq_printf(m, "MESSAGE OUT");
+		seq_puts(m, "MESSAGE OUT");
 		break;
 	case P_MSGI:
-		seq_printf(m, "MESSAGE IN");
+		seq_puts(m, "MESSAGE IN");
 		break;
 	default:
-		seq_printf(m, "*invalid*");
+		seq_puts(m, "*invalid*");
 		break;
 	}
 
-	seq_printf(m, "); ");
+	seq_puts(m, "); ");
 
 	seq_printf(m, "INTSTAT (%s); ", TESTHI(DMASTAT, INTSTAT) ? "hi" : "lo");
 
-	seq_printf(m, "SSTAT( ");
+	seq_puts(m, "SSTAT( ");
 	s = GETPORT(SSTAT0);
 	if (s & TARGET)
-		seq_printf(m, "TARGET ");
+		seq_puts(m, "TARGET ");
 	if (s & SELDO)
-		seq_printf(m, "SELDO ");
+		seq_puts(m, "SELDO ");
 	if (s & SELDI)
-		seq_printf(m, "SELDI ");
+		seq_puts(m, "SELDI ");
 	if (s & SELINGO)
-		seq_printf(m, "SELINGO ");
+		seq_puts(m, "SELINGO ");
 	if (s & SWRAP)
-		seq_printf(m, "SWRAP ");
+		seq_puts(m, "SWRAP ");
 	if (s & SDONE)
-		seq_printf(m, "SDONE ");
+		seq_puts(m, "SDONE ");
 	if (s & SPIORDY)
-		seq_printf(m, "SPIORDY ");
+		seq_puts(m, "SPIORDY ");
 	if (s & DMADONE)
-		seq_printf(m, "DMADONE ");
+		seq_puts(m, "DMADONE ");
 
 	s = GETPORT(SSTAT1);
 	if (s & SELTO)
-		seq_printf(m, "SELTO ");
+		seq_puts(m, "SELTO ");
 	if (s & ATNTARG)
-		seq_printf(m, "ATNTARG ");
+		seq_puts(m, "ATNTARG ");
 	if (s & SCSIRSTI)
-		seq_printf(m, "SCSIRSTI ");
+		seq_puts(m, "SCSIRSTI ");
 	if (s & PHASEMIS)
-		seq_printf(m, "PHASEMIS ");
+		seq_puts(m, "PHASEMIS ");
 	if (s & BUSFREE)
-		seq_printf(m, "BUSFREE ");
+		seq_puts(m, "BUSFREE ");
 	if (s & SCSIPERR)
-		seq_printf(m, "SCSIPERR ");
+		seq_puts(m, "SCSIPERR ");
 	if (s & PHASECHG)
-		seq_printf(m, "PHASECHG ");
+		seq_puts(m, "PHASECHG ");
 	if (s & REQINIT)
-		seq_printf(m, "REQINIT ");
-	seq_printf(m, "); ");
+		seq_puts(m, "REQINIT ");
+	seq_puts(m, "); ");
 
 
-	seq_printf(m, "SSTAT( ");
+	seq_puts(m, "SSTAT( ");
 
 	s = GETPORT(SSTAT0) & GETPORT(SIMODE0);
 
 	if (s & TARGET)
-		seq_printf(m, "TARGET ");
+		seq_puts(m, "TARGET ");
 	if (s & SELDO)
-		seq_printf(m, "SELDO ");
+		seq_puts(m, "SELDO ");
 	if (s & SELDI)
-		seq_printf(m, "SELDI ");
+		seq_puts(m, "SELDI ");
 	if (s & SELINGO)
-		seq_printf(m, "SELINGO ");
+		seq_puts(m, "SELINGO ");
 	if (s & SWRAP)
-		seq_printf(m, "SWRAP ");
+		seq_puts(m, "SWRAP ");
 	if (s & SDONE)
-		seq_printf(m, "SDONE ");
+		seq_puts(m, "SDONE ");
 	if (s & SPIORDY)
-		seq_printf(m, "SPIORDY ");
+		seq_puts(m, "SPIORDY ");
 	if (s & DMADONE)
-		seq_printf(m, "DMADONE ");
+		seq_puts(m, "DMADONE ");
 
 	s = GETPORT(SSTAT1) & GETPORT(SIMODE1);
 
 	if (s & SELTO)
-		seq_printf(m, "SELTO ");
+		seq_puts(m, "SELTO ");
 	if (s & ATNTARG)
-		seq_printf(m, "ATNTARG ");
+		seq_puts(m, "ATNTARG ");
 	if (s & SCSIRSTI)
-		seq_printf(m, "SCSIRSTI ");
+		seq_puts(m, "SCSIRSTI ");
 	if (s & PHASEMIS)
-		seq_printf(m, "PHASEMIS ");
+		seq_puts(m, "PHASEMIS ");
 	if (s & BUSFREE)
-		seq_printf(m, "BUSFREE ");
+		seq_puts(m, "BUSFREE ");
 	if (s & SCSIPERR)
-		seq_printf(m, "SCSIPERR ");
+		seq_puts(m, "SCSIPERR ");
 	if (s & PHASECHG)
-		seq_printf(m, "PHASECHG ");
+		seq_puts(m, "PHASECHG ");
 	if (s & REQINIT)
-		seq_printf(m, "REQINIT ");
-	seq_printf(m, "); ");
+		seq_puts(m, "REQINIT ");
+	seq_puts(m, "); ");
 
-	seq_printf(m, "SXFRCTL0( ");
+	seq_puts(m, "SXFRCTL0( ");
 
 	s = GETPORT(SXFRCTL0);
 	if (s & SCSIEN)
-		seq_printf(m, "SCSIEN ");
+		seq_puts(m, "SCSIEN ");
 	if (s & DMAEN)
-		seq_printf(m, "DMAEN ");
+		seq_puts(m, "DMAEN ");
 	if (s & CH1)
-		seq_printf(m, "CH1 ");
+		seq_puts(m, "CH1 ");
 	if (s & CLRSTCNT)
-		seq_printf(m, "CLRSTCNT ");
+		seq_puts(m, "CLRSTCNT ");
 	if (s & SPIOEN)
-		seq_printf(m, "SPIOEN ");
+		seq_puts(m, "SPIOEN ");
 	if (s & CLRCH1)
-		seq_printf(m, "CLRCH1 ");
-	seq_printf(m, "); ");
+		seq_puts(m, "CLRCH1 ");
+	seq_puts(m, "); ");
 
-	seq_printf(m, "SIGNAL( ");
+	seq_puts(m, "SIGNAL( ");
 
 	s = GETPORT(SCSISIG);
 	if (s & SIG_ATNI)
-		seq_printf(m, "ATNI ");
+		seq_puts(m, "ATNI ");
 	if (s & SIG_SELI)
-		seq_printf(m, "SELI ");
+		seq_puts(m, "SELI ");
 	if (s & SIG_BSYI)
-		seq_printf(m, "BSYI ");
+		seq_puts(m, "BSYI ");
 	if (s & SIG_REQI)
-		seq_printf(m, "REQI ");
+		seq_puts(m, "REQI ");
 	if (s & SIG_ACKI)
-		seq_printf(m, "ACKI ");
-	seq_printf(m, "); ");
+		seq_puts(m, "ACKI ");
+	seq_puts(m, "); ");
 
 	seq_printf(m, "SELID(%02x), ", GETPORT(SELID));
 
 	seq_printf(m, "STCNT(%d), ", GETSTCNT());
 
-	seq_printf(m, "SSTAT2( ");
+	seq_puts(m, "SSTAT2( ");
 
 	s = GETPORT(SSTAT2);
 	if (s & SOFFSET)
-		seq_printf(m, "SOFFSET ");
+		seq_puts(m, "SOFFSET ");
 	if (s & SEMPTY)
-		seq_printf(m, "SEMPTY ");
+		seq_puts(m, "SEMPTY ");
 	if (s & SFULL)
-		seq_printf(m, "SFULL ");
+		seq_puts(m, "SFULL ");
 	seq_printf(m, "); SFCNT (%d); ", s & (SFULL | SFCNT));
 
 	s = GETPORT(SSTAT3);
 	seq_printf(m, "SCSICNT (%d), OFFCNT(%d), ", (s & 0xf0) >> 4, s & 0x0f);
 
-	seq_printf(m, "SSTAT4( ");
+	seq_puts(m, "SSTAT4( ");
 	s = GETPORT(SSTAT4);
 	if (s & SYNCERR)
-		seq_printf(m, "SYNCERR ");
+		seq_puts(m, "SYNCERR ");
 	if (s & FWERR)
-		seq_printf(m, "FWERR ");
+		seq_puts(m, "FWERR ");
 	if (s & FRERR)
-		seq_printf(m, "FRERR ");
-	seq_printf(m, "); ");
+		seq_puts(m, "FRERR ");
+	seq_puts(m, "); ");
 
-	seq_printf(m, "DMACNTRL0( ");
+	seq_puts(m, "DMACNTRL0( ");
 	s = GETPORT(DMACNTRL0);
 	seq_printf(m, "%s ", s & _8BIT ? "8BIT" : "16BIT");
 	seq_printf(m, "%s ", s & DMA ? "DMA" : "PIO");
 	seq_printf(m, "%s ", s & WRITE_READ ? "WRITE" : "READ");
 	if (s & ENDMA)
-		seq_printf(m, "ENDMA ");
+		seq_puts(m, "ENDMA ");
 	if (s & INTEN)
-		seq_printf(m, "INTEN ");
+		seq_puts(m, "INTEN ");
 	if (s & RSTFIFO)
-		seq_printf(m, "RSTFIFO ");
+		seq_puts(m, "RSTFIFO ");
 	if (s & SWINT)
-		seq_printf(m, "SWINT ");
-	seq_printf(m, "); ");
+		seq_puts(m, "SWINT ");
+	seq_puts(m, "); ");
 
-	seq_printf(m, "DMASTAT( ");
+	seq_puts(m, "DMASTAT( ");
 	s = GETPORT(DMASTAT);
 	if (s & ATDONE)
-		seq_printf(m, "ATDONE ");
+		seq_puts(m, "ATDONE ");
 	if (s & WORDRDY)
-		seq_printf(m, "WORDRDY ");
+		seq_puts(m, "WORDRDY ");
 	if (s & DFIFOFULL)
-		seq_printf(m, "DFIFOFULL ");
+		seq_puts(m, "DFIFOFULL ");
 	if (s & DFIFOEMP)
-		seq_printf(m, "DFIFOEMP ");
-	seq_printf(m, ")\n");
+		seq_puts(m, "DFIFOEMP ");
+	seq_puts(m, ")\n");
 
-	seq_printf(m, "enabled interrupts( ");
+	seq_puts(m, "enabled interrupts( ");
 
 	s = GETPORT(SIMODE0);
 	if (s & ENSELDO)
-		seq_printf(m, "ENSELDO ");
+		seq_puts(m, "ENSELDO ");
 	if (s & ENSELDI)
-		seq_printf(m, "ENSELDI ");
+		seq_puts(m, "ENSELDI ");
 	if (s & ENSELINGO)
-		seq_printf(m, "ENSELINGO ");
+		seq_puts(m, "ENSELINGO ");
 	if (s & ENSWRAP)
-		seq_printf(m, "ENSWRAP ");
+		seq_puts(m, "ENSWRAP ");
 	if (s & ENSDONE)
-		seq_printf(m, "ENSDONE ");
+		seq_puts(m, "ENSDONE ");
 	if (s & ENSPIORDY)
-		seq_printf(m, "ENSPIORDY ");
+		seq_puts(m, "ENSPIORDY ");
 	if (s & ENDMADONE)
-		seq_printf(m, "ENDMADONE ");
+		seq_puts(m, "ENDMADONE ");
 
 	s = GETPORT(SIMODE1);
 	if (s & ENSELTIMO)
-		seq_printf(m, "ENSELTIMO ");
+		seq_puts(m, "ENSELTIMO ");
 	if (s & ENATNTARG)
-		seq_printf(m, "ENATNTARG ");
+		seq_puts(m, "ENATNTARG ");
 	if (s & ENPHASEMIS)
-		seq_printf(m, "ENPHASEMIS ");
+		seq_puts(m, "ENPHASEMIS ");
 	if (s & ENBUSFREE)
-		seq_printf(m, "ENBUSFREE ");
+		seq_puts(m, "ENBUSFREE ");
 	if (s & ENSCSIPERR)
-		seq_printf(m, "ENSCSIPERR ");
+		seq_puts(m, "ENSCSIPERR ");
 	if (s & ENPHASECHG)
-		seq_printf(m, "ENPHASECHG ");
+		seq_puts(m, "ENPHASECHG ");
 	if (s & ENREQINIT)
-		seq_printf(m, "ENREQINIT ");
-	seq_printf(m, ")\n");
+		seq_puts(m, "ENREQINIT ");
+	seq_puts(m, ")\n");
 }
 
 static int aha152x_set_info(struct Scsi_Host *shpnt, char *buffer, int length)
@@ -3317,7 +3317,7 @@ static int aha152x_show_info(struct seq_file *m, struct Scsi_Host *shpnt)
 	Scsi_Cmnd *ptr;
 	unsigned long flags;
 
-	seq_printf(m, AHA152X_REVID "\n");
+	seq_puts(m, AHA152X_REVID "\n");
 
 	seq_printf(m, "ioports 0x%04lx to 0x%04lx\n",
 		shpnt->io_port, shpnt->io_port + shpnt->n_io_port - 1);
@@ -3331,7 +3331,7 @@ static int aha152x_show_info(struct seq_file *m, struct Scsi_Host *shpnt)
 	seq_printf(m, "%d commands currently queued\n", HOSTDATA(shpnt)->commands);
 
 	if(SYNCHRONOUS) {
-		seq_printf(m, "synchronously operating targets (tick=50 ns):\n");
+		seq_puts(m, "synchronously operating targets (tick=50 ns):\n");
 		for (i = 0; i < 8; i++)
 			if (HOSTDATA(shpnt)->syncrate[i] & 0x7f)
 				seq_printf(m, "target %d: period %dT/%dns; req/ack offset %d\n",
@@ -3344,7 +3344,7 @@ static int aha152x_show_info(struct seq_file *m, struct Scsi_Host *shpnt)
 #define PDEBUG(flags,txt) \
 	if (HOSTDATA(shpnt)->debug & flags) seq_printf(m, "(%s) ", txt);
 
-	seq_printf(m, "enabled debugging options: ");
+	seq_puts(m, "enabled debugging options: ");
 
 	PDEBUG(debug_procinfo, "procinfo");
 	PDEBUG(debug_queue, "queue");
@@ -3360,31 +3360,31 @@ static int aha152x_show_info(struct seq_file *m, struct Scsi_Host *shpnt)
 	PDEBUG(debug_locking, "locks");
 	PDEBUG(debug_phases, "phases");
 
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 #endif
 
-	seq_printf(m, "\nqueue status:\n");
+	seq_puts(m, "\nqueue status:\n");
 	DO_LOCK(flags);
 	if (ISSUE_SC) {
-		seq_printf(m, "not yet issued commands:\n");
+		seq_puts(m, "not yet issued commands:\n");
 		for (ptr = ISSUE_SC; ptr; ptr = SCNEXT(ptr))
 			get_command(m, ptr);
 	} else
-		seq_printf(m, "no not yet issued commands\n");
+		seq_puts(m, "no not yet issued commands\n");
 	DO_UNLOCK(flags);
 
 	if (CURRENT_SC) {
-		seq_printf(m, "current command:\n");
+		seq_puts(m, "current command:\n");
 		get_command(m, CURRENT_SC);
 	} else
-		seq_printf(m, "no current command\n");
+		seq_puts(m, "no current command\n");
 
 	if (DISCONNECTED_SC) {
-		seq_printf(m, "disconnected commands:\n");
+		seq_puts(m, "disconnected commands:\n");
 		for (ptr = DISCONNECTED_SC; ptr; ptr = SCNEXT(ptr))
 			get_command(m, ptr);
 	} else
-		seq_printf(m, "no disconnected commands\n");
+		seq_puts(m, "no disconnected commands\n");
 
 	get_ports(m, shpnt);
 
-- 
2.0.4


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

* [PATCH 5/7] scsi: misc:  Replace seq_printf with seq_puts
  2014-11-29  0:34 [PATCH 0/7] scsi: Some seq_file cleanups/optimizations Rasmus Villemoes
                   ` (3 preceding siblings ...)
  2014-11-29  0:34 ` [PATCH 4/7] scsi/aha152x: " Rasmus Villemoes
@ 2014-11-29  0:34 ` Rasmus Villemoes
  2014-11-29  0:34 ` [PATCH 6/7] scsi: misc: Merge consecutive seq_puts calls Rasmus Villemoes
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 26+ messages in thread
From: Rasmus Villemoes @ 2014-11-29  0:34 UTC (permalink / raw)
  To: James E.J. Bottomley; +Cc: linux-scsi, linux-kernel

Using seq_printf to print a simple string is a lot more expensive than
it needs to be, since seq_puts exists. Replace seq_printf with
seq_puts when possible.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 drivers/scsi/BusLogic.c             | 10 +++++-----
 drivers/scsi/NCR5380.c              |  6 +++---
 drivers/scsi/aic7xxx/aic79xx_proc.c | 38 ++++++++++++++++++-------------------
 drivers/scsi/aic7xxx/aic7xxx_proc.c | 24 +++++++++++------------
 drivers/scsi/arm/fas216.c           |  6 +++---
 drivers/scsi/atari_NCR5380.c        |  4 ++--
 drivers/scsi/atp870u.c              |  6 +++---
 drivers/scsi/dc395x.c               | 16 ++++++++--------
 drivers/scsi/dpt_i2o.c              |  2 +-
 drivers/scsi/eata_pio.c             |  2 +-
 drivers/scsi/g_NCR5380.c            | 24 +++++++++++------------
 drivers/scsi/gdth_proc.c            | 24 +++++++++++------------
 drivers/scsi/in2000.c               | 18 +++++++++---------
 drivers/scsi/ips.c                  |  7 +++----
 drivers/scsi/megaraid.c             |  2 +-
 drivers/scsi/nsp32.c                | 14 +++++++-------
 drivers/scsi/pcmcia/nsp_cs.c        | 30 ++++++++++++++---------------
 drivers/scsi/qla2xxx/qla_dfs.c      |  8 ++++----
 drivers/scsi/scsi_proc.c            | 22 ++++++++++-----------
 drivers/scsi/scsi_trace.c           |  6 +++---
 drivers/scsi/sun3_NCR5380.c         |  4 ++--
 drivers/scsi/wd33c93.c              | 18 +++++++++---------
 drivers/scsi/wd7000.c               | 12 ++++++------
 23 files changed, 150 insertions(+), 153 deletions(-)

diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index 64c7514..7a91d60 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -3485,7 +3485,7 @@ static int blogic_show_info(struct seq_file *m, struct Scsi_Host *shost)
 	seq_printf(m, "\n\
 Current Driver Queue Depth:	%d\n\
 Currently Allocated CCBs:	%d\n", adapter->drvr_qdepth, adapter->alloc_ccbs);
-	seq_printf(m, "\n\n\
+	seq_puts(m, "\n\n\
 			   DATA TRANSFER STATISTICS\n\
 \n\
 Target	Tagged Queuing	Queue Depth  Active  Attempted	Completed\n\
@@ -3500,7 +3500,7 @@ Target	Tagged Queuing	Queue Depth  Active  Attempted	Completed\n\
 		seq_printf(m,
 				  "	    %3d       %3u    %9u	%9u\n", adapter->qdepth[tgt], adapter->active_cmds[tgt], tgt_stats[tgt].cmds_tried, tgt_stats[tgt].cmds_complete);
 	}
-	seq_printf(m, "\n\
+	seq_puts(m, "\n\
 Target  Read Commands  Write Commands   Total Bytes Read    Total Bytes Written\n\
 ======  =============  ==============  ===================  ===================\n");
 	for (tgt = 0; tgt < adapter->maxdev; tgt++) {
@@ -3517,7 +3517,7 @@ Target  Read Commands  Write Commands   Total Bytes Read    Total Bytes Written\
 		else
 			seq_printf(m, "	     %9u\n", tgt_stats[tgt].byteswritten.units);
 	}
-	seq_printf(m, "\n\
+	seq_puts(m, "\n\
 Target  Command    0-1KB      1-2KB      2-4KB      4-8KB     8-16KB\n\
 ======  =======  =========  =========  =========  =========  =========\n");
 	for (tgt = 0; tgt < adapter->maxdev; tgt++) {
@@ -3533,7 +3533,7 @@ Target  Command    0-1KB      1-2KB      2-4KB      4-8KB     8-16KB\n\
 			    tgt_stats[tgt].write_sz_buckets[0],
 			    tgt_stats[tgt].write_sz_buckets[1], tgt_stats[tgt].write_sz_buckets[2], tgt_stats[tgt].write_sz_buckets[3], tgt_stats[tgt].write_sz_buckets[4]);
 	}
-	seq_printf(m, "\n\
+	seq_puts(m, "\n\
 Target  Command   16-32KB    32-64KB   64-128KB   128-256KB   256KB+\n\
 ======  =======  =========  =========  =========  =========  =========\n");
 	for (tgt = 0; tgt < adapter->maxdev; tgt++) {
@@ -3549,7 +3549,7 @@ Target  Command   16-32KB    32-64KB   64-128KB   128-256KB   256KB+\n\
 			    tgt_stats[tgt].write_sz_buckets[5],
 			    tgt_stats[tgt].write_sz_buckets[6], tgt_stats[tgt].write_sz_buckets[7], tgt_stats[tgt].write_sz_buckets[8], tgt_stats[tgt].write_sz_buckets[9]);
 	}
-	seq_printf(m, "\n\n\
+	seq_puts(m, "\n\n\
 			   ERROR RECOVERY STATISTICS\n\
 \n\
 	  Command Aborts      Bus Device Resets	  Host Adapter Resets\n\
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index 8395930..a2ed965 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -732,7 +732,7 @@ static int __maybe_unused NCR5380_show_info(struct seq_file *m,
 	seq_printf(m, "\nBase Addr: 0x%05lX    ", (long) instance->base);
 	seq_printf(m, "io_port: %04x      ", (int) instance->io_port);
 	if (instance->irq == SCSI_IRQ_NONE)
-		seq_printf(m, "IRQ: None.\n");
+		seq_puts(m, "IRQ: None.\n");
 	else
 		seq_printf(m, "IRQ: %d.\n", instance->irq);
 
@@ -761,7 +761,7 @@ static int __maybe_unused NCR5380_show_info(struct seq_file *m,
 static void lprint_Scsi_Cmnd(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_printf(m, "        command = ");
+	seq_puts(m, "        command = ");
 	lprint_command(cmd->cmnd, m);
 }
 
@@ -771,7 +771,7 @@ static void lprint_command(unsigned char *command, struct seq_file *m)
 	lprint_opcode(command[0], m);
 	for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i)
 		seq_printf(m, "%02x ", command[i]);
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 }
 
 static void lprint_opcode(int opcode, struct seq_file *m)
diff --git a/drivers/scsi/aic7xxx/aic79xx_proc.c b/drivers/scsi/aic7xxx/aic79xx_proc.c
index 27dbfcc..e095598 100644
--- a/drivers/scsi/aic7xxx/aic79xx_proc.c
+++ b/drivers/scsi/aic7xxx/aic79xx_proc.c
@@ -97,7 +97,7 @@ ahd_format_transinfo(struct seq_file *m, struct ahd_transinfo *tinfo)
 	u_int mb;
 
 	if (tinfo->period == AHD_PERIOD_UNKNOWN) {
-		seq_printf(m, "Renegotiation Pending\n");
+		seq_puts(m, "Renegotiation Pending\n");
 		return;
 	}
         speed = 3300;
@@ -119,40 +119,38 @@ ahd_format_transinfo(struct seq_file *m, struct ahd_transinfo *tinfo)
 		printed_options = 0;
 		seq_printf(m, " (%d.%03dMHz", freq / 1000, freq % 1000);
 		if ((tinfo->ppr_options & MSG_EXT_PPR_RD_STRM) != 0) {
-			seq_printf(m, " RDSTRM");
+			seq_puts(m, " RDSTRM");
 			printed_options++;
 		}
 		if ((tinfo->ppr_options & MSG_EXT_PPR_DT_REQ) != 0) {
-			seq_printf(m, "%s", printed_options ? "|DT" : " DT");
+			seq_puts(m, printed_options ? "|DT" : " DT");
 			printed_options++;
 		}
 		if ((tinfo->ppr_options & MSG_EXT_PPR_IU_REQ) != 0) {
-			seq_printf(m, "%s", printed_options ? "|IU" : " IU");
+			seq_puts(m, printed_options ? "|IU" : " IU");
 			printed_options++;
 		}
 		if ((tinfo->ppr_options & MSG_EXT_PPR_RTI) != 0) {
-			seq_printf(m, "%s",
-				  printed_options ? "|RTI" : " RTI");
+			seq_puts(m, printed_options ? "|RTI" : " RTI");
 			printed_options++;
 		}
 		if ((tinfo->ppr_options & MSG_EXT_PPR_QAS_REQ) != 0) {
-			seq_printf(m, "%s",
-				  printed_options ? "|QAS" : " QAS");
+			seq_puts(m, printed_options ? "|QAS" : " QAS");
 			printed_options++;
 		}
 	}
 
 	if (tinfo->width > 0) {
 		if (freq != 0) {
-			seq_printf(m, ", ");
+			seq_puts(m, ", ");
 		} else {
-			seq_printf(m, " (");
+			seq_puts(m, " (");
 		}
 		seq_printf(m, "%dbit)", 8 * (0x01 << tinfo->width));
 	} else if (freq != 0) {
-		seq_printf(m, ")");
+		seq_puts(m, ")");
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 }
 
 static void
@@ -167,15 +165,15 @@ ahd_dump_target_state(struct ahd_softc *ahd, struct seq_file *m,
 	tinfo = ahd_fetch_transinfo(ahd, channel, our_id,
 				    target_id, &tstate);
 	seq_printf(m, "Target %d Negotiation Settings\n", target_id);
-	seq_printf(m, "\tUser: ");
+	seq_puts(m, "\tUser: ");
 	ahd_format_transinfo(m, &tinfo->user);
 	starget = ahd->platform_data->starget[target_id];
 	if (starget == NULL)
 		return;
 
-	seq_printf(m, "\tGoal: ");
+	seq_puts(m, "\tGoal: ");
 	ahd_format_transinfo(m, &tinfo->goal);
-	seq_printf(m, "\tCurr: ");
+	seq_puts(m, "\tCurr: ");
 	ahd_format_transinfo(m, &tinfo->curr);
 
 	for (lun = 0; lun < AHD_NUM_LUNS; lun++) {
@@ -291,19 +289,19 @@ ahd_linux_show_info(struct seq_file *m, struct Scsi_Host *shost)
 	max_targ = 16;
 
 	if (ahd->seep_config == NULL)
-		seq_printf(m, "No Serial EEPROM\n");
+		seq_puts(m, "No Serial EEPROM\n");
 	else {
-		seq_printf(m, "Serial EEPROM:\n");
+		seq_puts(m, "Serial EEPROM:\n");
 		for (i = 0; i < sizeof(*ahd->seep_config)/2; i++) {
 			if (((i % 8) == 0) && (i != 0)) {
-				seq_printf(m, "\n");
+				seq_puts(m, "\n");
 			}
 			seq_printf(m, "0x%.4x ",
 				  ((uint16_t*)ahd->seep_config)[i]);
 		}
-		seq_printf(m, "\n");
+		seq_puts(m, "\n");
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	if ((ahd->features & AHD_WIDE) == 0)
 		max_targ = 8;
diff --git a/drivers/scsi/aic7xxx/aic7xxx_proc.c b/drivers/scsi/aic7xxx/aic7xxx_proc.c
index 64eec6c..25511ca 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_proc.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_proc.c
@@ -119,15 +119,15 @@ ahc_format_transinfo(struct seq_file *m, struct ahc_transinfo *tinfo)
 
 	if (tinfo->width > 0) {
 		if (freq != 0) {
-			seq_printf(m, ", ");
+			seq_puts(m, ", ");
 		} else {
-			seq_printf(m, " (");
+			seq_puts(m, " (");
 		}
 		seq_printf(m, "%dbit)", 8 * (0x01 << tinfo->width));
 	} else if (freq != 0) {
-		seq_printf(m, ")");
+		seq_puts(m, ")");
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 }
 
 static void
@@ -145,15 +145,15 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct seq_file *m,
 	if ((ahc->features & AHC_TWIN) != 0)
 		seq_printf(m, "Channel %c ", channel);
 	seq_printf(m, "Target %d Negotiation Settings\n", target_id);
-	seq_printf(m, "\tUser: ");
+	seq_puts(m, "\tUser: ");
 	ahc_format_transinfo(m, &tinfo->user);
 	starget = ahc->platform_data->starget[target_offset];
 	if (!starget)
 		return;
 
-	seq_printf(m, "\tGoal: ");
+	seq_puts(m, "\tGoal: ");
 	ahc_format_transinfo(m, &tinfo->goal);
-	seq_printf(m, "\tCurr: ");
+	seq_puts(m, "\tCurr: ");
 	ahc_format_transinfo(m, &tinfo->curr);
 
 	for (lun = 0; lun < AHC_NUM_LUNS; lun++) {
@@ -303,19 +303,19 @@ ahc_linux_show_info(struct seq_file *m, struct Scsi_Host *shost)
 
 
 	if (ahc->seep_config == NULL)
-		seq_printf(m, "No Serial EEPROM\n");
+		seq_puts(m, "No Serial EEPROM\n");
 	else {
-		seq_printf(m, "Serial EEPROM:\n");
+		seq_puts(m, "Serial EEPROM:\n");
 		for (i = 0; i < sizeof(*ahc->seep_config)/2; i++) {
 			if (((i % 8) == 0) && (i != 0)) {
-				seq_printf(m, "\n");
+				seq_puts(m, "\n");
 			}
 			seq_printf(m, "0x%.4x ",
 				  ((uint16_t*)ahc->seep_config)[i]);
 		}
-		seq_printf(m, "\n");
+		seq_puts(m, "\n");
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	max_targ = 16;
 	if ((ahc->features & (AHC_WIDE|AHC_TWIN)) == 0)
diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c
index 71cfb1e..6cccd78 100644
--- a/drivers/scsi/arm/fas216.c
+++ b/drivers/scsi/arm/fas216.c
@@ -2999,7 +2999,7 @@ void fas216_print_devices(FAS216_Info *info, struct seq_file *m)
 	struct fas216_device *dev;
 	struct scsi_device *scd;
 
-	seq_printf(m, "Device/Lun TaggedQ       Parity   Sync\n");
+	seq_puts(m, "Device/Lun TaggedQ       Parity   Sync\n");
 
 	shost_for_each_device(scd, info->host) {
 		dev = &info->device[scd->id];
@@ -3009,7 +3009,7 @@ void fas216_print_devices(FAS216_Info *info, struct seq_file *m)
 				     scd->simple_tags ? "en" : "dis",
 				     scd->current_tag);
 		else
-			seq_printf(m, "unsupported   ");
+			seq_puts(m, "unsupported   ");
 
 		seq_printf(m, "%3sabled ", dev->parity_enabled ? "en" : "dis");
 
@@ -3017,7 +3017,7 @@ void fas216_print_devices(FAS216_Info *info, struct seq_file *m)
 			seq_printf(m, "offset %d, %d ns\n",
 				     dev->sof, dev->period * 4);
 		else
-			seq_printf(m, "async\n");
+			seq_puts(m, "async\n");
 	}
 }
 
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
index 79e6f04..0b5344c 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -764,12 +764,12 @@ static void show_Scsi_Cmnd(Scsi_Cmnd *cmd, struct seq_file *m)
 	unsigned char *command;
 	seq_printf(m, "scsi%d: destination target %d, lun %llu\n",
 		H_NO(cmd), cmd->device->id, cmd->device->lun);
-	seq_printf(m, "        command = ");
+	seq_puts(m, "        command = ");
 	command = cmd->cmnd;
 	seq_printf(m, "%2d (0x%02x)", command[0], command[0]);
 	for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i)
 		seq_printf(m, " %02x", command[i]);
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 }
 
 static int NCR5380_show_info(struct seq_file *m, struct Scsi_Host *instance)
diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c
index a795d81..0b02467 100644
--- a/drivers/scsi/atp870u.c
+++ b/drivers/scsi/atp870u.c
@@ -3101,9 +3101,9 @@ static const char *atp870u_info(struct Scsi_Host *notused)
 
 static int atp870u_show_info(struct seq_file *m, struct Scsi_Host *HBAptr)
 {
-	seq_printf(m, "ACARD AEC-671X Driver Version: 2.6+ac\n");
-	seq_printf(m, "\n");
-	seq_printf(m, "Adapter Configuration:\n");
+	seq_puts(m, "ACARD AEC-671X Driver Version: 2.6+ac\n");
+	seq_puts(m, "\n");
+	seq_puts(m, "Adapter Configuration:\n");
 	seq_printf(m, "               Base IO: %#.4lx\n", HBAptr->io_port);
 	seq_printf(m, "                   IRQ: %d\n", HBAptr->irq);
 	return 0;
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
index 0a1ed50..613a773 100644
--- a/drivers/scsi/dc395x.c
+++ b/drivers/scsi/dc395x.c
@@ -4623,8 +4623,8 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
 	unsigned long flags;
 	int dev;
 
-	seq_printf(m, DC395X_BANNER " PCI SCSI Host Adapter\n");
-	seq_printf(m, " Driver Version " DC395X_VERSION "\n");
+	seq_puts(m, DC395X_BANNER " PCI SCSI Host Adapter\n");
+	seq_puts(m, " Driver Version " DC395X_VERSION "\n");
 
 	DC395x_LOCK_IO(acb->scsi_host, flags);
 
@@ -4655,7 +4655,7 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
 	     acb->dcb_map[11], acb->dcb_map[12], acb->dcb_map[13],
 	     acb->dcb_map[14], acb->dcb_map[15]);
 
-	seq_printf(m, "Un ID LUN Prty Sync Wide DsCn SndS TagQ nego_period SyncFreq SyncOffs MaxCmd\n");
+	seq_puts(m, "Un ID LUN Prty Sync Wide DsCn SndS TagQ nego_period SyncFreq SyncOffs MaxCmd\n");
 
 	dev = 0;
 	list_for_each_entry(dcb, &acb->dcb_list, list) {
@@ -4681,7 +4681,7 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
 			seq_printf(m, "   %2i.%1i M     %02i ", spd, spd1,
 				(dcb->sync_offset & 0x0f));
 		} else
-			seq_printf(m, "                 ");
+			seq_puts(m, "                 ");
 
 		/* Add more info ... */
 		seq_printf(m, "     %02i\n", dcb->max_command);
@@ -4689,9 +4689,9 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
 	}
 
 	if (timer_pending(&acb->waiting_timer))
-		seq_printf(m, "Waiting queue timer running\n");
+		seq_puts(m, "Waiting queue timer running\n");
 	else
-		seq_printf(m, "\n");
+		seq_puts(m, "\n");
 
 	list_for_each_entry(dcb, &acb->dcb_list, list) {
 		struct ScsiReqBlk *srb;
@@ -4708,7 +4708,7 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
 		list_for_each_entry(srb, &dcb->srb_going_list, list)
 			seq_printf(m, " %p", srb->cmd);
 		if (!list_empty(&dcb->srb_waiting_list) || !list_empty(&dcb->srb_going_list))
-			seq_printf(m, "\n");
+			seq_puts(m, "\n");
 	}
 
 	if (debug_enabled(DBG_1)) {
@@ -4716,7 +4716,7 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
 		list_for_each_entry(dcb, &acb->dcb_list, list) {
 			seq_printf(m, "%p -> ", dcb);
 		}
-		seq_printf(m, "END\n");
+		seq_puts(m, "END\n");
 	}
 
 	DC395x_UNLOCK_IO(acb->scsi_host, flags);
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 072f0ec..70cb20c 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -570,7 +570,7 @@ static int adpt_show_info(struct seq_file *m, struct Scsi_Host *host)
 	seq_printf(m, "\tpost fifo size  = %d\n\treply fifo size = %d\n\tsg table size   = %d\n\n",
 			host->can_queue, (int) pHba->reply_fifo_size , host->sg_tablesize);
 
-	seq_printf(m, "Devices:\n");
+	seq_puts(m, "Devices:\n");
 	for(chan = 0; chan < MAX_CHANNEL; chan++) {
 		for(id = 0; id < MAX_ID; id++) {
 			d = pHba->channel[chan].device[id];
diff --git a/drivers/scsi/eata_pio.c b/drivers/scsi/eata_pio.c
index 8319d2b..ca8003f 100644
--- a/drivers/scsi/eata_pio.c
+++ b/drivers/scsi/eata_pio.c
@@ -102,7 +102,7 @@ static int eata_pio_show_info(struct seq_file *m, struct Scsi_Host *shost)
 		   shost->host_no, SD(shost)->name);
 	seq_printf(m, "Firmware revision: v%s\n",
 		   SD(shost)->revision);
-	seq_printf(m, "IO: PIO\n");
+	seq_puts(m, "IO: PIO\n");
 	seq_printf(m, "Base IO : %#.4x\n", (u32) shost->base);
 	seq_printf(m, "Host Bus: %s\n",
 		   (SD(shost)->bustype == 'P')?"PCI ":
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index 802b64c..36e8145 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -752,7 +752,7 @@ static void sprint_command(struct seq_file *m, unsigned char *command)
 	sprint_opcode(m, command[0]);
 	for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i)
 		seq_printf(m, "%02x ", command[i]);
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 }
 
 /**
@@ -766,7 +766,7 @@ static void sprint_command(struct seq_file *m, unsigned char *command)
 static void sprint_Scsi_Cmnd(struct seq_file *m, Scsi_Cmnd * cmd)
 {
 	seq_printf(m, "host number %d destination target %d, lun %llu\n", cmd->device->host->host_no, cmd->device->id, cmd->device->lun);
-	seq_printf(m, "        command = ");
+	seq_puts(m, "        command = ");
 	sprint_command(m, cmd->cmnd);
 }
 
@@ -810,26 +810,26 @@ static int generic_NCR5380_show_info(struct seq_file *m, struct Scsi_Host *scsi_
 	seq_printf(m, "NCR53C400 extension version %d\n", NCR53C400_PUBLIC_RELEASE);
 	seq_printf(m, "NCR53C400 card%s detected\n", (((struct NCR5380_hostdata *) scsi_ptr->hostdata)->flags & FLAG_NCR53C400) ? "" : " not");
 # if NCR53C400_PSEUDO_DMA
-	seq_printf(m, "NCR53C400 pseudo DMA used\n");
+	seq_puts(m, "NCR53C400 pseudo DMA used\n");
 # endif
 #else
-	seq_printf(m, "NO NCR53C400 driver extensions\n");
+	seq_puts(m, "NO NCR53C400 driver extensions\n");
 #endif
 	seq_printf(m, "Using %s mapping at %s 0x%lx, ", STRVAL(NCR5380_map_config), STRVAL(NCR5380_map_name), scsi_ptr->NCR5380_instance_name);
 	if (scsi_ptr->irq == SCSI_IRQ_NONE)
-		seq_printf(m, "no interrupt\n");
+		seq_puts(m, "no interrupt\n");
 	else
 		seq_printf(m, "on interrupt %d\n", scsi_ptr->irq);
 
 #ifdef NCR5380_STATS
 	if (hostdata->connected || hostdata->issue_queue || hostdata->disconnected_queue)
-		seq_printf(m, "There are commands pending, transfer rates may be crud\n");
+		seq_puts(m, "There are commands pending, transfer rates may be crud\n");
 	if (hostdata->pendingr)
 		seq_printf(m, "  %d pending reads", hostdata->pendingr);
 	if (hostdata->pendingw)
 		seq_printf(m, "  %d pending writes", hostdata->pendingw);
 	if (hostdata->pendingr || hostdata->pendingw)
-		seq_printf(m, "\n");
+		seq_puts(m, "\n");
 	shost_for_each_device(dev, scsi_ptr) {
 		unsigned long br = hostdata->bytes_read[dev->id];
 		unsigned long bw = hostdata->bytes_write[dev->id];
@@ -857,30 +857,30 @@ static int generic_NCR5380_show_info(struct seq_file *m, struct Scsi_Host *scsi_
 		seq_printf(m, "\n%10ld kb written in %5ld secs", bw / 1024, tw);
 		if (tw)
 			seq_printf(m, " @ %5ld bps", bw / tw);
-		seq_printf(m, "\n");
+		seq_puts(m, "\n");
 	}
 #endif
 
 	status = NCR5380_read(STATUS_REG);
 	if (!(status & SR_REQ))
-		seq_printf(m, "REQ not asserted, phase unknown.\n");
+		seq_puts(m, "REQ not asserted, phase unknown.\n");
 	else {
 		for (i = 0; (phases[i].value != PHASE_UNKNOWN) && (phases[i].value != (status & PHASE_MASK)); ++i);
 		seq_printf(m, "Phase %s\n", phases[i].name);
 	}
 
 	if (!hostdata->connected) {
-		seq_printf(m, "No currently connected command\n");
+		seq_puts(m, "No currently connected command\n");
 	} else {
 		sprint_Scsi_Cmnd(m, (Scsi_Cmnd *) hostdata->connected);
 	}
 
-	seq_printf(m, "issue_queue\n");
+	seq_puts(m, "issue_queue\n");
 
 	for (ptr = (Scsi_Cmnd *) hostdata->issue_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble)
 		sprint_Scsi_Cmnd(m, ptr);
 
-	seq_printf(m, "disconnected_queue\n");
+	seq_puts(m, "disconnected_queue\n");
 
 	for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble)
 		sprint_Scsi_Cmnd(m, ptr);
diff --git a/drivers/scsi/gdth_proc.c b/drivers/scsi/gdth_proc.c
index 9fb6326..e66e997 100644
--- a/drivers/scsi/gdth_proc.c
+++ b/drivers/scsi/gdth_proc.c
@@ -173,7 +173,7 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
     /* request is i.e. "cat /proc/scsi/gdth/0" */ 
     /* format: %-15s\t%-10s\t%-15s\t%s */
     /* driver parameters */
-    seq_printf(m, "Driver Parameters:\n");
+    seq_puts(m, "Driver Parameters:\n");
     if (reserve_list[0] == 0xff)
         strcpy(hrec, "--");
     else {
@@ -192,7 +192,7 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
                    max_ids, hdr_channel);
 
     /* controller information */
-    seq_printf(m,"\nDisk Array Controller Information:\n");
+    seq_puts(m, "\nDisk Array Controller Information:\n");
     seq_printf(m,
                    " Number:       \t%d         \tName:          \t%s\n",
                    ha->hanum, ha->binfo.type_string);
@@ -219,7 +219,7 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
 
 #ifdef GDTH_DMA_STATISTICS
     /* controller statistics */
-    seq_printf(m,"\nController Statistics:\n");
+    seq_puts(m, "\nController Statistics:\n");
     seq_printf(m,
                    " 32-bit DMA buffer:\t%lu\t64-bit DMA buffer:\t%lu\n",
                    ha->dma32_cnt, ha->dma64_cnt);
@@ -227,7 +227,7 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
 
     if (ha->more_proc) {
         /* more information: 2. about physical devices */
-        seq_printf(m, "\nPhysical Devices:");
+        seq_puts(m, "\nPhysical Devices:");
         flag = FALSE;
             
         buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr);
@@ -326,10 +326,10 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
         gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr);
 
         if (!flag)
-            seq_printf(m, "\n --\n");
+            seq_puts(m, "\n --\n");
 
         /* 3. about logical drives */
-        seq_printf(m,"\nLogical Drives:");
+        seq_puts(m, "\nLogical Drives:");
         flag = FALSE;
 
         buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr);
@@ -411,10 +411,10 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
         gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr);
         
         if (!flag)
-            seq_printf(m, "\n --\n");
+            seq_puts(m, "\n --\n");
 
         /* 4. about array drives */
-        seq_printf(m,"\nArray Drives:");
+        seq_puts(m, "\nArray Drives:");
         flag = FALSE;
 
         buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr);
@@ -471,10 +471,10 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
         gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr);
         
         if (!flag)
-            seq_printf(m, "\n --\n");
+            seq_puts(m, "\n --\n");
 
         /* 5. about host drives */
-        seq_printf(m,"\nHost Drives:");
+        seq_puts(m, "\nHost Drives:");
         flag = FALSE;
 
         buf = gdth_ioctl_alloc(ha, sizeof(gdth_hget_str), FALSE, &paddr);
@@ -527,11 +527,11 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
         }
         
         if (!flag)
-            seq_printf(m, "\n --\n");
+            seq_puts(m, "\n --\n");
     }
 
     /* controller events */
-    seq_printf(m,"\nController Events:\n");
+    seq_puts(m, "\nController Events:\n");
 
     for (id = -1;;) {
         id = gdth_read_event(ha, id, estr);
diff --git a/drivers/scsi/in2000.c b/drivers/scsi/in2000.c
index ddf0694..a73395e 100644
--- a/drivers/scsi/in2000.c
+++ b/drivers/scsi/in2000.c
@@ -2226,36 +2226,36 @@ static int in2000_show_info(struct seq_file *m, struct Scsi_Host *instance)
 
 	if (hd->proc & PR_INFO) {
 		seq_printf(m, "\ndip_switch=%02x: irq=%d io=%02x floppy=%s sync/DOS5=%s", (hd->dip_switch & 0x7f), instance->irq, hd->io_base, (hd->dip_switch & 0x40) ? "Yes" : "No", (hd->dip_switch & 0x20) ? "Yes" : "No");
-		seq_printf(m, "\nsync_xfer[] =       ");
+		seq_puts(m, "\nsync_xfer[] =       ");
 		for (x = 0; x < 7; x++)
 			seq_printf(m, "\t%02x", hd->sync_xfer[x]);
-		seq_printf(m, "\nsync_stat[] =       ");
+		seq_puts(m, "\nsync_stat[] =       ");
 		for (x = 0; x < 7; x++)
 			seq_printf(m, "\t%02x", hd->sync_stat[x]);
 	}
 #ifdef PROC_STATISTICS
 	if (hd->proc & PR_STATISTICS) {
-		seq_printf(m, "\ncommands issued:    ");
+		seq_puts(m, "\ncommands issued:    ");
 		for (x = 0; x < 7; x++)
 			seq_printf(m, "\t%ld", hd->cmd_cnt[x]);
-		seq_printf(m, "\ndisconnects allowed:");
+		seq_puts(m, "\ndisconnects allowed:");
 		for (x = 0; x < 7; x++)
 			seq_printf(m, "\t%ld", hd->disc_allowed_cnt[x]);
-		seq_printf(m, "\ndisconnects done:   ");
+		seq_puts(m, "\ndisconnects done:   ");
 		for (x = 0; x < 7; x++)
 			seq_printf(m, "\t%ld", hd->disc_done_cnt[x]);
 		seq_printf(m, "\ninterrupts:      \t%ld", hd->int_cnt);
 	}
 #endif
 	if (hd->proc & PR_CONNECTED) {
-		seq_printf(m, "\nconnected:     ");
+		seq_puts(m, "\nconnected:     ");
 		if (hd->connected) {
 			cmd = (Scsi_Cmnd *) hd->connected;
 			seq_printf(m, " %d:%llu(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
 		}
 	}
 	if (hd->proc & PR_INPUTQ) {
-		seq_printf(m, "\ninput_Q:       ");
+		seq_puts(m, "\ninput_Q:       ");
 		cmd = (Scsi_Cmnd *) hd->input_Q;
 		while (cmd) {
 			seq_printf(m, " %d:%llu(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
@@ -2263,7 +2263,7 @@ static int in2000_show_info(struct seq_file *m, struct Scsi_Host *instance)
 		}
 	}
 	if (hd->proc & PR_DISCQ) {
-		seq_printf(m, "\ndisconnected_Q:");
+		seq_puts(m, "\ndisconnected_Q:");
 		cmd = (Scsi_Cmnd *) hd->disconnected_Q;
 		while (cmd) {
 			seq_printf(m, " %d:%llu(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
@@ -2273,7 +2273,7 @@ static int in2000_show_info(struct seq_file *m, struct Scsi_Host *instance)
 	if (hd->proc & PR_TEST) {
 		;		/* insert your own custom function here */
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 	spin_unlock_irqrestore(instance->host_lock, flags);
 #endif				/* PROC_INTERFACE */
 	return 0;
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index e5afc38..06b9d0c 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -2038,15 +2038,14 @@ ips_host_info(ips_ha_t *ha, struct seq_file *m)
 {
 	METHOD_TRACE("ips_host_info", 1);
 
-	seq_printf(m, "\nIBM ServeRAID General Information:\n\n");
+	seq_puts(m, "\nIBM ServeRAID General Information:\n\n");
 
 	if ((le32_to_cpu(ha->nvram->signature) == IPS_NVRAM_P5_SIG) &&
 	    (le16_to_cpu(ha->nvram->adapter_type) != 0))
 		seq_printf(m, "\tController Type                   : %s\n",
 			  ips_adapter_name[ha->ad_type - 1]);
 	else
-		seq_printf(m,
-			  "\tController Type                   : Unknown\n");
+		seq_puts(m, "\tController Type                   : Unknown\n");
 
 	if (ha->io_addr)
 		seq_printf(m,
@@ -2138,7 +2137,7 @@ ips_host_info(ips_ha_t *ha, struct seq_file *m)
 	seq_printf(m, "\tCurrent Active PT Commands        : %d\n",
 		  ha->num_ioctl);
 
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	return 0;
 }
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index ac5d94c..e79386d 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -2240,7 +2240,7 @@ proc_show_battery(struct seq_file *m, void *v)
 		goto free_pdev;
 
 	if( mega_adapinq(adapter, dma_handle) != 0 ) {
-		seq_printf(m, "Adapter inquiry failed.\n");
+		seq_puts(m, "Adapter inquiry failed.\n");
 		printk(KERN_WARNING "megaraid: inquiry failed.\n");
 		goto free_inquiry;
 	}
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
index 3e77551..8f6b1b4 100644
--- a/drivers/scsi/nsp32.c
+++ b/drivers/scsi/nsp32.c
@@ -1456,7 +1456,7 @@ static int nsp32_show_info(struct seq_file *m, struct Scsi_Host *host)
 	data = (nsp32_hw_data *)host->hostdata;
 	base = host->io_port;
 
-	seq_printf(m, "NinjaSCSI-32 status\n\n");
+	seq_puts(m, "NinjaSCSI-32 status\n\n");
 	seq_printf(m, "Driver version:        %s, $Revision: 1.33 $\n", nsp32_release_version);
 	seq_printf(m, "SCSI host No.:         %d\n",		hostno);
 	seq_printf(m, "IRQ:                   %d\n",		host->irq);
@@ -1478,25 +1478,25 @@ static int nsp32_show_info(struct seq_file *m, struct Scsi_Host *host)
 	spin_unlock_irqrestore(&(data->Lock), flags);
 
 
-	seq_printf(m, "SDTR status\n");
+	seq_puts(m, "SDTR status\n");
 	for (id = 0; id < ARRAY_SIZE(data->target); id++) {
 
 		seq_printf(m, "id %d: ", id);
 
 		if (id == host->this_id) {
-			seq_printf(m, "----- NinjaSCSI-32 host adapter\n");
+			seq_puts(m, "----- NinjaSCSI-32 host adapter\n");
 			continue;
 		}
 
 		if (data->target[id].sync_flag == SDTR_DONE) {
 			if (data->target[id].period == 0            &&
 			    data->target[id].offset == ASYNC_OFFSET ) {
-				seq_printf(m, "async");
+				seq_puts(m, "async");
 			} else {
-				seq_printf(m, " sync");
+				seq_puts(m, " sync");
 			}
 		} else {
-			seq_printf(m, " none");
+			seq_puts(m, " none");
 		}
 
 		if (data->target[id].period != 0) {
@@ -1509,7 +1509,7 @@ static int nsp32_show_info(struct seq_file *m, struct Scsi_Host *host)
 				data->target[id].offset
 				);
 		}
-		seq_printf(m, "\n");
+		seq_puts(m, "\n");
 	}
 	return 0;
 }
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index 83db942..bf883a6 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -1375,58 +1375,58 @@ static int nsp_show_info(struct seq_file *m, struct Scsi_Host *host)
 	hostno = host->host_no;
 	data = (nsp_hw_data *)host->hostdata;
 
-	seq_printf(m, "NinjaSCSI status\n\n");
-	seq_printf(m, "Driver version:        $Revision: 1.23 $\n");
+	seq_puts(m, "NinjaSCSI status\n\n");
+	seq_puts(m, "Driver version:        $Revision: 1.23 $\n");
 	seq_printf(m, "SCSI host No.:         %d\n",          hostno);
 	seq_printf(m, "IRQ:                   %d\n",          host->irq);
 	seq_printf(m, "IO:                    0x%lx-0x%lx\n", host->io_port, host->io_port + host->n_io_port - 1);
 	seq_printf(m, "MMIO(virtual address): 0x%lx-0x%lx\n", host->base, host->base + data->MmioLength - 1);
 	seq_printf(m, "sg_tablesize:          %d\n",          host->sg_tablesize);
 
-	seq_printf(m, "burst transfer mode:   ");
+	seq_puts(m, "burst transfer mode:   ");
 	switch (nsp_burst_mode) {
 	case BURST_IO8:
-		seq_printf(m, "io8");
+		seq_puts(m, "io8");
 		break;
 	case BURST_IO32:
-		seq_printf(m, "io32");
+		seq_puts(m, "io32");
 		break;
 	case BURST_MEM32:
-		seq_printf(m, "mem32");
+		seq_puts(m, "mem32");
 		break;
 	default:
-		seq_printf(m, "???");
+		seq_puts(m, "???");
 		break;
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 
 	spin_lock_irqsave(&(data->Lock), flags);
 	seq_printf(m, "CurrentSC:             0x%p\n\n",      data->CurrentSC);
 	spin_unlock_irqrestore(&(data->Lock), flags);
 
-	seq_printf(m, "SDTR status\n");
+	seq_puts(m, "SDTR status\n");
 	for(id = 0; id < ARRAY_SIZE(data->Sync); id++) {
 
 		seq_printf(m, "id %d: ", id);
 
 		if (id == host->this_id) {
-			seq_printf(m, "----- NinjaSCSI-3 host adapter\n");
+			seq_puts(m, "----- NinjaSCSI-3 host adapter\n");
 			continue;
 		}
 
 		switch(data->Sync[id].SyncNegotiation) {
 		case SYNC_OK:
-			seq_printf(m, " sync");
+			seq_puts(m, " sync");
 			break;
 		case SYNC_NG:
-			seq_printf(m, "async");
+			seq_puts(m, "async");
 			break;
 		case SYNC_NOT_YET:
-			seq_printf(m, " none");
+			seq_puts(m, " none");
 			break;
 		default:
-			seq_printf(m, "?????");
+			seq_puts(m, "?????");
 			break;
 		}
 
@@ -1439,7 +1439,7 @@ static int nsp_show_info(struct seq_file *m, struct Scsi_Host *host)
 				data->Sync[id].SyncOffset
 				);
 		}
-		seq_printf(m, "\n");
+		seq_puts(m, "\n");
 	}
 	return 0;
 }
diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c
index 2ca39b8..c837ba3 100644
--- a/drivers/scsi/qla2xxx/qla_dfs.c
+++ b/drivers/scsi/qla2xxx/qla_dfs.c
@@ -23,10 +23,10 @@ qla2x00_dfs_fce_show(struct seq_file *s, void *unused)
 
 	mutex_lock(&ha->fce_mutex);
 
-	seq_printf(s, "FCE Trace Buffer\n");
+	seq_puts(s, "FCE Trace Buffer\n");
 	seq_printf(s, "In Pointer = %llx\n\n", (unsigned long long)ha->fce_wr);
 	seq_printf(s, "Base = %llx\n\n", (unsigned long long) ha->fce_dma);
-	seq_printf(s, "FCE Enable Registers\n");
+	seq_puts(s, "FCE Enable Registers\n");
 	seq_printf(s, "%08x %08x %08x %08x %08x %08x\n",
 	    ha->fce_mb[0], ha->fce_mb[2], ha->fce_mb[3], ha->fce_mb[4],
 	    ha->fce_mb[5], ha->fce_mb[6]);
@@ -38,11 +38,11 @@ qla2x00_dfs_fce_show(struct seq_file *s, void *unused)
 			seq_printf(s, "\n%llx: ",
 			    (unsigned long long)((cnt * 4) + fce_start));
 		else
-			seq_printf(s, " ");
+			seq_puts(s, " ");
 		seq_printf(s, "%08x", *fce++);
 	}
 
-	seq_printf(s, "\nEnd\n");
+	seq_puts(s, "\nEnd\n");
 
 	mutex_unlock(&ha->fce_mutex);
 
diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c
index 6fcefa2..581de8f 100644
--- a/drivers/scsi/scsi_proc.c
+++ b/drivers/scsi/scsi_proc.c
@@ -189,36 +189,36 @@ static int proc_print_scsidevice(struct device *dev, void *data)
 		sdev->host->host_no, sdev->channel, sdev->id, sdev->lun);
 	for (i = 0; i < 8; i++) {
 		if (sdev->vendor[i] >= 0x20)
-			seq_printf(s, "%c", sdev->vendor[i]);
+			seq_putc(s, sdev->vendor[i]);
 		else
-			seq_printf(s, " ");
+			seq_puts(s, " ");
 	}
 
-	seq_printf(s, " Model: ");
+	seq_puts(s, " Model: ");
 	for (i = 0; i < 16; i++) {
 		if (sdev->model[i] >= 0x20)
-			seq_printf(s, "%c", sdev->model[i]);
+			seq_putc(s, sdev->model[i]);
 		else
-			seq_printf(s, " ");
+			seq_puts(s, " ");
 	}
 
-	seq_printf(s, " Rev: ");
+	seq_puts(s, " Rev: ");
 	for (i = 0; i < 4; i++) {
 		if (sdev->rev[i] >= 0x20)
-			seq_printf(s, "%c", sdev->rev[i]);
+			seq_putc(s, sdev->rev[i]);
 		else
-			seq_printf(s, " ");
+			seq_puts(s, " ");
 	}
 
-	seq_printf(s, "\n");
+	seq_puts(s, "\n");
 
 	seq_printf(s, "  Type:   %s ", scsi_device_type(sdev->type));
 	seq_printf(s, "               ANSI  SCSI revision: %02x",
 			sdev->scsi_level - (sdev->scsi_level > 1));
 	if (sdev->scsi_level == 2)
-		seq_printf(s, " CCS\n");
+		seq_puts(s, " CCS\n");
 	else
-		seq_printf(s, "\n");
+		seq_puts(s, "\n");
 
 out:
 	return 0;
diff --git a/drivers/scsi/scsi_trace.c b/drivers/scsi/scsi_trace.c
index 503594e..e4e122b 100644
--- a/drivers/scsi/scsi_trace.c
+++ b/drivers/scsi/scsi_trace.c
@@ -143,7 +143,7 @@ scsi_trace_rw32(struct trace_seq *p, unsigned char *cdb, int len)
 		cmd = "WRITE_SAME";
 		break;
 	default:
-		trace_seq_printf(p, "UNKNOWN");
+		trace_seq_puts(p, "UNKNOWN");
 		goto out;
 	}
 
@@ -204,7 +204,7 @@ scsi_trace_service_action_in(struct trace_seq *p, unsigned char *cdb, int len)
 		cmd = "GET_LBA_STATUS";
 		break;
 	default:
-		trace_seq_printf(p, "UNKNOWN");
+		trace_seq_puts(p, "UNKNOWN");
 		goto out;
 	}
 
@@ -249,7 +249,7 @@ scsi_trace_misc(struct trace_seq *p, unsigned char *cdb, int len)
 {
 	const char *ret = trace_seq_buffer_ptr(p);
 
-	trace_seq_printf(p, "-");
+	trace_seq_puts(p, "-");
 	trace_seq_putc(p, 0);
 
 	return ret;
diff --git a/drivers/scsi/sun3_NCR5380.c b/drivers/scsi/sun3_NCR5380.c
index 1a2367a..3011df8 100644
--- a/drivers/scsi/sun3_NCR5380.c
+++ b/drivers/scsi/sun3_NCR5380.c
@@ -710,12 +710,12 @@ static void show_Scsi_Cmnd(Scsi_Cmnd *cmd, struct seq_file *m)
 	unsigned char *command;
 	seq_printf(m, "scsi%d: destination target %d, lun %llu\n",
 		H_NO(cmd), cmd->device->id, cmd->device->lun);
-	seq_printf(m, "        command = ");
+	seq_puts(m, "        command = ");
 	command = cmd->cmnd;
 	seq_printf(m, "%2d (0x%02x)", command[0], command[0]);
 	for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i)
 		seq_printf(m, " %02x", command[i]);
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 }
 
 static int NCR5380_show_info(struct seq_file *m, struct Scsi_Host *instance)
diff --git a/drivers/scsi/wd33c93.c b/drivers/scsi/wd33c93.c
index c0506de..6e041a7 100644
--- a/drivers/scsi/wd33c93.c
+++ b/drivers/scsi/wd33c93.c
@@ -2143,22 +2143,22 @@ wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance)
 		seq_printf(m, "\nclock_freq=%02x no_sync=%02x no_dma=%d"
 			" dma_mode=%02x fast=%d",
 			hd->clock_freq, hd->no_sync, hd->no_dma, hd->dma_mode, hd->fast);
-		seq_printf(m, "\nsync_xfer[] =       ");
+		seq_puts(m, "\nsync_xfer[] =       ");
 		for (x = 0; x < 7; x++)
 			seq_printf(m, "\t%02x", hd->sync_xfer[x]);
-		seq_printf(m, "\nsync_stat[] =       ");
+		seq_puts(m, "\nsync_stat[] =       ");
 		for (x = 0; x < 7; x++)
 			seq_printf(m, "\t%02x", hd->sync_stat[x]);
 	}
 #ifdef PROC_STATISTICS
 	if (hd->proc & PR_STATISTICS) {
-		seq_printf(m, "\ncommands issued:    ");
+		seq_puts(m, "\ncommands issued:    ");
 		for (x = 0; x < 7; x++)
 			seq_printf(m, "\t%ld", hd->cmd_cnt[x]);
-		seq_printf(m, "\ndisconnects allowed:");
+		seq_puts(m, "\ndisconnects allowed:");
 		for (x = 0; x < 7; x++)
 			seq_printf(m, "\t%ld", hd->disc_allowed_cnt[x]);
-		seq_printf(m, "\ndisconnects done:   ");
+		seq_puts(m, "\ndisconnects done:   ");
 		for (x = 0; x < 7; x++)
 			seq_printf(m, "\t%ld", hd->disc_done_cnt[x]);
 		seq_printf(m,
@@ -2167,7 +2167,7 @@ wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance)
 	}
 #endif
 	if (hd->proc & PR_CONNECTED) {
-		seq_printf(m, "\nconnected:     ");
+		seq_puts(m, "\nconnected:     ");
 		if (hd->connected) {
 			cmd = (struct scsi_cmnd *) hd->connected;
 			seq_printf(m, " %d:%llu(%02x)",
@@ -2175,7 +2175,7 @@ wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance)
 		}
 	}
 	if (hd->proc & PR_INPUTQ) {
-		seq_printf(m, "\ninput_Q:       ");
+		seq_puts(m, "\ninput_Q:       ");
 		cmd = (struct scsi_cmnd *) hd->input_Q;
 		while (cmd) {
 			seq_printf(m, " %d:%llu(%02x)",
@@ -2184,7 +2184,7 @@ wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance)
 		}
 	}
 	if (hd->proc & PR_DISCQ) {
-		seq_printf(m, "\ndisconnected_Q:");
+		seq_puts(m, "\ndisconnected_Q:");
 		cmd = (struct scsi_cmnd *) hd->disconnected_Q;
 		while (cmd) {
 			seq_printf(m, " %d:%llu(%02x)",
@@ -2192,7 +2192,7 @@ wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance)
 			cmd = (struct scsi_cmnd *) cmd->host_scribble;
 		}
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 	spin_unlock_irq(&hd->lock);
 #endif				/* PROC_INTERFACE */
 	return 0;
diff --git a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c
index 6f5adaa..a5f9a6a 100644
--- a/drivers/scsi/wd7000.c
+++ b/drivers/scsi/wd7000.c
@@ -1330,9 +1330,9 @@ static int wd7000_show_info(struct seq_file *m, struct Scsi_Host *host)
 	icmbs = adapter->mb.icmb;
 
 	seq_printf(m, "\nControl port value: 0x%x\n", adapter->control);
-	seq_printf(m, "Incoming mailbox:\n");
+	seq_puts(m, "Incoming mailbox:\n");
 	seq_printf(m, "  size: %d\n", ICMB_CNT);
-	seq_printf(m, "  queued messages: ");
+	seq_puts(m, "  queued messages: ");
 
 	for (i = count = 0; i < ICMB_CNT; i++)
 		if (icmbs[i].status) {
@@ -1340,12 +1340,12 @@ static int wd7000_show_info(struct seq_file *m, struct Scsi_Host *host)
 			seq_printf(m, "0x%x ", i);
 		}
 
-	seq_printf(m, count ? "\n" : "none\n");
+	seq_puts(m, count ? "\n" : "none\n");
 
-	seq_printf(m, "Outgoing mailbox:\n");
+	seq_puts(m, "Outgoing mailbox:\n");
 	seq_printf(m, "  size: %d\n", OGMB_CNT);
 	seq_printf(m, "  next message: 0x%x\n", adapter->next_ogmb);
-	seq_printf(m, "  queued messages: ");
+	seq_puts(m, "  queued messages: ");
 
 	for (i = count = 0; i < OGMB_CNT; i++)
 		if (ogmbs[i].status) {
@@ -1353,7 +1353,7 @@ static int wd7000_show_info(struct seq_file *m, struct Scsi_Host *host)
 			seq_printf(m, "0x%x ", i);
 		}
 
-	seq_printf(m, count ? "\n" : "none\n");
+	seq_puts(m, count ? "\n" : "none\n");
 #endif
 
 	spin_unlock_irqrestore(host->host_lock, flags);
-- 
2.0.4


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

* [PATCH 6/7] scsi: misc: Merge consecutive seq_puts calls
  2014-11-29  0:34 [PATCH 0/7] scsi: Some seq_file cleanups/optimizations Rasmus Villemoes
                   ` (4 preceding siblings ...)
  2014-11-29  0:34 ` [PATCH 5/7] scsi: misc: " Rasmus Villemoes
@ 2014-11-29  0:34 ` Rasmus Villemoes
  2014-11-29  0:34 ` [PATCH 7/7] scsi: misc: Print single-character strings with seq_putc Rasmus Villemoes
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 26+ messages in thread
From: Rasmus Villemoes @ 2014-11-29  0:34 UTC (permalink / raw)
  To: James E.J. Bottomley; +Cc: linux-scsi, linux-kernel

Consecutive seq_puts calls with literal strings may be replaced by a
single call, saving a little .text.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 drivers/scsi/advansys.c      | 40 ++++++++++++++--------------------------
 drivers/scsi/atp870u.c       |  5 ++---
 drivers/scsi/dc395x.c        |  4 ++--
 drivers/scsi/pcmcia/nsp_cs.c |  4 ++--
 4 files changed, 20 insertions(+), 33 deletions(-)

diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 720faea..76e7610 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -2903,10 +2903,9 @@ static void asc_prt_adv_bios(struct seq_file *m, struct Scsi_Host *shost)
 	 * the BIOS code segment base address.
 	 */
 	if (boardp->bios_signature != 0x55AA) {
-		seq_puts(m, "Disabled or Pre-3.1\n");
-		seq_puts(m,
-			 "BIOS either disabled or Pre-3.1. If it is pre-3.1, then a newer version\n");
 		seq_puts(m,
+			 "Disabled or Pre-3.1\n"
+			 "BIOS either disabled or Pre-3.1. If it is pre-3.1, then a newer version\n"
 			 "can be found at the ConnectCom FTP site: ftp://ftp.connectcom.net/pub\n");
 	} else {
 		major = (boardp->bios_version >> 12) & 0xF;
@@ -2923,9 +2922,8 @@ static void asc_prt_adv_bios(struct seq_file *m, struct Scsi_Host *shost)
 		 */
 		if (major < 3 || (major <= 3 && minor < 1) ||
 		    (major <= 3 && minor <= 1 && letter < ('I' - 'A'))) {
-			seq_puts(m,
-				 "Newer version of ROM BIOS is available at the ConnectCom FTP site:\n");
-			seq_puts(m, "ftp://ftp.connectcom.net/pub\n");
+			seq_puts(m, "Newer version of ROM BIOS is available at the ConnectCom FTP site:\n"
+				    "ftp://ftp.connectcom.net/pub\n");
 		}
 	}
 }
@@ -3071,27 +3069,23 @@ static void asc_prt_asc_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 	seq_puts(m, " Target ID:           ");
 	for (i = 0; i <= ASC_MAX_TID; i++)
 		seq_printf(m, " %d", i);
-	seq_puts(m, "\n");
 
-	seq_puts(m, " Disconnects:         ");
+	seq_puts(m, "\n Disconnects:         ");
 	for (i = 0; i <= ASC_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (ep->disc_enable & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_puts(m, "\n");
 
-	seq_puts(m, " Command Queuing:     ");
+	seq_puts(m, "\n Command Queuing:     ");
 	for (i = 0; i <= ASC_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (ep->use_cmd_qng & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_puts(m, "\n");
 
-	seq_puts(m, " Start Motor:         ");
+	seq_puts(m, "\n Start Motor:         ");
 	for (i = 0; i <= ASC_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (ep->start_motor & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_puts(m, "\n");
 
-	seq_puts(m, " Synchronous Transfer:");
+	seq_puts(m, "\n Synchronous Transfer:");
 	for (i = 0; i <= ASC_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (ep->init_sdtr & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
@@ -3410,10 +3404,9 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
 			   i,
 			   (v->use_tagged_qng & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
 	}
-	seq_puts(m, "\n");
 
 	/* Current number of commands waiting for a device. */
-	seq_puts(m, " Command Queue Pending:");
+	seq_puts(m, "\n Command Queue Pending:");
 	for (i = 0; i <= ASC_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3421,10 +3414,9 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
 		}
 		seq_printf(m, " %X:%u", i, v->cur_dvc_qng[i]);
 	}
-	seq_puts(m, "\n");
 
 	/* Current limit on number of commands that can be sent to a device. */
-	seq_puts(m, " Command Queue Limit:");
+	seq_puts(m, "\n Command Queue Limit:");
 	for (i = 0; i <= ASC_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3432,10 +3424,9 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
 		}
 		seq_printf(m, " %X:%u", i, v->max_dvc_qng[i]);
 	}
-	seq_puts(m, "\n");
 
 	/* Indicate whether the device has returned queue full status. */
-	seq_puts(m, " Command Queue Full:");
+	seq_puts(m, "\n Command Queue Full:");
 	for (i = 0; i <= ASC_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3447,9 +3438,8 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
 		else
 			seq_printf(m, " %X:N", i);
 	}
-	seq_puts(m, "\n");
 
-	seq_puts(m, " Synchronous Transfer:");
+	seq_puts(m, "\n Synchronous Transfer:");
 	for (i = 0; i <= ASC_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3556,9 +3546,8 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 			   i,
 			   (tagqng_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
 	}
-	seq_puts(m, "\n");
 
-	seq_puts(m, " Queue Limit:");
+	seq_puts(m, "\n Queue Limit:");
 	for (i = 0; i <= ADV_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3570,9 +3559,8 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 
 		seq_printf(m, " %X:%d", i, lrambyte);
 	}
-	seq_puts(m, "\n");
 
-	seq_puts(m, " Command Pending:");
+	seq_puts(m, "\n Command Pending:");
 	for (i = 0; i <= ADV_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c
index 0b02467..603239e 100644
--- a/drivers/scsi/atp870u.c
+++ b/drivers/scsi/atp870u.c
@@ -3101,9 +3101,8 @@ static const char *atp870u_info(struct Scsi_Host *notused)
 
 static int atp870u_show_info(struct seq_file *m, struct Scsi_Host *HBAptr)
 {
-	seq_puts(m, "ACARD AEC-671X Driver Version: 2.6+ac\n");
-	seq_puts(m, "\n");
-	seq_puts(m, "Adapter Configuration:\n");
+	seq_puts(m, "ACARD AEC-671X Driver Version: 2.6+ac\n\n"
+		    "Adapter Configuration:\n");
 	seq_printf(m, "               Base IO: %#.4lx\n", HBAptr->io_port);
 	seq_printf(m, "                   IRQ: %d\n", HBAptr->irq);
 	return 0;
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
index 613a773..baff2d9 100644
--- a/drivers/scsi/dc395x.c
+++ b/drivers/scsi/dc395x.c
@@ -4623,8 +4623,8 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
 	unsigned long flags;
 	int dev;
 
-	seq_puts(m, DC395X_BANNER " PCI SCSI Host Adapter\n");
-	seq_puts(m, " Driver Version " DC395X_VERSION "\n");
+	seq_puts(m, DC395X_BANNER " PCI SCSI Host Adapter\n"
+		    " Driver Version " DC395X_VERSION "\n");
 
 	DC395x_LOCK_IO(acb->scsi_host, flags);
 
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index bf883a6..b0c8643 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -1375,8 +1375,8 @@ static int nsp_show_info(struct seq_file *m, struct Scsi_Host *host)
 	hostno = host->host_no;
 	data = (nsp_hw_data *)host->hostdata;
 
-	seq_puts(m, "NinjaSCSI status\n\n");
-	seq_puts(m, "Driver version:        $Revision: 1.23 $\n");
+	seq_puts(m, "NinjaSCSI status\n\n"
+		    "Driver version:        $Revision: 1.23 $\n");
 	seq_printf(m, "SCSI host No.:         %d\n",          hostno);
 	seq_printf(m, "IRQ:                   %d\n",          host->irq);
 	seq_printf(m, "IO:                    0x%lx-0x%lx\n", host->io_port, host->io_port + host->n_io_port - 1);
-- 
2.0.4


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

* [PATCH 7/7] scsi: misc: Print single-character strings with seq_putc
  2014-11-29  0:34 [PATCH 0/7] scsi: Some seq_file cleanups/optimizations Rasmus Villemoes
                   ` (5 preceding siblings ...)
  2014-11-29  0:34 ` [PATCH 6/7] scsi: misc: Merge consecutive seq_puts calls Rasmus Villemoes
@ 2014-11-29  0:34 ` Rasmus Villemoes
  2014-11-30  6:40 ` [PATCH 0/7] scsi: Some seq_file cleanups/optimizations Finn Thain
  2014-12-02 23:10 ` [PATCH v2 0/6] " Rasmus Villemoes
  8 siblings, 0 replies; 26+ messages in thread
From: Rasmus Villemoes @ 2014-11-29  0:34 UTC (permalink / raw)
  To: James E.J. Bottomley; +Cc: linux-scsi, linux-kernel

Using seq_putc to print a single character saves at least a strlen()
call and a memory access, and may also give a small .text reduction.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 drivers/scsi/NCR5380.c              |  2 +-
 drivers/scsi/advansys.c             | 34 +++++++++++++++++-----------------
 drivers/scsi/aha152x.c              |  2 +-
 drivers/scsi/aic7xxx/aic79xx_proc.c | 10 +++++-----
 drivers/scsi/aic7xxx/aic7xxx_proc.c | 10 +++++-----
 drivers/scsi/atari_NCR5380.c        |  2 +-
 drivers/scsi/dc395x.c               |  4 ++--
 drivers/scsi/esas2r/esas2r_main.c   |  2 +-
 drivers/scsi/g_NCR5380.c            |  6 +++---
 drivers/scsi/in2000.c               |  2 +-
 drivers/scsi/ips.c                  |  2 +-
 drivers/scsi/nsp32.c                |  2 +-
 drivers/scsi/pcmcia/nsp_cs.c        |  4 ++--
 drivers/scsi/qla2xxx/qla_dfs.c      |  2 +-
 drivers/scsi/scsi_proc.c            | 10 +++++-----
 drivers/scsi/scsi_trace.c           |  2 +-
 drivers/scsi/sun3_NCR5380.c         |  2 +-
 drivers/scsi/wd33c93.c              |  2 +-
 18 files changed, 50 insertions(+), 50 deletions(-)

diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index a2ed965..50cfa9a 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -771,7 +771,7 @@ static void lprint_command(unsigned char *command, struct seq_file *m)
 	lprint_opcode(command[0], m);
 	for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i)
 		seq_printf(m, "%02x ", command[i]);
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 }
 
 static void lprint_opcode(int opcode, struct seq_file *m)
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 76e7610..5f2e4ce 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -3089,7 +3089,7 @@ static void asc_prt_asc_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 	for (i = 0; i <= ASC_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (ep->init_sdtr & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 #ifdef CONFIG_ISA
 	if (asc_dvc_varp->bus_type & ASC_IS_ISA) {
@@ -3204,7 +3204,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 	seq_puts(m, " Target ID:           ");
 	for (i = 0; i <= ADV_MAX_TID; i++)
 		seq_printf(m, " %X", i);
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
 		word = ep_3550->disc_enable;
@@ -3217,7 +3217,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 	for (i = 0; i <= ADV_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
 		word = ep_3550->tagqng_able;
@@ -3230,7 +3230,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 	for (i = 0; i <= ADV_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
 		word = ep_3550->start_motor;
@@ -3243,7 +3243,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 	for (i = 0; i <= ADV_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
 		seq_puts(m, " Synchronous Transfer:");
@@ -3251,7 +3251,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 			seq_printf(m, " %c",
 				   (ep_3550->sdtr_able & ADV_TID_TO_TIDMASK(i)) ?
 				   'Y' : 'N');
-		seq_puts(m, "\n");
+		seq_putc(m, '\n');
 	}
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
@@ -3260,7 +3260,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 			seq_printf(m, " %c",
 				   (ep_3550->ultra_able & ADV_TID_TO_TIDMASK(i))
 				   ? 'Y' : 'N');
-		seq_puts(m, "\n");
+		seq_putc(m, '\n');
 	}
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
@@ -3274,7 +3274,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 	for (i = 0; i <= ADV_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800 ||
 	    adv_dvc_varp->chip_type == ADV_CHIP_ASC38C1600) {
@@ -3319,7 +3319,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 				seq_puts(m, "\n  ");
 			sdtr_speed >>= 4;
 		}
-		seq_puts(m, "\n");
+		seq_putc(m, '\n');
 	}
 }
 
@@ -3449,7 +3449,7 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
 			   i,
 			   (v->sdtr_done & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
 	}
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 	for (i = 0; i <= ASC_MAX_TID; i++) {
 		uchar syn_period_ix;
@@ -3484,7 +3484,7 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
 			seq_puts(m, "*\n");
 			renegotiate = 1;
 		} else {
-			seq_puts(m, "\n");
+			seq_putc(m, '\n');
 		}
 	}
 
@@ -3572,7 +3572,7 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 
 		seq_printf(m, " %X:%d", i, lrambyte);
 	}
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 	AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able);
 	seq_puts(m, " Wide Enabled:");
@@ -3586,7 +3586,7 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 			   i,
 			   (wdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
 	}
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 	AdvReadWordLram(iop_base, ASC_MC_WDTR_DONE, wdtr_done);
 	seq_puts(m, " Transfer Bit Width:");
@@ -3605,11 +3605,11 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 
 		if ((wdtr_able & ADV_TID_TO_TIDMASK(i)) &&
 		    (wdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) {
-			seq_puts(m, "*");
+			seq_putc(m, '*');
 			renegotiate = 1;
 		}
 	}
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 	AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able);
 	seq_puts(m, " Synchronous Enabled:");
@@ -3623,7 +3623,7 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 			   i,
 			   (sdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
 	}
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 	AdvReadWordLram(iop_base, ASC_MC_SDTR_DONE, sdtr_done);
 	for (i = 0; i <= ADV_MAX_TID; i++) {
@@ -3672,7 +3672,7 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 			seq_puts(m, "*\n");
 			renegotiate = 1;
 		} else {
-			seq_puts(m, "\n");
+			seq_putc(m, '\n');
 		}
 	}
 
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index 05cad58..bf13ebf 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -3360,7 +3360,7 @@ static int aha152x_show_info(struct seq_file *m, struct Scsi_Host *shpnt)
 	PDEBUG(debug_locking, "locks");
 	PDEBUG(debug_phases, "phases");
 
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 #endif
 
 	seq_puts(m, "\nqueue status:\n");
diff --git a/drivers/scsi/aic7xxx/aic79xx_proc.c b/drivers/scsi/aic7xxx/aic79xx_proc.c
index e095598..add2da5 100644
--- a/drivers/scsi/aic7xxx/aic79xx_proc.c
+++ b/drivers/scsi/aic7xxx/aic79xx_proc.c
@@ -148,9 +148,9 @@ ahd_format_transinfo(struct seq_file *m, struct ahd_transinfo *tinfo)
 		}
 		seq_printf(m, "%dbit)", 8 * (0x01 << tinfo->width));
 	} else if (freq != 0) {
-		seq_puts(m, ")");
+		seq_putc(m, ')');
 	}
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 }
 
 static void
@@ -294,14 +294,14 @@ ahd_linux_show_info(struct seq_file *m, struct Scsi_Host *shost)
 		seq_puts(m, "Serial EEPROM:\n");
 		for (i = 0; i < sizeof(*ahd->seep_config)/2; i++) {
 			if (((i % 8) == 0) && (i != 0)) {
-				seq_puts(m, "\n");
+				seq_putc(m, '\n');
 			}
 			seq_printf(m, "0x%.4x ",
 				  ((uint16_t*)ahd->seep_config)[i]);
 		}
-		seq_puts(m, "\n");
+		seq_putc(m, '\n');
 	}
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 	if ((ahd->features & AHD_WIDE) == 0)
 		max_targ = 8;
diff --git a/drivers/scsi/aic7xxx/aic7xxx_proc.c b/drivers/scsi/aic7xxx/aic7xxx_proc.c
index 25511ca..1845960 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_proc.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_proc.c
@@ -125,9 +125,9 @@ ahc_format_transinfo(struct seq_file *m, struct ahc_transinfo *tinfo)
 		}
 		seq_printf(m, "%dbit)", 8 * (0x01 << tinfo->width));
 	} else if (freq != 0) {
-		seq_puts(m, ")");
+		seq_putc(m, ')');
 	}
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 }
 
 static void
@@ -308,14 +308,14 @@ ahc_linux_show_info(struct seq_file *m, struct Scsi_Host *shost)
 		seq_puts(m, "Serial EEPROM:\n");
 		for (i = 0; i < sizeof(*ahc->seep_config)/2; i++) {
 			if (((i % 8) == 0) && (i != 0)) {
-				seq_puts(m, "\n");
+				seq_putc(m, '\n');
 			}
 			seq_printf(m, "0x%.4x ",
 				  ((uint16_t*)ahc->seep_config)[i]);
 		}
-		seq_puts(m, "\n");
+		seq_putc(m, '\n');
 	}
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 	max_targ = 16;
 	if ((ahc->features & (AHC_WIDE|AHC_TWIN)) == 0)
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
index 0b5344c..76cdd1b 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -769,7 +769,7 @@ static void show_Scsi_Cmnd(Scsi_Cmnd *cmd, struct seq_file *m)
 	seq_printf(m, "%2d (0x%02x)", command[0], command[0]);
 	for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i)
 		seq_printf(m, " %02x", command[i]);
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 }
 
 static int NCR5380_show_info(struct seq_file *m, struct Scsi_Host *instance)
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
index baff2d9..6877314 100644
--- a/drivers/scsi/dc395x.c
+++ b/drivers/scsi/dc395x.c
@@ -4691,7 +4691,7 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
 	if (timer_pending(&acb->waiting_timer))
 		seq_puts(m, "Waiting queue timer running\n");
 	else
-		seq_puts(m, "\n");
+		seq_putc(m, '\n');
 
 	list_for_each_entry(dcb, &acb->dcb_list, list) {
 		struct ScsiReqBlk *srb;
@@ -4708,7 +4708,7 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
 		list_for_each_entry(srb, &dcb->srb_going_list, list)
 			seq_printf(m, " %p", srb->cmd);
 		if (!list_empty(&dcb->srb_waiting_list) || !list_empty(&dcb->srb_going_list))
-			seq_puts(m, "\n");
+			seq_putc(m, '\n');
 	}
 
 	if (debug_enabled(DBG_1)) {
diff --git a/drivers/scsi/esas2r/esas2r_main.c b/drivers/scsi/esas2r/esas2r_main.c
index 6504a19..facf069 100644
--- a/drivers/scsi/esas2r/esas2r_main.c
+++ b/drivers/scsi/esas2r/esas2r_main.c
@@ -752,7 +752,7 @@ int esas2r_show_info(struct seq_file *m, struct Scsi_Host *sh)
 	if (dev_count == 0)
 		seq_puts(m, "none\n");
 
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 	return 0;
 
 }
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index 36e8145..01f7b6f 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -752,7 +752,7 @@ static void sprint_command(struct seq_file *m, unsigned char *command)
 	sprint_opcode(m, command[0]);
 	for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i)
 		seq_printf(m, "%02x ", command[i]);
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 }
 
 /**
@@ -829,7 +829,7 @@ static int generic_NCR5380_show_info(struct seq_file *m, struct Scsi_Host *scsi_
 	if (hostdata->pendingw)
 		seq_printf(m, "  %d pending writes", hostdata->pendingw);
 	if (hostdata->pendingr || hostdata->pendingw)
-		seq_puts(m, "\n");
+		seq_putc(m, '\n');
 	shost_for_each_device(dev, scsi_ptr) {
 		unsigned long br = hostdata->bytes_read[dev->id];
 		unsigned long bw = hostdata->bytes_write[dev->id];
@@ -857,7 +857,7 @@ static int generic_NCR5380_show_info(struct seq_file *m, struct Scsi_Host *scsi_
 		seq_printf(m, "\n%10ld kb written in %5ld secs", bw / 1024, tw);
 		if (tw)
 			seq_printf(m, " @ %5ld bps", bw / tw);
-		seq_puts(m, "\n");
+		seq_putc(m, '\n');
 	}
 #endif
 
diff --git a/drivers/scsi/in2000.c b/drivers/scsi/in2000.c
index a73395e..3882d9f 100644
--- a/drivers/scsi/in2000.c
+++ b/drivers/scsi/in2000.c
@@ -2273,7 +2273,7 @@ static int in2000_show_info(struct seq_file *m, struct Scsi_Host *instance)
 	if (hd->proc & PR_TEST) {
 		;		/* insert your own custom function here */
 	}
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 	spin_unlock_irqrestore(instance->host_lock, flags);
 #endif				/* PROC_INTERFACE */
 	return 0;
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index 06b9d0c..903f845 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -2137,7 +2137,7 @@ ips_host_info(ips_ha_t *ha, struct seq_file *m)
 	seq_printf(m, "\tCurrent Active PT Commands        : %d\n",
 		  ha->num_ioctl);
 
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 	return 0;
 }
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
index 8f6b1b4..c6077ce 100644
--- a/drivers/scsi/nsp32.c
+++ b/drivers/scsi/nsp32.c
@@ -1509,7 +1509,7 @@ static int nsp32_show_info(struct seq_file *m, struct Scsi_Host *host)
 				data->target[id].offset
 				);
 		}
-		seq_puts(m, "\n");
+		seq_putc(m, '\n');
 	}
 	return 0;
 }
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index b0c8643..105a139 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -1398,7 +1398,7 @@ static int nsp_show_info(struct seq_file *m, struct Scsi_Host *host)
 		seq_puts(m, "???");
 		break;
 	}
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 
 	spin_lock_irqsave(&(data->Lock), flags);
@@ -1439,7 +1439,7 @@ static int nsp_show_info(struct seq_file *m, struct Scsi_Host *host)
 				data->Sync[id].SyncOffset
 				);
 		}
-		seq_puts(m, "\n");
+		seq_putc(m, '\n');
 	}
 	return 0;
 }
diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c
index c837ba3..15cf074 100644
--- a/drivers/scsi/qla2xxx/qla_dfs.c
+++ b/drivers/scsi/qla2xxx/qla_dfs.c
@@ -38,7 +38,7 @@ qla2x00_dfs_fce_show(struct seq_file *s, void *unused)
 			seq_printf(s, "\n%llx: ",
 			    (unsigned long long)((cnt * 4) + fce_start));
 		else
-			seq_puts(s, " ");
+			seq_putc(s, ' ');
 		seq_printf(s, "%08x", *fce++);
 	}
 
diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c
index 581de8f..251598e 100644
--- a/drivers/scsi/scsi_proc.c
+++ b/drivers/scsi/scsi_proc.c
@@ -191,7 +191,7 @@ static int proc_print_scsidevice(struct device *dev, void *data)
 		if (sdev->vendor[i] >= 0x20)
 			seq_putc(s, sdev->vendor[i]);
 		else
-			seq_puts(s, " ");
+			seq_putc(s, ' ');
 	}
 
 	seq_puts(s, " Model: ");
@@ -199,7 +199,7 @@ static int proc_print_scsidevice(struct device *dev, void *data)
 		if (sdev->model[i] >= 0x20)
 			seq_putc(s, sdev->model[i]);
 		else
-			seq_puts(s, " ");
+			seq_putc(s, ' ');
 	}
 
 	seq_puts(s, " Rev: ");
@@ -207,10 +207,10 @@ static int proc_print_scsidevice(struct device *dev, void *data)
 		if (sdev->rev[i] >= 0x20)
 			seq_putc(s, sdev->rev[i]);
 		else
-			seq_puts(s, " ");
+			seq_putc(s, ' ');
 	}
 
-	seq_puts(s, "\n");
+	seq_putc(s, '\n');
 
 	seq_printf(s, "  Type:   %s ", scsi_device_type(sdev->type));
 	seq_printf(s, "               ANSI  SCSI revision: %02x",
@@ -218,7 +218,7 @@ static int proc_print_scsidevice(struct device *dev, void *data)
 	if (sdev->scsi_level == 2)
 		seq_puts(s, " CCS\n");
 	else
-		seq_puts(s, "\n");
+		seq_putc(s, '\n');
 
 out:
 	return 0;
diff --git a/drivers/scsi/scsi_trace.c b/drivers/scsi/scsi_trace.c
index e4e122b..5cc386c 100644
--- a/drivers/scsi/scsi_trace.c
+++ b/drivers/scsi/scsi_trace.c
@@ -249,7 +249,7 @@ scsi_trace_misc(struct trace_seq *p, unsigned char *cdb, int len)
 {
 	const char *ret = trace_seq_buffer_ptr(p);
 
-	trace_seq_puts(p, "-");
+	trace_seq_putc(p, '-');
 	trace_seq_putc(p, 0);
 
 	return ret;
diff --git a/drivers/scsi/sun3_NCR5380.c b/drivers/scsi/sun3_NCR5380.c
index 3011df8..23ede8e 100644
--- a/drivers/scsi/sun3_NCR5380.c
+++ b/drivers/scsi/sun3_NCR5380.c
@@ -715,7 +715,7 @@ static void show_Scsi_Cmnd(Scsi_Cmnd *cmd, struct seq_file *m)
 	seq_printf(m, "%2d (0x%02x)", command[0], command[0]);
 	for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i)
 		seq_printf(m, " %02x", command[i]);
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 }
 
 static int NCR5380_show_info(struct seq_file *m, struct Scsi_Host *instance)
diff --git a/drivers/scsi/wd33c93.c b/drivers/scsi/wd33c93.c
index 6e041a7..9e09da4 100644
--- a/drivers/scsi/wd33c93.c
+++ b/drivers/scsi/wd33c93.c
@@ -2192,7 +2192,7 @@ wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance)
 			cmd = (struct scsi_cmnd *) cmd->host_scribble;
 		}
 	}
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 	spin_unlock_irq(&hd->lock);
 #endif				/* PROC_INTERFACE */
 	return 0;
-- 
2.0.4


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

* Re: [PATCH 0/7] scsi: Some seq_file cleanups/optimizations
  2014-11-29  0:34 [PATCH 0/7] scsi: Some seq_file cleanups/optimizations Rasmus Villemoes
                   ` (6 preceding siblings ...)
  2014-11-29  0:34 ` [PATCH 7/7] scsi: misc: Print single-character strings with seq_putc Rasmus Villemoes
@ 2014-11-30  6:40 ` Finn Thain
  2014-12-02 23:10 ` [PATCH v2 0/6] " Rasmus Villemoes
  8 siblings, 0 replies; 26+ messages in thread
From: Finn Thain @ 2014-11-30  6:40 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: James E.J. Bottomley, linux-scsi, linux-kernel


On Sat, 29 Nov 2014, Rasmus Villemoes wrote:

> These patches mostly replace seq_printf with simpler and faster 
> equivalents, e.g. seq_printf(m, "something") => seq_puts(m, "something") 
> and seq_printf(m, "\n") => seq_putc(m, '\n). But before my Coccinelle 
> scripts could be unleashed I had to clean up some unnecessary, and in 
> the PRINTP case quite obfuscating, macros.

Nice cleanup.

FYI, the PRINTP and *_RELEASE macros and others have been removed already 
as part of a patch series that covers all of the NCR5380 drivers.

That patch series is queued for v3.19: 
git://git.infradead.org/users/hch/scsi-queue.git drivers-for-3.19

Some of your patches to NCR5380.c, atari_NCR5380.c, g_NCR5380.c, 
sun3_NCR5380.c will not apply to that branch.

It isn't my job to resolve merge conflicts, but seeing as the patches you 
sent were generated by Coccinelle scripts then perhaps it would be better 
to re-run them against the drivers branch (?)

> 
> The patches don't change the semantics of the code (well, that's the
> idea anyway), but should make it slightly smaller and faster.
> 
> Rasmus Villemoes (7):
>   scsi: Remove SPRINTF macro
>   scsi/g_NCR5380: Remove obfuscating macros
>   scsi/advansys: Replace seq_printf with seq_puts
>   scsi/aha152x: Replace seq_printf with seq_puts
>   scsi: misc:  Replace seq_printf with seq_puts
>   scsi: misc: Merge consecutive seq_puts calls
>   scsi: misc: Print single-character strings with seq_putc
> 
>  drivers/scsi/BusLogic.c             |  10 +-
>  drivers/scsi/NCR5380.c              |  42 +++--
>  drivers/scsi/advansys.c             | 145 ++++++++---------
>  drivers/scsi/aha152x.c              | 301 ++++++++++++++++++------------------
>  drivers/scsi/aic7xxx/aic79xx_proc.c |  38 +++--
>  drivers/scsi/aic7xxx/aic7xxx_proc.c |  24 +--
>  drivers/scsi/arm/fas216.c           |   6 +-
>  drivers/scsi/atari_NCR5380.c        |   4 +-
>  drivers/scsi/atp870u.c              |   5 +-
>  drivers/scsi/dc395x.c               |  78 +++++-----
>  drivers/scsi/dpt_i2o.c              |   2 +-
>  drivers/scsi/eata_pio.c             |   2 +-
>  drivers/scsi/esas2r/esas2r_main.c   |   2 +-
>  drivers/scsi/g_NCR5380.c            |  66 ++++----
>  drivers/scsi/gdth_proc.c            |  24 +--
>  drivers/scsi/in2000.c               |  18 +--
>  drivers/scsi/ips.c                  |   7 +-
>  drivers/scsi/megaraid.c             |   2 +-
>  drivers/scsi/nsp32.c                |  41 +++--
>  drivers/scsi/pcmcia/nsp_cs.c        |  50 +++---
>  drivers/scsi/qla2xxx/qla_dfs.c      |   8 +-
>  drivers/scsi/scsi_proc.c            |  22 +--
>  drivers/scsi/scsi_trace.c           |   6 +-
>  drivers/scsi/sun3_NCR5380.c         |   4 +-
>  drivers/scsi/wd33c93.c              |  18 +--
>  drivers/scsi/wd7000.c               |  41 +++--
>  26 files changed, 460 insertions(+), 506 deletions(-)
> 
> 

-- 

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

* [PATCH v2 0/6] scsi: Some seq_file cleanups/optimizations
  2014-11-29  0:34 [PATCH 0/7] scsi: Some seq_file cleanups/optimizations Rasmus Villemoes
                   ` (7 preceding siblings ...)
  2014-11-30  6:40 ` [PATCH 0/7] scsi: Some seq_file cleanups/optimizations Finn Thain
@ 2014-12-02 23:10 ` Rasmus Villemoes
  2014-12-02 23:10   ` [PATCH v2 1/6] scsi: Remove SPRINTF macro Rasmus Villemoes
                     ` (7 more replies)
  8 siblings, 8 replies; 26+ messages in thread
From: Rasmus Villemoes @ 2014-12-02 23:10 UTC (permalink / raw)
  To: James E.J. Bottomley, Finn Thain
  Cc: linux-scsi, linux-kernel, Rasmus Villemoes

These patches mostly replace seq_printf with simpler and faster
equivalents, e.g. seq_printf(m, "something") => seq_puts(m,
"something") and seq_printf(m, "\n") => seq_putc(m, '\n). But before
my Coccinelle scripts could be unleashed I had to clean up an
unnecessary macro.

The patches don't change the semantics of the code (well, that's the
idea anyway), but should make it slightly smaller and faster.

v2: Redone on top of git://git.infradead.org/users/hch/scsi-queue.git drivers-for-3.19

Rasmus Villemoes (6):
  scsi: Remove SPRINTF macro
  scsi/advansys: Replace seq_printf with seq_puts
  scsi/aha152x: Replace seq_printf with seq_puts
  scsi: misc:  Replace seq_printf with seq_puts
  scsi: misc: Merge consecutive seq_puts calls
  scsi: misc: Print single-character strings with seq_putc

 drivers/scsi/BusLogic.c             |  10 +-
 drivers/scsi/NCR5380.c              |  20 ++-
 drivers/scsi/advansys.c             | 142 ++++++++---------
 drivers/scsi/aha152x.c              | 295 ++++++++++++++++++------------------
 drivers/scsi/aic7xxx/aic79xx_proc.c |  38 +++--
 drivers/scsi/aic7xxx/aic7xxx_proc.c |  24 +--
 drivers/scsi/arm/fas216.c           |   6 +-
 drivers/scsi/atari_NCR5380.c        |   4 +-
 drivers/scsi/atp870u.c              |   5 +-
 drivers/scsi/dc395x.c               |  79 +++++-----
 drivers/scsi/dpt_i2o.c              |   2 +-
 drivers/scsi/eata_pio.c             |   2 +-
 drivers/scsi/esas2r/esas2r_main.c   |   2 +-
 drivers/scsi/gdth_proc.c            |  24 +--
 drivers/scsi/in2000.c               |  18 +--
 drivers/scsi/ips.c                  |   7 +-
 drivers/scsi/megaraid.c             |   2 +-
 drivers/scsi/nsp32.c                |  41 +++--
 drivers/scsi/pcmcia/nsp_cs.c        |  50 +++---
 drivers/scsi/qla2xxx/qla_dfs.c      |   8 +-
 drivers/scsi/scsi_proc.c            |  22 +--
 drivers/scsi/scsi_trace.c           |   6 +-
 drivers/scsi/wd33c93.c              |  18 +--
 drivers/scsi/wd7000.c               |  41 +++--
 24 files changed, 412 insertions(+), 454 deletions(-)

-- 
2.0.4


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

* [PATCH v2 1/6] scsi: Remove SPRINTF macro
  2014-12-02 23:10 ` [PATCH v2 0/6] " Rasmus Villemoes
@ 2014-12-02 23:10   ` Rasmus Villemoes
  2015-01-30  1:37     ` Finn Thain
  2014-12-02 23:10   ` [PATCH v2 2/6] scsi/advansys: Replace seq_printf with seq_puts Rasmus Villemoes
                     ` (6 subsequent siblings)
  7 siblings, 1 reply; 26+ messages in thread
From: Rasmus Villemoes @ 2014-12-02 23:10 UTC (permalink / raw)
  To: James E.J. Bottomley, Finn Thain
  Cc: linux-scsi, linux-kernel, Rasmus Villemoes

The macro SPRINTF doesn't save a lot of typing or make the code more
readable, and depending on a specific identifier (m) in the
surrounding scope is generally frowned upon. Nuke it.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 drivers/scsi/NCR5380.c       |  20 ++-
 drivers/scsi/aha152x.c       | 295 +++++++++++++++++++++----------------------
 drivers/scsi/dc395x.c        |  78 ++++++------
 drivers/scsi/nsp32.c         |  41 +++---
 drivers/scsi/pcmcia/nsp_cs.c |  50 ++++----
 drivers/scsi/wd7000.c        |  41 +++---
 6 files changed, 252 insertions(+), 273 deletions(-)

diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index 36244d6..aca181e 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -716,8 +716,6 @@ static int __maybe_unused NCR5380_write_info(struct Scsi_Host *instance,
 }
 #endif
 
-#undef SPRINTF
-#define SPRINTF(args...) seq_printf(m, ## args)
 static
 void lprint_Scsi_Cmnd(struct scsi_cmnd *cmd, struct seq_file *m);
 static
@@ -734,19 +732,19 @@ static int __maybe_unused NCR5380_show_info(struct seq_file *m,
 	hostdata = (struct NCR5380_hostdata *) instance->hostdata;
 
 #ifdef PSEUDO_DMA
-	SPRINTF("Highwater I/O busy spin counts: write %d, read %d\n",
+	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_irq(instance->host_lock);
 	if (!hostdata->connected)
-		SPRINTF("scsi%d: no currently connected command\n", instance->host_no);
+		seq_printf(m, "scsi%d: no currently connected command\n", instance->host_no);
 	else
 		lprint_Scsi_Cmnd((struct scsi_cmnd *) hostdata->connected, m);
-	SPRINTF("scsi%d: issue_queue\n", instance->host_no);
+	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);
 
-	SPRINTF("scsi%d: disconnected_queue\n", instance->host_no);
+	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_irq(instance->host_lock);
@@ -755,8 +753,8 @@ static int __maybe_unused NCR5380_show_info(struct seq_file *m,
 
 static void lprint_Scsi_Cmnd(struct scsi_cmnd *cmd, struct seq_file *m)
 {
-	SPRINTF("scsi%d : destination target %d, lun %llu\n", cmd->device->host->host_no, cmd->device->id, cmd->device->lun);
-	SPRINTF("        command = ");
+	seq_printf(m, "scsi%d : destination target %d, lun %llu\n", cmd->device->host->host_no, cmd->device->id, cmd->device->lun);
+	seq_printf(m, "        command = ");
 	lprint_command(cmd->cmnd, m);
 }
 
@@ -765,13 +763,13 @@ 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)
-		SPRINTF("%02x ", command[i]);
-	SPRINTF("\n");
+		seq_printf(m, "%02x ", command[i]);
+	seq_printf(m, "\n");
 }
 
 static void lprint_opcode(int opcode, struct seq_file *m)
 {
-	SPRINTF("%2d (0x%02x)", opcode, opcode);
+	seq_printf(m, "%2d (0x%02x)", opcode, opcode);
 }
 
 
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index 2b960b3..f14ad8a 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -2490,299 +2490,296 @@ static void show_queues(struct Scsi_Host *shpnt)
 	disp_enintr(shpnt);
 }
 
-#undef SPRINTF
-#define SPRINTF(args...) seq_printf(m, ##args)
-
 static void get_command(struct seq_file *m, Scsi_Cmnd * ptr)
 {
 	int i;
 
-	SPRINTF("%p: target=%d; lun=%d; cmnd=( ",
+	seq_printf(m, "%p: target=%d; lun=%d; cmnd=( ",
 		ptr, ptr->device->id, (u8)ptr->device->lun);
 
 	for (i = 0; i < COMMAND_SIZE(ptr->cmnd[0]); i++)
-		SPRINTF("0x%02x ", ptr->cmnd[i]);
+		seq_printf(m, "0x%02x ", ptr->cmnd[i]);
 
-	SPRINTF("); resid=%d; residual=%d; buffers=%d; phase |",
+	seq_printf(m, "); resid=%d; residual=%d; buffers=%d; phase |",
 		scsi_get_resid(ptr), ptr->SCp.this_residual,
 		ptr->SCp.buffers_residual);
 
 	if (ptr->SCp.phase & not_issued)
-		SPRINTF("not issued|");
+		seq_printf(m, "not issued|");
 	if (ptr->SCp.phase & selecting)
-		SPRINTF("selecting|");
+		seq_printf(m, "selecting|");
 	if (ptr->SCp.phase & disconnected)
-		SPRINTF("disconnected|");
+		seq_printf(m, "disconnected|");
 	if (ptr->SCp.phase & aborted)
-		SPRINTF("aborted|");
+		seq_printf(m, "aborted|");
 	if (ptr->SCp.phase & identified)
-		SPRINTF("identified|");
+		seq_printf(m, "identified|");
 	if (ptr->SCp.phase & completed)
-		SPRINTF("completed|");
+		seq_printf(m, "completed|");
 	if (ptr->SCp.phase & spiordy)
-		SPRINTF("spiordy|");
+		seq_printf(m, "spiordy|");
 	if (ptr->SCp.phase & syncneg)
-		SPRINTF("syncneg|");
-	SPRINTF("; next=0x%p\n", SCNEXT(ptr));
+		seq_printf(m, "syncneg|");
+	seq_printf(m, "; next=0x%p\n", SCNEXT(ptr));
 }
 
 static void get_ports(struct seq_file *m, struct Scsi_Host *shpnt)
 {
 	int s;
 
-	SPRINTF("\n%s: %s(%s) ", CURRENT_SC ? "on bus" : "waiting", states[STATE].name, states[PREVSTATE].name);
+	seq_printf(m, "\n%s: %s(%s) ", CURRENT_SC ? "on bus" : "waiting", states[STATE].name, states[PREVSTATE].name);
 
 	s = GETPORT(SCSISEQ);
-	SPRINTF("SCSISEQ( ");
+	seq_printf(m, "SCSISEQ( ");
 	if (s & TEMODEO)
-		SPRINTF("TARGET MODE ");
+		seq_printf(m, "TARGET MODE ");
 	if (s & ENSELO)
-		SPRINTF("SELO ");
+		seq_printf(m, "SELO ");
 	if (s & ENSELI)
-		SPRINTF("SELI ");
+		seq_printf(m, "SELI ");
 	if (s & ENRESELI)
-		SPRINTF("RESELI ");
+		seq_printf(m, "RESELI ");
 	if (s & ENAUTOATNO)
-		SPRINTF("AUTOATNO ");
+		seq_printf(m, "AUTOATNO ");
 	if (s & ENAUTOATNI)
-		SPRINTF("AUTOATNI ");
+		seq_printf(m, "AUTOATNI ");
 	if (s & ENAUTOATNP)
-		SPRINTF("AUTOATNP ");
+		seq_printf(m, "AUTOATNP ");
 	if (s & SCSIRSTO)
-		SPRINTF("SCSIRSTO ");
-	SPRINTF(");");
+		seq_printf(m, "SCSIRSTO ");
+	seq_printf(m, ");");
 
-	SPRINTF(" SCSISIG(");
+	seq_printf(m, " SCSISIG(");
 	s = GETPORT(SCSISIG);
 	switch (s & P_MASK) {
 	case P_DATAO:
-		SPRINTF("DATA OUT");
+		seq_printf(m, "DATA OUT");
 		break;
 	case P_DATAI:
-		SPRINTF("DATA IN");
+		seq_printf(m, "DATA IN");
 		break;
 	case P_CMD:
-		SPRINTF("COMMAND");
+		seq_printf(m, "COMMAND");
 		break;
 	case P_STATUS:
-		SPRINTF("STATUS");
+		seq_printf(m, "STATUS");
 		break;
 	case P_MSGO:
-		SPRINTF("MESSAGE OUT");
+		seq_printf(m, "MESSAGE OUT");
 		break;
 	case P_MSGI:
-		SPRINTF("MESSAGE IN");
+		seq_printf(m, "MESSAGE IN");
 		break;
 	default:
-		SPRINTF("*invalid*");
+		seq_printf(m, "*invalid*");
 		break;
 	}
 
-	SPRINTF("); ");
+	seq_printf(m, "); ");
 
-	SPRINTF("INTSTAT (%s); ", TESTHI(DMASTAT, INTSTAT) ? "hi" : "lo");
+	seq_printf(m, "INTSTAT (%s); ", TESTHI(DMASTAT, INTSTAT) ? "hi" : "lo");
 
-	SPRINTF("SSTAT( ");
+	seq_printf(m, "SSTAT( ");
 	s = GETPORT(SSTAT0);
 	if (s & TARGET)
-		SPRINTF("TARGET ");
+		seq_printf(m, "TARGET ");
 	if (s & SELDO)
-		SPRINTF("SELDO ");
+		seq_printf(m, "SELDO ");
 	if (s & SELDI)
-		SPRINTF("SELDI ");
+		seq_printf(m, "SELDI ");
 	if (s & SELINGO)
-		SPRINTF("SELINGO ");
+		seq_printf(m, "SELINGO ");
 	if (s & SWRAP)
-		SPRINTF("SWRAP ");
+		seq_printf(m, "SWRAP ");
 	if (s & SDONE)
-		SPRINTF("SDONE ");
+		seq_printf(m, "SDONE ");
 	if (s & SPIORDY)
-		SPRINTF("SPIORDY ");
+		seq_printf(m, "SPIORDY ");
 	if (s & DMADONE)
-		SPRINTF("DMADONE ");
+		seq_printf(m, "DMADONE ");
 
 	s = GETPORT(SSTAT1);
 	if (s & SELTO)
-		SPRINTF("SELTO ");
+		seq_printf(m, "SELTO ");
 	if (s & ATNTARG)
-		SPRINTF("ATNTARG ");
+		seq_printf(m, "ATNTARG ");
 	if (s & SCSIRSTI)
-		SPRINTF("SCSIRSTI ");
+		seq_printf(m, "SCSIRSTI ");
 	if (s & PHASEMIS)
-		SPRINTF("PHASEMIS ");
+		seq_printf(m, "PHASEMIS ");
 	if (s & BUSFREE)
-		SPRINTF("BUSFREE ");
+		seq_printf(m, "BUSFREE ");
 	if (s & SCSIPERR)
-		SPRINTF("SCSIPERR ");
+		seq_printf(m, "SCSIPERR ");
 	if (s & PHASECHG)
-		SPRINTF("PHASECHG ");
+		seq_printf(m, "PHASECHG ");
 	if (s & REQINIT)
-		SPRINTF("REQINIT ");
-	SPRINTF("); ");
+		seq_printf(m, "REQINIT ");
+	seq_printf(m, "); ");
 
 
-	SPRINTF("SSTAT( ");
+	seq_printf(m, "SSTAT( ");
 
 	s = GETPORT(SSTAT0) & GETPORT(SIMODE0);
 
 	if (s & TARGET)
-		SPRINTF("TARGET ");
+		seq_printf(m, "TARGET ");
 	if (s & SELDO)
-		SPRINTF("SELDO ");
+		seq_printf(m, "SELDO ");
 	if (s & SELDI)
-		SPRINTF("SELDI ");
+		seq_printf(m, "SELDI ");
 	if (s & SELINGO)
-		SPRINTF("SELINGO ");
+		seq_printf(m, "SELINGO ");
 	if (s & SWRAP)
-		SPRINTF("SWRAP ");
+		seq_printf(m, "SWRAP ");
 	if (s & SDONE)
-		SPRINTF("SDONE ");
+		seq_printf(m, "SDONE ");
 	if (s & SPIORDY)
-		SPRINTF("SPIORDY ");
+		seq_printf(m, "SPIORDY ");
 	if (s & DMADONE)
-		SPRINTF("DMADONE ");
+		seq_printf(m, "DMADONE ");
 
 	s = GETPORT(SSTAT1) & GETPORT(SIMODE1);
 
 	if (s & SELTO)
-		SPRINTF("SELTO ");
+		seq_printf(m, "SELTO ");
 	if (s & ATNTARG)
-		SPRINTF("ATNTARG ");
+		seq_printf(m, "ATNTARG ");
 	if (s & SCSIRSTI)
-		SPRINTF("SCSIRSTI ");
+		seq_printf(m, "SCSIRSTI ");
 	if (s & PHASEMIS)
-		SPRINTF("PHASEMIS ");
+		seq_printf(m, "PHASEMIS ");
 	if (s & BUSFREE)
-		SPRINTF("BUSFREE ");
+		seq_printf(m, "BUSFREE ");
 	if (s & SCSIPERR)
-		SPRINTF("SCSIPERR ");
+		seq_printf(m, "SCSIPERR ");
 	if (s & PHASECHG)
-		SPRINTF("PHASECHG ");
+		seq_printf(m, "PHASECHG ");
 	if (s & REQINIT)
-		SPRINTF("REQINIT ");
-	SPRINTF("); ");
+		seq_printf(m, "REQINIT ");
+	seq_printf(m, "); ");
 
-	SPRINTF("SXFRCTL0( ");
+	seq_printf(m, "SXFRCTL0( ");
 
 	s = GETPORT(SXFRCTL0);
 	if (s & SCSIEN)
-		SPRINTF("SCSIEN ");
+		seq_printf(m, "SCSIEN ");
 	if (s & DMAEN)
-		SPRINTF("DMAEN ");
+		seq_printf(m, "DMAEN ");
 	if (s & CH1)
-		SPRINTF("CH1 ");
+		seq_printf(m, "CH1 ");
 	if (s & CLRSTCNT)
-		SPRINTF("CLRSTCNT ");
+		seq_printf(m, "CLRSTCNT ");
 	if (s & SPIOEN)
-		SPRINTF("SPIOEN ");
+		seq_printf(m, "SPIOEN ");
 	if (s & CLRCH1)
-		SPRINTF("CLRCH1 ");
-	SPRINTF("); ");
+		seq_printf(m, "CLRCH1 ");
+	seq_printf(m, "); ");
 
-	SPRINTF("SIGNAL( ");
+	seq_printf(m, "SIGNAL( ");
 
 	s = GETPORT(SCSISIG);
 	if (s & SIG_ATNI)
-		SPRINTF("ATNI ");
+		seq_printf(m, "ATNI ");
 	if (s & SIG_SELI)
-		SPRINTF("SELI ");
+		seq_printf(m, "SELI ");
 	if (s & SIG_BSYI)
-		SPRINTF("BSYI ");
+		seq_printf(m, "BSYI ");
 	if (s & SIG_REQI)
-		SPRINTF("REQI ");
+		seq_printf(m, "REQI ");
 	if (s & SIG_ACKI)
-		SPRINTF("ACKI ");
-	SPRINTF("); ");
+		seq_printf(m, "ACKI ");
+	seq_printf(m, "); ");
 
-	SPRINTF("SELID(%02x), ", GETPORT(SELID));
+	seq_printf(m, "SELID(%02x), ", GETPORT(SELID));
 
-	SPRINTF("STCNT(%d), ", GETSTCNT());
+	seq_printf(m, "STCNT(%d), ", GETSTCNT());
 
-	SPRINTF("SSTAT2( ");
+	seq_printf(m, "SSTAT2( ");
 
 	s = GETPORT(SSTAT2);
 	if (s & SOFFSET)
-		SPRINTF("SOFFSET ");
+		seq_printf(m, "SOFFSET ");
 	if (s & SEMPTY)
-		SPRINTF("SEMPTY ");
+		seq_printf(m, "SEMPTY ");
 	if (s & SFULL)
-		SPRINTF("SFULL ");
-	SPRINTF("); SFCNT (%d); ", s & (SFULL | SFCNT));
+		seq_printf(m, "SFULL ");
+	seq_printf(m, "); SFCNT (%d); ", s & (SFULL | SFCNT));
 
 	s = GETPORT(SSTAT3);
-	SPRINTF("SCSICNT (%d), OFFCNT(%d), ", (s & 0xf0) >> 4, s & 0x0f);
+	seq_printf(m, "SCSICNT (%d), OFFCNT(%d), ", (s & 0xf0) >> 4, s & 0x0f);
 
-	SPRINTF("SSTAT4( ");
+	seq_printf(m, "SSTAT4( ");
 	s = GETPORT(SSTAT4);
 	if (s & SYNCERR)
-		SPRINTF("SYNCERR ");
+		seq_printf(m, "SYNCERR ");
 	if (s & FWERR)
-		SPRINTF("FWERR ");
+		seq_printf(m, "FWERR ");
 	if (s & FRERR)
-		SPRINTF("FRERR ");
-	SPRINTF("); ");
+		seq_printf(m, "FRERR ");
+	seq_printf(m, "); ");
 
-	SPRINTF("DMACNTRL0( ");
+	seq_printf(m, "DMACNTRL0( ");
 	s = GETPORT(DMACNTRL0);
-	SPRINTF("%s ", s & _8BIT ? "8BIT" : "16BIT");
-	SPRINTF("%s ", s & DMA ? "DMA" : "PIO");
-	SPRINTF("%s ", s & WRITE_READ ? "WRITE" : "READ");
+	seq_printf(m, "%s ", s & _8BIT ? "8BIT" : "16BIT");
+	seq_printf(m, "%s ", s & DMA ? "DMA" : "PIO");
+	seq_printf(m, "%s ", s & WRITE_READ ? "WRITE" : "READ");
 	if (s & ENDMA)
-		SPRINTF("ENDMA ");
+		seq_printf(m, "ENDMA ");
 	if (s & INTEN)
-		SPRINTF("INTEN ");
+		seq_printf(m, "INTEN ");
 	if (s & RSTFIFO)
-		SPRINTF("RSTFIFO ");
+		seq_printf(m, "RSTFIFO ");
 	if (s & SWINT)
-		SPRINTF("SWINT ");
-	SPRINTF("); ");
+		seq_printf(m, "SWINT ");
+	seq_printf(m, "); ");
 
-	SPRINTF("DMASTAT( ");
+	seq_printf(m, "DMASTAT( ");
 	s = GETPORT(DMASTAT);
 	if (s & ATDONE)
-		SPRINTF("ATDONE ");
+		seq_printf(m, "ATDONE ");
 	if (s & WORDRDY)
-		SPRINTF("WORDRDY ");
+		seq_printf(m, "WORDRDY ");
 	if (s & DFIFOFULL)
-		SPRINTF("DFIFOFULL ");
+		seq_printf(m, "DFIFOFULL ");
 	if (s & DFIFOEMP)
-		SPRINTF("DFIFOEMP ");
-	SPRINTF(")\n");
+		seq_printf(m, "DFIFOEMP ");
+	seq_printf(m, ")\n");
 
-	SPRINTF("enabled interrupts( ");
+	seq_printf(m, "enabled interrupts( ");
 
 	s = GETPORT(SIMODE0);
 	if (s & ENSELDO)
-		SPRINTF("ENSELDO ");
+		seq_printf(m, "ENSELDO ");
 	if (s & ENSELDI)
-		SPRINTF("ENSELDI ");
+		seq_printf(m, "ENSELDI ");
 	if (s & ENSELINGO)
-		SPRINTF("ENSELINGO ");
+		seq_printf(m, "ENSELINGO ");
 	if (s & ENSWRAP)
-		SPRINTF("ENSWRAP ");
+		seq_printf(m, "ENSWRAP ");
 	if (s & ENSDONE)
-		SPRINTF("ENSDONE ");
+		seq_printf(m, "ENSDONE ");
 	if (s & ENSPIORDY)
-		SPRINTF("ENSPIORDY ");
+		seq_printf(m, "ENSPIORDY ");
 	if (s & ENDMADONE)
-		SPRINTF("ENDMADONE ");
+		seq_printf(m, "ENDMADONE ");
 
 	s = GETPORT(SIMODE1);
 	if (s & ENSELTIMO)
-		SPRINTF("ENSELTIMO ");
+		seq_printf(m, "ENSELTIMO ");
 	if (s & ENATNTARG)
-		SPRINTF("ENATNTARG ");
+		seq_printf(m, "ENATNTARG ");
 	if (s & ENPHASEMIS)
-		SPRINTF("ENPHASEMIS ");
+		seq_printf(m, "ENPHASEMIS ");
 	if (s & ENBUSFREE)
-		SPRINTF("ENBUSFREE ");
+		seq_printf(m, "ENBUSFREE ");
 	if (s & ENSCSIPERR)
-		SPRINTF("ENSCSIPERR ");
+		seq_printf(m, "ENSCSIPERR ");
 	if (s & ENPHASECHG)
-		SPRINTF("ENPHASECHG ");
+		seq_printf(m, "ENPHASECHG ");
 	if (s & ENREQINIT)
-		SPRINTF("ENREQINIT ");
-	SPRINTF(")\n");
+		seq_printf(m, "ENREQINIT ");
+	seq_printf(m, ")\n");
 }
 
 static int aha152x_set_info(struct Scsi_Host *shpnt, char *buffer, int length)
@@ -2825,56 +2822,56 @@ static int aha152x_show_info(struct seq_file *m, struct Scsi_Host *shpnt)
 	Scsi_Cmnd *ptr;
 	unsigned long flags;
 
-	SPRINTF(AHA152X_REVID "\n");
+	seq_printf(m, AHA152X_REVID "\n");
 
-	SPRINTF("ioports 0x%04lx to 0x%04lx\n",
+	seq_printf(m, "ioports 0x%04lx to 0x%04lx\n",
 		shpnt->io_port, shpnt->io_port + shpnt->n_io_port - 1);
-	SPRINTF("interrupt 0x%02x\n", shpnt->irq);
-	SPRINTF("disconnection/reconnection %s\n",
+	seq_printf(m, "interrupt 0x%02x\n", shpnt->irq);
+	seq_printf(m, "disconnection/reconnection %s\n",
 		RECONNECT ? "enabled" : "disabled");
-	SPRINTF("parity checking %s\n",
+	seq_printf(m, "parity checking %s\n",
 		PARITY ? "enabled" : "disabled");
-	SPRINTF("synchronous transfers %s\n",
+	seq_printf(m, "synchronous transfers %s\n",
 		SYNCHRONOUS ? "enabled" : "disabled");
-	SPRINTF("%d commands currently queued\n", HOSTDATA(shpnt)->commands);
+	seq_printf(m, "%d commands currently queued\n", HOSTDATA(shpnt)->commands);
 
 	if(SYNCHRONOUS) {
-		SPRINTF("synchronously operating targets (tick=50 ns):\n");
+		seq_printf(m, "synchronously operating targets (tick=50 ns):\n");
 		for (i = 0; i < 8; i++)
 			if (HOSTDATA(shpnt)->syncrate[i] & 0x7f)
-				SPRINTF("target %d: period %dT/%dns; req/ack offset %d\n",
+				seq_printf(m, "target %d: period %dT/%dns; req/ack offset %d\n",
 					i,
 					(((HOSTDATA(shpnt)->syncrate[i] & 0x70) >> 4) + 2),
 					(((HOSTDATA(shpnt)->syncrate[i] & 0x70) >> 4) + 2) * 50,
 				    HOSTDATA(shpnt)->syncrate[i] & 0x0f);
 	}
-	SPRINTF("\nqueue status:\n");
+	seq_printf(m, "\nqueue status:\n");
 	DO_LOCK(flags);
 	if (ISSUE_SC) {
-		SPRINTF("not yet issued commands:\n");
+		seq_printf(m, "not yet issued commands:\n");
 		for (ptr = ISSUE_SC; ptr; ptr = SCNEXT(ptr))
 			get_command(m, ptr);
 	} else
-		SPRINTF("no not yet issued commands\n");
+		seq_printf(m, "no not yet issued commands\n");
 	DO_UNLOCK(flags);
 
 	if (CURRENT_SC) {
-		SPRINTF("current command:\n");
+		seq_printf(m, "current command:\n");
 		get_command(m, CURRENT_SC);
 	} else
-		SPRINTF("no current command\n");
+		seq_printf(m, "no current command\n");
 
 	if (DISCONNECTED_SC) {
-		SPRINTF("disconnected commands:\n");
+		seq_printf(m, "disconnected commands:\n");
 		for (ptr = DISCONNECTED_SC; ptr; ptr = SCNEXT(ptr))
 			get_command(m, ptr);
 	} else
-		SPRINTF("no disconnected commands\n");
+		seq_printf(m, "no disconnected commands\n");
 
 	get_ports(m, shpnt);
 
 #if defined(AHA152X_STAT)
-	SPRINTF("statistics:\n"
+	seq_printf(m, "statistics:\n"
 		"total commands:               %d\n"
 		"disconnections:               %d\n"
 		"busfree with check condition: %d\n"
@@ -2894,7 +2891,7 @@ static int aha152x_show_info(struct seq_file *m, struct Scsi_Host *shpnt)
 		HOSTDATA(shpnt)->busfree_without_done_command,
 		HOSTDATA(shpnt)->busfree_without_any_action);
 	for(i=0; i<maxstate; i++) {
-		SPRINTF("%-10s %-12d %-12d %-12ld\n",
+		seq_printf(m, "%-10s %-12d %-12d %-12ld\n",
 			states[i].name,
 			HOSTDATA(shpnt)->count_trans[i],
 			HOSTDATA(shpnt)->count[i],
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
index 0c6be0a..0a1ed50 100644
--- a/drivers/scsi/dc395x.c
+++ b/drivers/scsi/dc395x.c
@@ -4610,13 +4610,10 @@ static void adapter_uninit(struct AdapterCtlBlk *acb)
 }
 
 
-#undef SPRINTF
-#define SPRINTF(args...) seq_printf(m,##args)
-
 #undef YESNO
 #define YESNO(YN) \
- if (YN) SPRINTF(" Yes ");\
- else SPRINTF(" No  ")
+ if (YN) seq_printf(m, " Yes ");\
+ else seq_printf(m, " No  ")
 
 static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
 {
@@ -4626,47 +4623,44 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
 	unsigned long flags;
 	int dev;
 
-	SPRINTF(DC395X_BANNER " PCI SCSI Host Adapter\n");
-	SPRINTF(" Driver Version " DC395X_VERSION "\n");
+	seq_printf(m, DC395X_BANNER " PCI SCSI Host Adapter\n");
+	seq_printf(m, " Driver Version " DC395X_VERSION "\n");
 
 	DC395x_LOCK_IO(acb->scsi_host, flags);
 
-	SPRINTF("SCSI Host Nr %i, ", host->host_no);
-	SPRINTF("DC395U/UW/F DC315/U %s\n",
+	seq_printf(m, "SCSI Host Nr %i, ", host->host_no);
+	seq_printf(m, "DC395U/UW/F DC315/U %s\n",
 		(acb->config & HCC_WIDE_CARD) ? "Wide" : "");
-	SPRINTF("io_port_base 0x%04lx, ", acb->io_port_base);
-	SPRINTF("irq_level 0x%04x, ", acb->irq_level);
-	SPRINTF(" SelTimeout %ims\n", (1638 * acb->sel_timeout) / 1000);
+	seq_printf(m, "io_port_base 0x%04lx, ", acb->io_port_base);
+	seq_printf(m, "irq_level 0x%04x, ", acb->irq_level);
+	seq_printf(m, " SelTimeout %ims\n", (1638 * acb->sel_timeout) / 1000);
 
-	SPRINTF("MaxID %i, MaxLUN %llu, ", host->max_id, host->max_lun);
-	SPRINTF("AdapterID %i\n", host->this_id);
+	seq_printf(m, "MaxID %i, MaxLUN %llu, ", host->max_id, host->max_lun);
+	seq_printf(m, "AdapterID %i\n", host->this_id);
 
-	SPRINTF("tag_max_num %i", acb->tag_max_num);
-	/*SPRINTF(", DMA_Status %i\n", DC395x_read8(acb, TRM_S1040_DMA_STATUS)); */
-	SPRINTF(", FilterCfg 0x%02x",
+	seq_printf(m, "tag_max_num %i", acb->tag_max_num);
+	/*seq_printf(m, ", DMA_Status %i\n", DC395x_read8(acb, TRM_S1040_DMA_STATUS)); */
+	seq_printf(m, ", FilterCfg 0x%02x",
 		DC395x_read8(acb, TRM_S1040_SCSI_CONFIG1));
-	SPRINTF(", DelayReset %is\n", acb->eeprom.delay_time);
-	/*SPRINTF("\n"); */
+	seq_printf(m, ", DelayReset %is\n", acb->eeprom.delay_time);
+	/*seq_printf(m, "\n"); */
 
-	SPRINTF("Nr of DCBs: %i\n", list_size(&acb->dcb_list));
-	SPRINTF
-	    ("Map of attached LUNs: %02x %02x %02x %02x %02x %02x %02x %02x\n",
+	seq_printf(m, "Nr of DCBs: %i\n", list_size(&acb->dcb_list));
+	seq_printf(m, "Map of attached LUNs: %02x %02x %02x %02x %02x %02x %02x %02x\n",
 	     acb->dcb_map[0], acb->dcb_map[1], acb->dcb_map[2],
 	     acb->dcb_map[3], acb->dcb_map[4], acb->dcb_map[5],
 	     acb->dcb_map[6], acb->dcb_map[7]);
-	SPRINTF
-	    ("                      %02x %02x %02x %02x %02x %02x %02x %02x\n",
+	seq_printf(m, "                      %02x %02x %02x %02x %02x %02x %02x %02x\n",
 	     acb->dcb_map[8], acb->dcb_map[9], acb->dcb_map[10],
 	     acb->dcb_map[11], acb->dcb_map[12], acb->dcb_map[13],
 	     acb->dcb_map[14], acb->dcb_map[15]);
 
-	SPRINTF
-	    ("Un ID LUN Prty Sync Wide DsCn SndS TagQ nego_period SyncFreq SyncOffs MaxCmd\n");
+	seq_printf(m, "Un ID LUN Prty Sync Wide DsCn SndS TagQ nego_period SyncFreq SyncOffs MaxCmd\n");
 
 	dev = 0;
 	list_for_each_entry(dcb, &acb->dcb_list, list) {
 		int nego_period;
-		SPRINTF("%02i %02i  %02i ", dev, dcb->target_id,
+		seq_printf(m, "%02i %02i  %02i ", dev, dcb->target_id,
 			dcb->target_lun);
 		YESNO(dcb->dev_mode & NTC_DO_PARITY_CHK);
 		YESNO(dcb->sync_offset);
@@ -4676,53 +4670,53 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
 		YESNO(dcb->sync_mode & EN_TAG_QUEUEING);
 		nego_period = clock_period[dcb->sync_period & 0x07] << 2;
 		if (dcb->sync_offset)
-			SPRINTF("  %03i ns ", nego_period);
+			seq_printf(m, "  %03i ns ", nego_period);
 		else
-			SPRINTF(" (%03i ns)", (dcb->min_nego_period << 2));
+			seq_printf(m, " (%03i ns)", (dcb->min_nego_period << 2));
 
 		if (dcb->sync_offset & 0x0f) {
 			spd = 1000 / (nego_period);
 			spd1 = 1000 % (nego_period);
 			spd1 = (spd1 * 10 + nego_period / 2) / (nego_period);
-			SPRINTF("   %2i.%1i M     %02i ", spd, spd1,
+			seq_printf(m, "   %2i.%1i M     %02i ", spd, spd1,
 				(dcb->sync_offset & 0x0f));
 		} else
-			SPRINTF("                 ");
+			seq_printf(m, "                 ");
 
 		/* Add more info ... */
-		SPRINTF("     %02i\n", dcb->max_command);
+		seq_printf(m, "     %02i\n", dcb->max_command);
 		dev++;
 	}
 
 	if (timer_pending(&acb->waiting_timer))
-		SPRINTF("Waiting queue timer running\n");
+		seq_printf(m, "Waiting queue timer running\n");
 	else
-		SPRINTF("\n");
+		seq_printf(m, "\n");
 
 	list_for_each_entry(dcb, &acb->dcb_list, list) {
 		struct ScsiReqBlk *srb;
 		if (!list_empty(&dcb->srb_waiting_list))
-			SPRINTF("DCB (%02i-%i): Waiting: %i:",
+			seq_printf(m, "DCB (%02i-%i): Waiting: %i:",
 				dcb->target_id, dcb->target_lun,
 				list_size(&dcb->srb_waiting_list));
                 list_for_each_entry(srb, &dcb->srb_waiting_list, list)
-			SPRINTF(" %p", srb->cmd);
+			seq_printf(m, " %p", srb->cmd);
 		if (!list_empty(&dcb->srb_going_list))
-			SPRINTF("\nDCB (%02i-%i): Going  : %i:",
+			seq_printf(m, "\nDCB (%02i-%i): Going  : %i:",
 				dcb->target_id, dcb->target_lun,
 				list_size(&dcb->srb_going_list));
 		list_for_each_entry(srb, &dcb->srb_going_list, list)
-			SPRINTF(" %p", srb->cmd);
+			seq_printf(m, " %p", srb->cmd);
 		if (!list_empty(&dcb->srb_waiting_list) || !list_empty(&dcb->srb_going_list))
-			SPRINTF("\n");
+			seq_printf(m, "\n");
 	}
 
 	if (debug_enabled(DBG_1)) {
-		SPRINTF("DCB list for ACB %p:\n", acb);
+		seq_printf(m, "DCB list for ACB %p:\n", acb);
 		list_for_each_entry(dcb, &acb->dcb_list, list) {
-			SPRINTF("%p -> ", dcb);
+			seq_printf(m, "%p -> ", dcb);
 		}
-		SPRINTF("END\n");
+		seq_printf(m, "END\n");
 	}
 
 	DC395x_UNLOCK_IO(acb->scsi_host, flags);
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
index 90abb03..3e77551 100644
--- a/drivers/scsi/nsp32.c
+++ b/drivers/scsi/nsp32.c
@@ -1441,8 +1441,6 @@ static irqreturn_t do_nsp32_isr(int irq, void *dev_id)
 	return IRQ_RETVAL(handled);
 }
 
-#undef SPRINTF
-#define SPRINTF(args...) seq_printf(m, ##args)
 
 static int nsp32_show_info(struct seq_file *m, struct Scsi_Host *host)
 {
@@ -1458,64 +1456,63 @@ static int nsp32_show_info(struct seq_file *m, struct Scsi_Host *host)
 	data = (nsp32_hw_data *)host->hostdata;
 	base = host->io_port;
 
-	SPRINTF("NinjaSCSI-32 status\n\n");
-	SPRINTF("Driver version:        %s, $Revision: 1.33 $\n", nsp32_release_version);
-	SPRINTF("SCSI host No.:         %d\n",		hostno);
-	SPRINTF("IRQ:                   %d\n",		host->irq);
-	SPRINTF("IO:                    0x%lx-0x%lx\n", host->io_port, host->io_port + host->n_io_port - 1);
-	SPRINTF("MMIO(virtual address): 0x%lx-0x%lx\n",	host->base, host->base + data->MmioLength - 1);
-	SPRINTF("sg_tablesize:          %d\n",		host->sg_tablesize);
-	SPRINTF("Chip revision:         0x%x\n",       	(nsp32_read2(base, INDEX_REG) >> 8) & 0xff);
+	seq_printf(m, "NinjaSCSI-32 status\n\n");
+	seq_printf(m, "Driver version:        %s, $Revision: 1.33 $\n", nsp32_release_version);
+	seq_printf(m, "SCSI host No.:         %d\n",		hostno);
+	seq_printf(m, "IRQ:                   %d\n",		host->irq);
+	seq_printf(m, "IO:                    0x%lx-0x%lx\n", host->io_port, host->io_port + host->n_io_port - 1);
+	seq_printf(m, "MMIO(virtual address): 0x%lx-0x%lx\n",	host->base, host->base + data->MmioLength - 1);
+	seq_printf(m, "sg_tablesize:          %d\n",		host->sg_tablesize);
+	seq_printf(m, "Chip revision:         0x%x\n",		(nsp32_read2(base, INDEX_REG) >> 8) & 0xff);
 
 	mode_reg = nsp32_index_read1(base, CHIP_MODE);
 	model    = data->pci_devid->driver_data;
 
 #ifdef CONFIG_PM
-	SPRINTF("Power Management:      %s\n",          (mode_reg & OPTF) ? "yes" : "no");
+	seq_printf(m, "Power Management:      %s\n",          (mode_reg & OPTF) ? "yes" : "no");
 #endif
-	SPRINTF("OEM:                   %ld, %s\n",     (mode_reg & (OEM0|OEM1)), nsp32_model[model]);
+	seq_printf(m, "OEM:                   %ld, %s\n",     (mode_reg & (OEM0|OEM1)), nsp32_model[model]);
 
 	spin_lock_irqsave(&(data->Lock), flags);
-	SPRINTF("CurrentSC:             0x%p\n\n",      data->CurrentSC);
+	seq_printf(m, "CurrentSC:             0x%p\n\n",      data->CurrentSC);
 	spin_unlock_irqrestore(&(data->Lock), flags);
 
 
-	SPRINTF("SDTR status\n");
+	seq_printf(m, "SDTR status\n");
 	for (id = 0; id < ARRAY_SIZE(data->target); id++) {
 
-                SPRINTF("id %d: ", id);
+		seq_printf(m, "id %d: ", id);
 
 		if (id == host->this_id) {
-			SPRINTF("----- NinjaSCSI-32 host adapter\n");
+			seq_printf(m, "----- NinjaSCSI-32 host adapter\n");
 			continue;
 		}
 
 		if (data->target[id].sync_flag == SDTR_DONE) {
 			if (data->target[id].period == 0            &&
 			    data->target[id].offset == ASYNC_OFFSET ) {
-				SPRINTF("async");
+				seq_printf(m, "async");
 			} else {
-				SPRINTF(" sync");
+				seq_printf(m, " sync");
 			}
 		} else {
-			SPRINTF(" none");
+			seq_printf(m, " none");
 		}
 
 		if (data->target[id].period != 0) {
 
 			speed = 1000000 / (data->target[id].period * 4);
 
-			SPRINTF(" transfer %d.%dMB/s, offset %d",
+			seq_printf(m, " transfer %d.%dMB/s, offset %d",
 				speed / 1000,
 				speed % 1000,
 				data->target[id].offset
 				);
 		}
-		SPRINTF("\n");
+		seq_printf(m, "\n");
 	}
 	return 0;
 }
-#undef SPRINTF
 
 
 
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index 34aad32..83db942 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -1364,9 +1364,6 @@ static const char *nsp_info(struct Scsi_Host *shpnt)
 	return data->nspinfo;
 }
 
-#undef SPRINTF
-#define SPRINTF(args...) seq_printf(m, ##args)
-
 static int nsp_show_info(struct seq_file *m, struct Scsi_Host *host)
 {
 	int id;
@@ -1378,75 +1375,74 @@ static int nsp_show_info(struct seq_file *m, struct Scsi_Host *host)
 	hostno = host->host_no;
 	data = (nsp_hw_data *)host->hostdata;
 
-	SPRINTF("NinjaSCSI status\n\n");
-	SPRINTF("Driver version:        $Revision: 1.23 $\n");
-	SPRINTF("SCSI host No.:         %d\n",          hostno);
-	SPRINTF("IRQ:                   %d\n",          host->irq);
-	SPRINTF("IO:                    0x%lx-0x%lx\n", host->io_port, host->io_port + host->n_io_port - 1);
-	SPRINTF("MMIO(virtual address): 0x%lx-0x%lx\n", host->base, host->base + data->MmioLength - 1);
-	SPRINTF("sg_tablesize:          %d\n",          host->sg_tablesize);
+	seq_printf(m, "NinjaSCSI status\n\n");
+	seq_printf(m, "Driver version:        $Revision: 1.23 $\n");
+	seq_printf(m, "SCSI host No.:         %d\n",          hostno);
+	seq_printf(m, "IRQ:                   %d\n",          host->irq);
+	seq_printf(m, "IO:                    0x%lx-0x%lx\n", host->io_port, host->io_port + host->n_io_port - 1);
+	seq_printf(m, "MMIO(virtual address): 0x%lx-0x%lx\n", host->base, host->base + data->MmioLength - 1);
+	seq_printf(m, "sg_tablesize:          %d\n",          host->sg_tablesize);
 
-	SPRINTF("burst transfer mode:   ");
+	seq_printf(m, "burst transfer mode:   ");
 	switch (nsp_burst_mode) {
 	case BURST_IO8:
-		SPRINTF("io8");
+		seq_printf(m, "io8");
 		break;
 	case BURST_IO32:
-		SPRINTF("io32");
+		seq_printf(m, "io32");
 		break;
 	case BURST_MEM32:
-		SPRINTF("mem32");
+		seq_printf(m, "mem32");
 		break;
 	default:
-		SPRINTF("???");
+		seq_printf(m, "???");
 		break;
 	}
-	SPRINTF("\n");
+	seq_printf(m, "\n");
 
 
 	spin_lock_irqsave(&(data->Lock), flags);
-	SPRINTF("CurrentSC:             0x%p\n\n",      data->CurrentSC);
+	seq_printf(m, "CurrentSC:             0x%p\n\n",      data->CurrentSC);
 	spin_unlock_irqrestore(&(data->Lock), flags);
 
-	SPRINTF("SDTR status\n");
+	seq_printf(m, "SDTR status\n");
 	for(id = 0; id < ARRAY_SIZE(data->Sync); id++) {
 
-		SPRINTF("id %d: ", id);
+		seq_printf(m, "id %d: ", id);
 
 		if (id == host->this_id) {
-			SPRINTF("----- NinjaSCSI-3 host adapter\n");
+			seq_printf(m, "----- NinjaSCSI-3 host adapter\n");
 			continue;
 		}
 
 		switch(data->Sync[id].SyncNegotiation) {
 		case SYNC_OK:
-			SPRINTF(" sync");
+			seq_printf(m, " sync");
 			break;
 		case SYNC_NG:
-			SPRINTF("async");
+			seq_printf(m, "async");
 			break;
 		case SYNC_NOT_YET:
-			SPRINTF(" none");
+			seq_printf(m, " none");
 			break;
 		default:
-			SPRINTF("?????");
+			seq_printf(m, "?????");
 			break;
 		}
 
 		if (data->Sync[id].SyncPeriod != 0) {
 			speed = 1000000 / (data->Sync[id].SyncPeriod * 4);
 
-			SPRINTF(" transfer %d.%dMB/s, offset %d",
+			seq_printf(m, " transfer %d.%dMB/s, offset %d",
 				speed / 1000,
 				speed % 1000,
 				data->Sync[id].SyncOffset
 				);
 		}
-		SPRINTF("\n");
+		seq_printf(m, "\n");
 	}
 	return 0;
 }
-#undef SPRINTF
 
 /*---------------------------------------------------------------*/
 /* error handler                                                 */
diff --git a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c
index f94d736..2d7c62f 100644
--- a/drivers/scsi/wd7000.c
+++ b/drivers/scsi/wd7000.c
@@ -1295,9 +1295,6 @@ static void wd7000_revision(Adapter * host)
 }
 
 
-#undef SPRINTF
-#define SPRINTF(args...) { seq_printf(m, ## args); }
-
 static int wd7000_set_info(struct Scsi_Host *host, char *buffer, int length)
 {
 	dprintk("Buffer = <%.*s>, length = %d\n", length, buffer, length);
@@ -1320,43 +1317,43 @@ static int wd7000_show_info(struct seq_file *m, struct Scsi_Host *host)
 #endif
 
 	spin_lock_irqsave(host->host_lock, flags);
-	SPRINTF("Host scsi%d: Western Digital WD-7000 (rev %d.%d)\n", host->host_no, adapter->rev1, adapter->rev2);
-	SPRINTF("  IO base:      0x%x\n", adapter->iobase);
-	SPRINTF("  IRQ:          %d\n", adapter->irq);
-	SPRINTF("  DMA channel:  %d\n", adapter->dma);
-	SPRINTF("  Interrupts:   %d\n", adapter->int_counter);
-	SPRINTF("  BUS_ON time:  %d nanoseconds\n", adapter->bus_on * 125);
-	SPRINTF("  BUS_OFF time: %d nanoseconds\n", adapter->bus_off * 125);
+	seq_printf(m, "Host scsi%d: Western Digital WD-7000 (rev %d.%d)\n", host->host_no, adapter->rev1, adapter->rev2);
+	seq_printf(m, "  IO base:      0x%x\n", adapter->iobase);
+	seq_printf(m, "  IRQ:          %d\n", adapter->irq);
+	seq_printf(m, "  DMA channel:  %d\n", adapter->dma);
+	seq_printf(m, "  Interrupts:   %d\n", adapter->int_counter);
+	seq_printf(m, "  BUS_ON time:  %d nanoseconds\n", adapter->bus_on * 125);
+	seq_printf(m, "  BUS_OFF time: %d nanoseconds\n", adapter->bus_off * 125);
 
 #ifdef WD7000_DEBUG
 	ogmbs = adapter->mb.ogmb;
 	icmbs = adapter->mb.icmb;
 
-	SPRINTF("\nControl port value: 0x%x\n", adapter->control);
-	SPRINTF("Incoming mailbox:\n");
-	SPRINTF("  size: %d\n", ICMB_CNT);
-	SPRINTF("  queued messages: ");
+	seq_printf(m, "\nControl port value: 0x%x\n", adapter->control);
+	seq_printf(m, "Incoming mailbox:\n");
+	seq_printf(m, "  size: %d\n", ICMB_CNT);
+	seq_printf(m, "  queued messages: ");
 
 	for (i = count = 0; i < ICMB_CNT; i++)
 		if (icmbs[i].status) {
 			count++;
-			SPRINTF("0x%x ", i);
+			seq_printf(m, "0x%x ", i);
 		}
 
-	SPRINTF(count ? "\n" : "none\n");
+	seq_printf(m, count ? "\n" : "none\n");
 
-	SPRINTF("Outgoing mailbox:\n");
-	SPRINTF("  size: %d\n", OGMB_CNT);
-	SPRINTF("  next message: 0x%x\n", adapter->next_ogmb);
-	SPRINTF("  queued messages: ");
+	seq_printf(m, "Outgoing mailbox:\n");
+	seq_printf(m, "  size: %d\n", OGMB_CNT);
+	seq_printf(m, "  next message: 0x%x\n", adapter->next_ogmb);
+	seq_printf(m, "  queued messages: ");
 
 	for (i = count = 0; i < OGMB_CNT; i++)
 		if (ogmbs[i].status) {
 			count++;
-			SPRINTF("0x%x ", i);
+			seq_printf(m, "0x%x ", i);
 		}
 
-	SPRINTF(count ? "\n" : "none\n");
+	seq_printf(m, count ? "\n" : "none\n");
 #endif
 
 	spin_unlock_irqrestore(host->host_lock, flags);
-- 
2.0.4


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

* [PATCH v2 2/6] scsi/advansys: Replace seq_printf with seq_puts
  2014-12-02 23:10 ` [PATCH v2 0/6] " Rasmus Villemoes
  2014-12-02 23:10   ` [PATCH v2 1/6] scsi: Remove SPRINTF macro Rasmus Villemoes
@ 2014-12-02 23:10   ` Rasmus Villemoes
  2015-01-30  1:38     ` Finn Thain
  2014-12-02 23:10   ` [PATCH v2 3/6] scsi/aha152x: " Rasmus Villemoes
                     ` (5 subsequent siblings)
  7 siblings, 1 reply; 26+ messages in thread
From: Rasmus Villemoes @ 2014-12-02 23:10 UTC (permalink / raw)
  To: James E.J. Bottomley, Finn Thain
  Cc: linux-scsi, linux-kernel, Rasmus Villemoes

Using seq_printf to print a simple string is a lot more expensive than
it needs to be, since seq_puts exists. Replace seq_printf with
seq_puts when possible.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 drivers/scsi/advansys.c | 155 +++++++++++++++++++++++-------------------------
 1 file changed, 75 insertions(+), 80 deletions(-)

diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 6719a33..d31fc6d 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -2880,7 +2880,7 @@ static void asc_prt_board_devices(struct seq_file *m, struct Scsi_Host *shost)
 		chip_scsi_id = boardp->dvc_var.adv_dvc_var.chip_scsi_id;
 	}
 
-	seq_printf(m, "Target IDs Detected:");
+	seq_puts(m, "Target IDs Detected:");
 	for (i = 0; i <= ADV_MAX_TID; i++) {
 		if (boardp->init_tidmask & ADV_TID_TO_TIDMASK(i))
 			seq_printf(m, " %X,", i);
@@ -2896,18 +2896,18 @@ static void asc_prt_adv_bios(struct seq_file *m, struct Scsi_Host *shost)
 	struct asc_board *boardp = shost_priv(shost);
 	ushort major, minor, letter;
 
-	seq_printf(m, "\nROM BIOS Version: ");
+	seq_puts(m, "\nROM BIOS Version: ");
 
 	/*
 	 * If the BIOS saved a valid signature, then fill in
 	 * the BIOS code segment base address.
 	 */
 	if (boardp->bios_signature != 0x55AA) {
-		seq_printf(m, "Disabled or Pre-3.1\n");
-		seq_printf(m,
-			  "BIOS either disabled or Pre-3.1. If it is pre-3.1, then a newer version\n");
-		seq_printf(m,
-			  "can be found at the ConnectCom FTP site: ftp://ftp.connectcom.net/pub\n");
+		seq_puts(m, "Disabled or Pre-3.1\n");
+		seq_puts(m,
+			 "BIOS either disabled or Pre-3.1. If it is pre-3.1, then a newer version\n");
+		seq_puts(m,
+			 "can be found at the ConnectCom FTP site: ftp://ftp.connectcom.net/pub\n");
 	} else {
 		major = (boardp->bios_version >> 12) & 0xF;
 		minor = (boardp->bios_version >> 8) & 0xF;
@@ -2923,10 +2923,9 @@ static void asc_prt_adv_bios(struct seq_file *m, struct Scsi_Host *shost)
 		 */
 		if (major < 3 || (major <= 3 && minor < 1) ||
 		    (major <= 3 && minor <= 1 && letter < ('I' - 'A'))) {
-			seq_printf(m,
-				   "Newer version of ROM BIOS is available at the ConnectCom FTP site:\n");
-			seq_printf(m,
-				   "ftp://ftp.connectcom.net/pub\n");
+			seq_puts(m,
+				 "Newer version of ROM BIOS is available at the ConnectCom FTP site:\n");
+			seq_puts(m, "ftp://ftp.connectcom.net/pub\n");
 		}
 	}
 }
@@ -3056,11 +3055,10 @@ static void asc_prt_asc_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 	    == ASC_TRUE)
 		seq_printf(m, " Serial Number: %s\n", serialstr);
 	else if (ep->adapter_info[5] == 0xBB)
-		seq_printf(m,
-			   " Default Settings Used for EEPROM-less Adapter.\n");
+		seq_puts(m,
+			 " Default Settings Used for EEPROM-less Adapter.\n");
 	else
-		seq_printf(m,
-			   " Serial Number Signature Not Present.\n");
+		seq_puts(m, " Serial Number Signature Not Present.\n");
 
 	seq_printf(m,
 		   " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n",
@@ -3070,34 +3068,34 @@ static void asc_prt_asc_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 	seq_printf(m,
 		   " cntl 0x%x, no_scam 0x%x\n", ep->cntl, ep->no_scam);
 
-	seq_printf(m, " Target ID:           ");
+	seq_puts(m, " Target ID:           ");
 	for (i = 0; i <= ASC_MAX_TID; i++)
 		seq_printf(m, " %d", i);
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
-	seq_printf(m, " Disconnects:         ");
+	seq_puts(m, " Disconnects:         ");
 	for (i = 0; i <= ASC_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (ep->disc_enable & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
-	seq_printf(m, " Command Queuing:     ");
+	seq_puts(m, " Command Queuing:     ");
 	for (i = 0; i <= ASC_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (ep->use_cmd_qng & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
-	seq_printf(m, " Start Motor:         ");
+	seq_puts(m, " Start Motor:         ");
 	for (i = 0; i <= ASC_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (ep->start_motor & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
-	seq_printf(m, " Synchronous Transfer:");
+	seq_puts(m, " Synchronous Transfer:");
 	for (i = 0; i <= ASC_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (ep->init_sdtr & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 #ifdef CONFIG_ISA
 	if (asc_dvc_varp->bus_type & ASC_IS_ISA) {
@@ -3151,7 +3149,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 	if (asc_get_eeprom_string(wordp, serialstr) == ASC_TRUE)
 		seq_printf(m, " Serial Number: %s\n", serialstr);
 	else
-		seq_printf(m, " Serial Number Signature Not Present.\n");
+		seq_puts(m, " Serial Number Signature Not Present.\n");
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550)
 		seq_printf(m,
@@ -3209,10 +3207,10 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 			   ep_38C1600->termination_lvd, termstr,
 			   ep_38C1600->bios_ctrl);
 
-	seq_printf(m, " Target ID:           ");
+	seq_puts(m, " Target ID:           ");
 	for (i = 0; i <= ADV_MAX_TID; i++)
 		seq_printf(m, " %X", i);
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
 		word = ep_3550->disc_enable;
@@ -3221,11 +3219,11 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 	} else {
 		word = ep_38C1600->disc_enable;
 	}
-	seq_printf(m, " Disconnects:         ");
+	seq_puts(m, " Disconnects:         ");
 	for (i = 0; i <= ADV_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
 		word = ep_3550->tagqng_able;
@@ -3234,11 +3232,11 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 	} else {
 		word = ep_38C1600->tagqng_able;
 	}
-	seq_printf(m, " Command Queuing:     ");
+	seq_puts(m, " Command Queuing:     ");
 	for (i = 0; i <= ADV_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
 		word = ep_3550->start_motor;
@@ -3247,28 +3245,28 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 	} else {
 		word = ep_38C1600->start_motor;
 	}
-	seq_printf(m, " Start Motor:         ");
+	seq_puts(m, " Start Motor:         ");
 	for (i = 0; i <= ADV_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
-		seq_printf(m, " Synchronous Transfer:");
+		seq_puts(m, " Synchronous Transfer:");
 		for (i = 0; i <= ADV_MAX_TID; i++)
 			seq_printf(m, " %c",
 				   (ep_3550->sdtr_able & ADV_TID_TO_TIDMASK(i)) ?
 				   'Y' : 'N');
-		seq_printf(m, "\n");
+		seq_puts(m, "\n");
 	}
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
-		seq_printf(m, " Ultra Transfer:      ");
+		seq_puts(m, " Ultra Transfer:      ");
 		for (i = 0; i <= ADV_MAX_TID; i++)
 			seq_printf(m, " %c",
 				   (ep_3550->ultra_able & ADV_TID_TO_TIDMASK(i))
 				   ? 'Y' : 'N');
-		seq_printf(m, "\n");
+		seq_puts(m, "\n");
 	}
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
@@ -3278,16 +3276,15 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 	} else {
 		word = ep_38C1600->wdtr_able;
 	}
-	seq_printf(m, " Wide Transfer:       ");
+	seq_puts(m, " Wide Transfer:       ");
 	for (i = 0; i <= ADV_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800 ||
 	    adv_dvc_varp->chip_type == ADV_CHIP_ASC38C1600) {
-		seq_printf(m,
-			   " Synchronous Transfer Speed (Mhz):\n  ");
+		seq_puts(m, " Synchronous Transfer Speed (Mhz):\n  ");
 		for (i = 0; i <= ADV_MAX_TID; i++) {
 			char *speed_str;
 
@@ -3325,10 +3322,10 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 			}
 			seq_printf(m, "%X:%s ", i, speed_str);
 			if (i == 7)
-				seq_printf(m, "\n  ");
+				seq_puts(m, "\n  ");
 			sdtr_speed >>= 4;
 		}
-		seq_printf(m, "\n");
+		seq_puts(m, "\n");
 	}
 }
 
@@ -3403,7 +3400,7 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
 	seq_printf(m,
 		   " Total Command Pending: %d\n", v->cur_total_qng);
 
-	seq_printf(m, " Command Queuing:");
+	seq_puts(m, " Command Queuing:");
 	for (i = 0; i <= ASC_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3413,10 +3410,10 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
 			   i,
 			   (v->use_tagged_qng & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	/* Current number of commands waiting for a device. */
-	seq_printf(m, " Command Queue Pending:");
+	seq_puts(m, " Command Queue Pending:");
 	for (i = 0; i <= ASC_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3424,10 +3421,10 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
 		}
 		seq_printf(m, " %X:%u", i, v->cur_dvc_qng[i]);
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	/* Current limit on number of commands that can be sent to a device. */
-	seq_printf(m, " Command Queue Limit:");
+	seq_puts(m, " Command Queue Limit:");
 	for (i = 0; i <= ASC_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3435,10 +3432,10 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
 		}
 		seq_printf(m, " %X:%u", i, v->max_dvc_qng[i]);
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	/* Indicate whether the device has returned queue full status. */
-	seq_printf(m, " Command Queue Full:");
+	seq_puts(m, " Command Queue Full:");
 	for (i = 0; i <= ASC_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3450,9 +3447,9 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
 		else
 			seq_printf(m, " %X:N", i);
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
-	seq_printf(m, " Synchronous Transfer:");
+	seq_puts(m, " Synchronous Transfer:");
 	for (i = 0; i <= ASC_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3462,7 +3459,7 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
 			   i,
 			   (v->sdtr_done & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	for (i = 0; i <= ASC_MAX_TID; i++) {
 		uchar syn_period_ix;
@@ -3476,7 +3473,7 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
 		seq_printf(m, "  %X:", i);
 
 		if ((boardp->sdtr_data[i] & ASC_SYN_MAX_OFFSET) == 0) {
-			seq_printf(m, " Asynchronous");
+			seq_puts(m, " Asynchronous");
 		} else {
 			syn_period_ix =
 			    (boardp->sdtr_data[i] >> 4) & (v->max_sdtr_index -
@@ -3494,16 +3491,15 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
 		}
 
 		if ((v->sdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) {
-			seq_printf(m, "*\n");
+			seq_puts(m, "*\n");
 			renegotiate = 1;
 		} else {
-			seq_printf(m, "\n");
+			seq_puts(m, "\n");
 		}
 	}
 
 	if (renegotiate) {
-		seq_printf(m,
-			   " * = Re-negotiation pending before next command.\n");
+		seq_puts(m, " * = Re-negotiation pending before next command.\n");
 	}
 }
 
@@ -3548,7 +3544,7 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 		   c->mcode_date, c->mcode_version);
 
 	AdvReadWordLram(iop_base, ASC_MC_TAGQNG_ABLE, tagqng_able);
-	seq_printf(m, " Queuing Enabled:");
+	seq_puts(m, " Queuing Enabled:");
 	for (i = 0; i <= ADV_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3559,9 +3555,9 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 			   i,
 			   (tagqng_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
-	seq_printf(m, " Queue Limit:");
+	seq_puts(m, " Queue Limit:");
 	for (i = 0; i <= ADV_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3573,9 +3569,9 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 
 		seq_printf(m, " %X:%d", i, lrambyte);
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
-	seq_printf(m, " Command Pending:");
+	seq_puts(m, " Command Pending:");
 	for (i = 0; i <= ADV_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3587,10 +3583,10 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 
 		seq_printf(m, " %X:%d", i, lrambyte);
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able);
-	seq_printf(m, " Wide Enabled:");
+	seq_puts(m, " Wide Enabled:");
 	for (i = 0; i <= ADV_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3601,10 +3597,10 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 			   i,
 			   (wdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	AdvReadWordLram(iop_base, ASC_MC_WDTR_DONE, wdtr_done);
-	seq_printf(m, " Transfer Bit Width:");
+	seq_puts(m, " Transfer Bit Width:");
 	for (i = 0; i <= ADV_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3620,14 +3616,14 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 
 		if ((wdtr_able & ADV_TID_TO_TIDMASK(i)) &&
 		    (wdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) {
-			seq_printf(m, "*");
+			seq_puts(m, "*");
 			renegotiate = 1;
 		}
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able);
-	seq_printf(m, " Synchronous Enabled:");
+	seq_puts(m, " Synchronous Enabled:");
 	for (i = 0; i <= ADV_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3638,7 +3634,7 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 			   i,
 			   (sdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	AdvReadWordLram(iop_base, ASC_MC_SDTR_DONE, sdtr_done);
 	for (i = 0; i <= ADV_MAX_TID; i++) {
@@ -3657,14 +3653,14 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 		seq_printf(m, "  %X:", i);
 
 		if ((lramword & 0x1F) == 0) {	/* Check for REQ/ACK Offset 0. */
-			seq_printf(m, " Asynchronous");
+			seq_puts(m, " Asynchronous");
 		} else {
-			seq_printf(m, " Transfer Period Factor: ");
+			seq_puts(m, " Transfer Period Factor: ");
 
 			if ((lramword & 0x1F00) == 0x1100) {	/* 80 Mhz */
-				seq_printf(m, "9 (80.0 Mhz),");
+				seq_puts(m, "9 (80.0 Mhz),");
 			} else if ((lramword & 0x1F00) == 0x1000) {	/* 40 Mhz */
-				seq_printf(m, "10 (40.0 Mhz),");
+				seq_puts(m, "10 (40.0 Mhz),");
 			} else {	/* 20 Mhz or below. */
 
 				period = (((lramword >> 8) * 25) + 50) / 4;
@@ -3684,16 +3680,15 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 		}
 
 		if ((sdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) {
-			seq_printf(m, "*\n");
+			seq_puts(m, "*\n");
 			renegotiate = 1;
 		} else {
-			seq_printf(m, "\n");
+			seq_puts(m, "\n");
 		}
 	}
 
 	if (renegotiate) {
-		seq_printf(m,
-			   " * = Re-negotiation pending before next command.\n");
+		seq_puts(m, " * = Re-negotiation pending before next command.\n");
 	}
 }
 
-- 
2.0.4


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

* [PATCH v2 3/6] scsi/aha152x: Replace seq_printf with seq_puts
  2014-12-02 23:10 ` [PATCH v2 0/6] " Rasmus Villemoes
  2014-12-02 23:10   ` [PATCH v2 1/6] scsi: Remove SPRINTF macro Rasmus Villemoes
  2014-12-02 23:10   ` [PATCH v2 2/6] scsi/advansys: Replace seq_printf with seq_puts Rasmus Villemoes
@ 2014-12-02 23:10   ` Rasmus Villemoes
  2015-01-30  1:40     ` Finn Thain
  2014-12-02 23:10   ` [PATCH v2 4/6] scsi: misc: " Rasmus Villemoes
                     ` (4 subsequent siblings)
  7 siblings, 1 reply; 26+ messages in thread
From: Rasmus Villemoes @ 2014-12-02 23:10 UTC (permalink / raw)
  To: James E.J. Bottomley, Finn Thain
  Cc: linux-scsi, linux-kernel, Rasmus Villemoes

Using seq_printf to print a simple string is a lot more expensive than
it needs to be, since seq_puts exists. Replace seq_printf with
seq_puts when possible.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 drivers/scsi/aha152x.c | 248 ++++++++++++++++++++++++-------------------------
 1 file changed, 124 insertions(+), 124 deletions(-)

diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index f14ad8a..e31c460 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -2505,21 +2505,21 @@ static void get_command(struct seq_file *m, Scsi_Cmnd * ptr)
 		ptr->SCp.buffers_residual);
 
 	if (ptr->SCp.phase & not_issued)
-		seq_printf(m, "not issued|");
+		seq_puts(m, "not issued|");
 	if (ptr->SCp.phase & selecting)
-		seq_printf(m, "selecting|");
+		seq_puts(m, "selecting|");
 	if (ptr->SCp.phase & disconnected)
-		seq_printf(m, "disconnected|");
+		seq_puts(m, "disconnected|");
 	if (ptr->SCp.phase & aborted)
-		seq_printf(m, "aborted|");
+		seq_puts(m, "aborted|");
 	if (ptr->SCp.phase & identified)
-		seq_printf(m, "identified|");
+		seq_puts(m, "identified|");
 	if (ptr->SCp.phase & completed)
-		seq_printf(m, "completed|");
+		seq_puts(m, "completed|");
 	if (ptr->SCp.phase & spiordy)
-		seq_printf(m, "spiordy|");
+		seq_puts(m, "spiordy|");
 	if (ptr->SCp.phase & syncneg)
-		seq_printf(m, "syncneg|");
+		seq_puts(m, "syncneg|");
 	seq_printf(m, "; next=0x%p\n", SCNEXT(ptr));
 }
 
@@ -2530,256 +2530,256 @@ static void get_ports(struct seq_file *m, struct Scsi_Host *shpnt)
 	seq_printf(m, "\n%s: %s(%s) ", CURRENT_SC ? "on bus" : "waiting", states[STATE].name, states[PREVSTATE].name);
 
 	s = GETPORT(SCSISEQ);
-	seq_printf(m, "SCSISEQ( ");
+	seq_puts(m, "SCSISEQ( ");
 	if (s & TEMODEO)
-		seq_printf(m, "TARGET MODE ");
+		seq_puts(m, "TARGET MODE ");
 	if (s & ENSELO)
-		seq_printf(m, "SELO ");
+		seq_puts(m, "SELO ");
 	if (s & ENSELI)
-		seq_printf(m, "SELI ");
+		seq_puts(m, "SELI ");
 	if (s & ENRESELI)
-		seq_printf(m, "RESELI ");
+		seq_puts(m, "RESELI ");
 	if (s & ENAUTOATNO)
-		seq_printf(m, "AUTOATNO ");
+		seq_puts(m, "AUTOATNO ");
 	if (s & ENAUTOATNI)
-		seq_printf(m, "AUTOATNI ");
+		seq_puts(m, "AUTOATNI ");
 	if (s & ENAUTOATNP)
-		seq_printf(m, "AUTOATNP ");
+		seq_puts(m, "AUTOATNP ");
 	if (s & SCSIRSTO)
-		seq_printf(m, "SCSIRSTO ");
-	seq_printf(m, ");");
+		seq_puts(m, "SCSIRSTO ");
+	seq_puts(m, ");");
 
-	seq_printf(m, " SCSISIG(");
+	seq_puts(m, " SCSISIG(");
 	s = GETPORT(SCSISIG);
 	switch (s & P_MASK) {
 	case P_DATAO:
-		seq_printf(m, "DATA OUT");
+		seq_puts(m, "DATA OUT");
 		break;
 	case P_DATAI:
-		seq_printf(m, "DATA IN");
+		seq_puts(m, "DATA IN");
 		break;
 	case P_CMD:
-		seq_printf(m, "COMMAND");
+		seq_puts(m, "COMMAND");
 		break;
 	case P_STATUS:
-		seq_printf(m, "STATUS");
+		seq_puts(m, "STATUS");
 		break;
 	case P_MSGO:
-		seq_printf(m, "MESSAGE OUT");
+		seq_puts(m, "MESSAGE OUT");
 		break;
 	case P_MSGI:
-		seq_printf(m, "MESSAGE IN");
+		seq_puts(m, "MESSAGE IN");
 		break;
 	default:
-		seq_printf(m, "*invalid*");
+		seq_puts(m, "*invalid*");
 		break;
 	}
 
-	seq_printf(m, "); ");
+	seq_puts(m, "); ");
 
 	seq_printf(m, "INTSTAT (%s); ", TESTHI(DMASTAT, INTSTAT) ? "hi" : "lo");
 
-	seq_printf(m, "SSTAT( ");
+	seq_puts(m, "SSTAT( ");
 	s = GETPORT(SSTAT0);
 	if (s & TARGET)
-		seq_printf(m, "TARGET ");
+		seq_puts(m, "TARGET ");
 	if (s & SELDO)
-		seq_printf(m, "SELDO ");
+		seq_puts(m, "SELDO ");
 	if (s & SELDI)
-		seq_printf(m, "SELDI ");
+		seq_puts(m, "SELDI ");
 	if (s & SELINGO)
-		seq_printf(m, "SELINGO ");
+		seq_puts(m, "SELINGO ");
 	if (s & SWRAP)
-		seq_printf(m, "SWRAP ");
+		seq_puts(m, "SWRAP ");
 	if (s & SDONE)
-		seq_printf(m, "SDONE ");
+		seq_puts(m, "SDONE ");
 	if (s & SPIORDY)
-		seq_printf(m, "SPIORDY ");
+		seq_puts(m, "SPIORDY ");
 	if (s & DMADONE)
-		seq_printf(m, "DMADONE ");
+		seq_puts(m, "DMADONE ");
 
 	s = GETPORT(SSTAT1);
 	if (s & SELTO)
-		seq_printf(m, "SELTO ");
+		seq_puts(m, "SELTO ");
 	if (s & ATNTARG)
-		seq_printf(m, "ATNTARG ");
+		seq_puts(m, "ATNTARG ");
 	if (s & SCSIRSTI)
-		seq_printf(m, "SCSIRSTI ");
+		seq_puts(m, "SCSIRSTI ");
 	if (s & PHASEMIS)
-		seq_printf(m, "PHASEMIS ");
+		seq_puts(m, "PHASEMIS ");
 	if (s & BUSFREE)
-		seq_printf(m, "BUSFREE ");
+		seq_puts(m, "BUSFREE ");
 	if (s & SCSIPERR)
-		seq_printf(m, "SCSIPERR ");
+		seq_puts(m, "SCSIPERR ");
 	if (s & PHASECHG)
-		seq_printf(m, "PHASECHG ");
+		seq_puts(m, "PHASECHG ");
 	if (s & REQINIT)
-		seq_printf(m, "REQINIT ");
-	seq_printf(m, "); ");
+		seq_puts(m, "REQINIT ");
+	seq_puts(m, "); ");
 
 
-	seq_printf(m, "SSTAT( ");
+	seq_puts(m, "SSTAT( ");
 
 	s = GETPORT(SSTAT0) & GETPORT(SIMODE0);
 
 	if (s & TARGET)
-		seq_printf(m, "TARGET ");
+		seq_puts(m, "TARGET ");
 	if (s & SELDO)
-		seq_printf(m, "SELDO ");
+		seq_puts(m, "SELDO ");
 	if (s & SELDI)
-		seq_printf(m, "SELDI ");
+		seq_puts(m, "SELDI ");
 	if (s & SELINGO)
-		seq_printf(m, "SELINGO ");
+		seq_puts(m, "SELINGO ");
 	if (s & SWRAP)
-		seq_printf(m, "SWRAP ");
+		seq_puts(m, "SWRAP ");
 	if (s & SDONE)
-		seq_printf(m, "SDONE ");
+		seq_puts(m, "SDONE ");
 	if (s & SPIORDY)
-		seq_printf(m, "SPIORDY ");
+		seq_puts(m, "SPIORDY ");
 	if (s & DMADONE)
-		seq_printf(m, "DMADONE ");
+		seq_puts(m, "DMADONE ");
 
 	s = GETPORT(SSTAT1) & GETPORT(SIMODE1);
 
 	if (s & SELTO)
-		seq_printf(m, "SELTO ");
+		seq_puts(m, "SELTO ");
 	if (s & ATNTARG)
-		seq_printf(m, "ATNTARG ");
+		seq_puts(m, "ATNTARG ");
 	if (s & SCSIRSTI)
-		seq_printf(m, "SCSIRSTI ");
+		seq_puts(m, "SCSIRSTI ");
 	if (s & PHASEMIS)
-		seq_printf(m, "PHASEMIS ");
+		seq_puts(m, "PHASEMIS ");
 	if (s & BUSFREE)
-		seq_printf(m, "BUSFREE ");
+		seq_puts(m, "BUSFREE ");
 	if (s & SCSIPERR)
-		seq_printf(m, "SCSIPERR ");
+		seq_puts(m, "SCSIPERR ");
 	if (s & PHASECHG)
-		seq_printf(m, "PHASECHG ");
+		seq_puts(m, "PHASECHG ");
 	if (s & REQINIT)
-		seq_printf(m, "REQINIT ");
-	seq_printf(m, "); ");
+		seq_puts(m, "REQINIT ");
+	seq_puts(m, "); ");
 
-	seq_printf(m, "SXFRCTL0( ");
+	seq_puts(m, "SXFRCTL0( ");
 
 	s = GETPORT(SXFRCTL0);
 	if (s & SCSIEN)
-		seq_printf(m, "SCSIEN ");
+		seq_puts(m, "SCSIEN ");
 	if (s & DMAEN)
-		seq_printf(m, "DMAEN ");
+		seq_puts(m, "DMAEN ");
 	if (s & CH1)
-		seq_printf(m, "CH1 ");
+		seq_puts(m, "CH1 ");
 	if (s & CLRSTCNT)
-		seq_printf(m, "CLRSTCNT ");
+		seq_puts(m, "CLRSTCNT ");
 	if (s & SPIOEN)
-		seq_printf(m, "SPIOEN ");
+		seq_puts(m, "SPIOEN ");
 	if (s & CLRCH1)
-		seq_printf(m, "CLRCH1 ");
-	seq_printf(m, "); ");
+		seq_puts(m, "CLRCH1 ");
+	seq_puts(m, "); ");
 
-	seq_printf(m, "SIGNAL( ");
+	seq_puts(m, "SIGNAL( ");
 
 	s = GETPORT(SCSISIG);
 	if (s & SIG_ATNI)
-		seq_printf(m, "ATNI ");
+		seq_puts(m, "ATNI ");
 	if (s & SIG_SELI)
-		seq_printf(m, "SELI ");
+		seq_puts(m, "SELI ");
 	if (s & SIG_BSYI)
-		seq_printf(m, "BSYI ");
+		seq_puts(m, "BSYI ");
 	if (s & SIG_REQI)
-		seq_printf(m, "REQI ");
+		seq_puts(m, "REQI ");
 	if (s & SIG_ACKI)
-		seq_printf(m, "ACKI ");
-	seq_printf(m, "); ");
+		seq_puts(m, "ACKI ");
+	seq_puts(m, "); ");
 
 	seq_printf(m, "SELID(%02x), ", GETPORT(SELID));
 
 	seq_printf(m, "STCNT(%d), ", GETSTCNT());
 
-	seq_printf(m, "SSTAT2( ");
+	seq_puts(m, "SSTAT2( ");
 
 	s = GETPORT(SSTAT2);
 	if (s & SOFFSET)
-		seq_printf(m, "SOFFSET ");
+		seq_puts(m, "SOFFSET ");
 	if (s & SEMPTY)
-		seq_printf(m, "SEMPTY ");
+		seq_puts(m, "SEMPTY ");
 	if (s & SFULL)
-		seq_printf(m, "SFULL ");
+		seq_puts(m, "SFULL ");
 	seq_printf(m, "); SFCNT (%d); ", s & (SFULL | SFCNT));
 
 	s = GETPORT(SSTAT3);
 	seq_printf(m, "SCSICNT (%d), OFFCNT(%d), ", (s & 0xf0) >> 4, s & 0x0f);
 
-	seq_printf(m, "SSTAT4( ");
+	seq_puts(m, "SSTAT4( ");
 	s = GETPORT(SSTAT4);
 	if (s & SYNCERR)
-		seq_printf(m, "SYNCERR ");
+		seq_puts(m, "SYNCERR ");
 	if (s & FWERR)
-		seq_printf(m, "FWERR ");
+		seq_puts(m, "FWERR ");
 	if (s & FRERR)
-		seq_printf(m, "FRERR ");
-	seq_printf(m, "); ");
+		seq_puts(m, "FRERR ");
+	seq_puts(m, "); ");
 
-	seq_printf(m, "DMACNTRL0( ");
+	seq_puts(m, "DMACNTRL0( ");
 	s = GETPORT(DMACNTRL0);
 	seq_printf(m, "%s ", s & _8BIT ? "8BIT" : "16BIT");
 	seq_printf(m, "%s ", s & DMA ? "DMA" : "PIO");
 	seq_printf(m, "%s ", s & WRITE_READ ? "WRITE" : "READ");
 	if (s & ENDMA)
-		seq_printf(m, "ENDMA ");
+		seq_puts(m, "ENDMA ");
 	if (s & INTEN)
-		seq_printf(m, "INTEN ");
+		seq_puts(m, "INTEN ");
 	if (s & RSTFIFO)
-		seq_printf(m, "RSTFIFO ");
+		seq_puts(m, "RSTFIFO ");
 	if (s & SWINT)
-		seq_printf(m, "SWINT ");
-	seq_printf(m, "); ");
+		seq_puts(m, "SWINT ");
+	seq_puts(m, "); ");
 
-	seq_printf(m, "DMASTAT( ");
+	seq_puts(m, "DMASTAT( ");
 	s = GETPORT(DMASTAT);
 	if (s & ATDONE)
-		seq_printf(m, "ATDONE ");
+		seq_puts(m, "ATDONE ");
 	if (s & WORDRDY)
-		seq_printf(m, "WORDRDY ");
+		seq_puts(m, "WORDRDY ");
 	if (s & DFIFOFULL)
-		seq_printf(m, "DFIFOFULL ");
+		seq_puts(m, "DFIFOFULL ");
 	if (s & DFIFOEMP)
-		seq_printf(m, "DFIFOEMP ");
-	seq_printf(m, ")\n");
+		seq_puts(m, "DFIFOEMP ");
+	seq_puts(m, ")\n");
 
-	seq_printf(m, "enabled interrupts( ");
+	seq_puts(m, "enabled interrupts( ");
 
 	s = GETPORT(SIMODE0);
 	if (s & ENSELDO)
-		seq_printf(m, "ENSELDO ");
+		seq_puts(m, "ENSELDO ");
 	if (s & ENSELDI)
-		seq_printf(m, "ENSELDI ");
+		seq_puts(m, "ENSELDI ");
 	if (s & ENSELINGO)
-		seq_printf(m, "ENSELINGO ");
+		seq_puts(m, "ENSELINGO ");
 	if (s & ENSWRAP)
-		seq_printf(m, "ENSWRAP ");
+		seq_puts(m, "ENSWRAP ");
 	if (s & ENSDONE)
-		seq_printf(m, "ENSDONE ");
+		seq_puts(m, "ENSDONE ");
 	if (s & ENSPIORDY)
-		seq_printf(m, "ENSPIORDY ");
+		seq_puts(m, "ENSPIORDY ");
 	if (s & ENDMADONE)
-		seq_printf(m, "ENDMADONE ");
+		seq_puts(m, "ENDMADONE ");
 
 	s = GETPORT(SIMODE1);
 	if (s & ENSELTIMO)
-		seq_printf(m, "ENSELTIMO ");
+		seq_puts(m, "ENSELTIMO ");
 	if (s & ENATNTARG)
-		seq_printf(m, "ENATNTARG ");
+		seq_puts(m, "ENATNTARG ");
 	if (s & ENPHASEMIS)
-		seq_printf(m, "ENPHASEMIS ");
+		seq_puts(m, "ENPHASEMIS ");
 	if (s & ENBUSFREE)
-		seq_printf(m, "ENBUSFREE ");
+		seq_puts(m, "ENBUSFREE ");
 	if (s & ENSCSIPERR)
-		seq_printf(m, "ENSCSIPERR ");
+		seq_puts(m, "ENSCSIPERR ");
 	if (s & ENPHASECHG)
-		seq_printf(m, "ENPHASECHG ");
+		seq_puts(m, "ENPHASECHG ");
 	if (s & ENREQINIT)
-		seq_printf(m, "ENREQINIT ");
-	seq_printf(m, ")\n");
+		seq_puts(m, "ENREQINIT ");
+	seq_puts(m, ")\n");
 }
 
 static int aha152x_set_info(struct Scsi_Host *shpnt, char *buffer, int length)
@@ -2822,7 +2822,7 @@ static int aha152x_show_info(struct seq_file *m, struct Scsi_Host *shpnt)
 	Scsi_Cmnd *ptr;
 	unsigned long flags;
 
-	seq_printf(m, AHA152X_REVID "\n");
+	seq_puts(m, AHA152X_REVID "\n");
 
 	seq_printf(m, "ioports 0x%04lx to 0x%04lx\n",
 		shpnt->io_port, shpnt->io_port + shpnt->n_io_port - 1);
@@ -2836,7 +2836,7 @@ static int aha152x_show_info(struct seq_file *m, struct Scsi_Host *shpnt)
 	seq_printf(m, "%d commands currently queued\n", HOSTDATA(shpnt)->commands);
 
 	if(SYNCHRONOUS) {
-		seq_printf(m, "synchronously operating targets (tick=50 ns):\n");
+		seq_puts(m, "synchronously operating targets (tick=50 ns):\n");
 		for (i = 0; i < 8; i++)
 			if (HOSTDATA(shpnt)->syncrate[i] & 0x7f)
 				seq_printf(m, "target %d: period %dT/%dns; req/ack offset %d\n",
@@ -2845,28 +2845,28 @@ static int aha152x_show_info(struct seq_file *m, struct Scsi_Host *shpnt)
 					(((HOSTDATA(shpnt)->syncrate[i] & 0x70) >> 4) + 2) * 50,
 				    HOSTDATA(shpnt)->syncrate[i] & 0x0f);
 	}
-	seq_printf(m, "\nqueue status:\n");
+	seq_puts(m, "\nqueue status:\n");
 	DO_LOCK(flags);
 	if (ISSUE_SC) {
-		seq_printf(m, "not yet issued commands:\n");
+		seq_puts(m, "not yet issued commands:\n");
 		for (ptr = ISSUE_SC; ptr; ptr = SCNEXT(ptr))
 			get_command(m, ptr);
 	} else
-		seq_printf(m, "no not yet issued commands\n");
+		seq_puts(m, "no not yet issued commands\n");
 	DO_UNLOCK(flags);
 
 	if (CURRENT_SC) {
-		seq_printf(m, "current command:\n");
+		seq_puts(m, "current command:\n");
 		get_command(m, CURRENT_SC);
 	} else
-		seq_printf(m, "no current command\n");
+		seq_puts(m, "no current command\n");
 
 	if (DISCONNECTED_SC) {
-		seq_printf(m, "disconnected commands:\n");
+		seq_puts(m, "disconnected commands:\n");
 		for (ptr = DISCONNECTED_SC; ptr; ptr = SCNEXT(ptr))
 			get_command(m, ptr);
 	} else
-		seq_printf(m, "no disconnected commands\n");
+		seq_puts(m, "no disconnected commands\n");
 
 	get_ports(m, shpnt);
 
-- 
2.0.4


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

* [PATCH v2 4/6] scsi: misc:  Replace seq_printf with seq_puts
  2014-12-02 23:10 ` [PATCH v2 0/6] " Rasmus Villemoes
                     ` (2 preceding siblings ...)
  2014-12-02 23:10   ` [PATCH v2 3/6] scsi/aha152x: " Rasmus Villemoes
@ 2014-12-02 23:10   ` Rasmus Villemoes
  2015-01-30  1:41     ` Finn Thain
  2014-12-02 23:10   ` [PATCH v2 5/6] scsi: misc: Merge consecutive seq_puts calls Rasmus Villemoes
                     ` (3 subsequent siblings)
  7 siblings, 1 reply; 26+ messages in thread
From: Rasmus Villemoes @ 2014-12-02 23:10 UTC (permalink / raw)
  To: James E.J. Bottomley, Finn Thain
  Cc: linux-scsi, linux-kernel, Rasmus Villemoes

Using seq_printf to print a simple string is a lot more expensive than
it needs to be, since seq_puts exists. Replace seq_printf with
seq_puts when possible.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 drivers/scsi/BusLogic.c             | 10 +++++-----
 drivers/scsi/NCR5380.c              |  4 ++--
 drivers/scsi/aic7xxx/aic79xx_proc.c | 38 ++++++++++++++++++-------------------
 drivers/scsi/aic7xxx/aic7xxx_proc.c | 24 +++++++++++------------
 drivers/scsi/arm/fas216.c           |  6 +++---
 drivers/scsi/atari_NCR5380.c        |  4 ++--
 drivers/scsi/atp870u.c              |  6 +++---
 drivers/scsi/dc395x.c               | 17 +++++++++--------
 drivers/scsi/dpt_i2o.c              |  2 +-
 drivers/scsi/eata_pio.c             |  2 +-
 drivers/scsi/gdth_proc.c            | 24 +++++++++++------------
 drivers/scsi/in2000.c               | 18 +++++++++---------
 drivers/scsi/ips.c                  |  7 +++----
 drivers/scsi/megaraid.c             |  2 +-
 drivers/scsi/nsp32.c                | 14 +++++++-------
 drivers/scsi/pcmcia/nsp_cs.c        | 30 ++++++++++++++---------------
 drivers/scsi/qla2xxx/qla_dfs.c      |  8 ++++----
 drivers/scsi/scsi_proc.c            | 22 ++++++++++-----------
 drivers/scsi/scsi_trace.c           |  6 +++---
 drivers/scsi/wd33c93.c              | 18 +++++++++---------
 drivers/scsi/wd7000.c               | 12 ++++++------
 21 files changed, 136 insertions(+), 138 deletions(-)

diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index 8d66a64..c7be7bb 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -3485,7 +3485,7 @@ static int blogic_show_info(struct seq_file *m, struct Scsi_Host *shost)
 	seq_printf(m, "\n\
 Current Driver Queue Depth:	%d\n\
 Currently Allocated CCBs:	%d\n", adapter->drvr_qdepth, adapter->alloc_ccbs);
-	seq_printf(m, "\n\n\
+	seq_puts(m, "\n\n\
 			   DATA TRANSFER STATISTICS\n\
 \n\
 Target	Tagged Queuing	Queue Depth  Active  Attempted	Completed\n\
@@ -3500,7 +3500,7 @@ Target	Tagged Queuing	Queue Depth  Active  Attempted	Completed\n\
 		seq_printf(m,
 				  "	    %3d       %3u    %9u	%9u\n", adapter->qdepth[tgt], adapter->active_cmds[tgt], tgt_stats[tgt].cmds_tried, tgt_stats[tgt].cmds_complete);
 	}
-	seq_printf(m, "\n\
+	seq_puts(m, "\n\
 Target  Read Commands  Write Commands   Total Bytes Read    Total Bytes Written\n\
 ======  =============  ==============  ===================  ===================\n");
 	for (tgt = 0; tgt < adapter->maxdev; tgt++) {
@@ -3517,7 +3517,7 @@ Target  Read Commands  Write Commands   Total Bytes Read    Total Bytes Written\
 		else
 			seq_printf(m, "	     %9u\n", tgt_stats[tgt].byteswritten.units);
 	}
-	seq_printf(m, "\n\
+	seq_puts(m, "\n\
 Target  Command    0-1KB      1-2KB      2-4KB      4-8KB     8-16KB\n\
 ======  =======  =========  =========  =========  =========  =========\n");
 	for (tgt = 0; tgt < adapter->maxdev; tgt++) {
@@ -3533,7 +3533,7 @@ Target  Command    0-1KB      1-2KB      2-4KB      4-8KB     8-16KB\n\
 			    tgt_stats[tgt].write_sz_buckets[0],
 			    tgt_stats[tgt].write_sz_buckets[1], tgt_stats[tgt].write_sz_buckets[2], tgt_stats[tgt].write_sz_buckets[3], tgt_stats[tgt].write_sz_buckets[4]);
 	}
-	seq_printf(m, "\n\
+	seq_puts(m, "\n\
 Target  Command   16-32KB    32-64KB   64-128KB   128-256KB   256KB+\n\
 ======  =======  =========  =========  =========  =========  =========\n");
 	for (tgt = 0; tgt < adapter->maxdev; tgt++) {
@@ -3549,7 +3549,7 @@ Target  Command   16-32KB    32-64KB   64-128KB   128-256KB   256KB+\n\
 			    tgt_stats[tgt].write_sz_buckets[5],
 			    tgt_stats[tgt].write_sz_buckets[6], tgt_stats[tgt].write_sz_buckets[7], tgt_stats[tgt].write_sz_buckets[8], tgt_stats[tgt].write_sz_buckets[9]);
 	}
-	seq_printf(m, "\n\n\
+	seq_puts(m, "\n\n\
 			   ERROR RECOVERY STATISTICS\n\
 \n\
 	  Command Aborts      Bus Device Resets	  Host Adapter Resets\n\
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index aca181e..a30af00 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -754,7 +754,7 @@ static int __maybe_unused NCR5380_show_info(struct seq_file *m,
 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_printf(m, "        command = ");
+	seq_puts(m, "        command = ");
 	lprint_command(cmd->cmnd, m);
 }
 
@@ -764,7 +764,7 @@ static void lprint_command(unsigned char *command, struct seq_file *m)
 	lprint_opcode(command[0], m);
 	for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i)
 		seq_printf(m, "%02x ", command[i]);
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 }
 
 static void lprint_opcode(int opcode, struct seq_file *m)
diff --git a/drivers/scsi/aic7xxx/aic79xx_proc.c b/drivers/scsi/aic7xxx/aic79xx_proc.c
index 27dbfcc..e095598 100644
--- a/drivers/scsi/aic7xxx/aic79xx_proc.c
+++ b/drivers/scsi/aic7xxx/aic79xx_proc.c
@@ -97,7 +97,7 @@ ahd_format_transinfo(struct seq_file *m, struct ahd_transinfo *tinfo)
 	u_int mb;
 
 	if (tinfo->period == AHD_PERIOD_UNKNOWN) {
-		seq_printf(m, "Renegotiation Pending\n");
+		seq_puts(m, "Renegotiation Pending\n");
 		return;
 	}
         speed = 3300;
@@ -119,40 +119,38 @@ ahd_format_transinfo(struct seq_file *m, struct ahd_transinfo *tinfo)
 		printed_options = 0;
 		seq_printf(m, " (%d.%03dMHz", freq / 1000, freq % 1000);
 		if ((tinfo->ppr_options & MSG_EXT_PPR_RD_STRM) != 0) {
-			seq_printf(m, " RDSTRM");
+			seq_puts(m, " RDSTRM");
 			printed_options++;
 		}
 		if ((tinfo->ppr_options & MSG_EXT_PPR_DT_REQ) != 0) {
-			seq_printf(m, "%s", printed_options ? "|DT" : " DT");
+			seq_puts(m, printed_options ? "|DT" : " DT");
 			printed_options++;
 		}
 		if ((tinfo->ppr_options & MSG_EXT_PPR_IU_REQ) != 0) {
-			seq_printf(m, "%s", printed_options ? "|IU" : " IU");
+			seq_puts(m, printed_options ? "|IU" : " IU");
 			printed_options++;
 		}
 		if ((tinfo->ppr_options & MSG_EXT_PPR_RTI) != 0) {
-			seq_printf(m, "%s",
-				  printed_options ? "|RTI" : " RTI");
+			seq_puts(m, printed_options ? "|RTI" : " RTI");
 			printed_options++;
 		}
 		if ((tinfo->ppr_options & MSG_EXT_PPR_QAS_REQ) != 0) {
-			seq_printf(m, "%s",
-				  printed_options ? "|QAS" : " QAS");
+			seq_puts(m, printed_options ? "|QAS" : " QAS");
 			printed_options++;
 		}
 	}
 
 	if (tinfo->width > 0) {
 		if (freq != 0) {
-			seq_printf(m, ", ");
+			seq_puts(m, ", ");
 		} else {
-			seq_printf(m, " (");
+			seq_puts(m, " (");
 		}
 		seq_printf(m, "%dbit)", 8 * (0x01 << tinfo->width));
 	} else if (freq != 0) {
-		seq_printf(m, ")");
+		seq_puts(m, ")");
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 }
 
 static void
@@ -167,15 +165,15 @@ ahd_dump_target_state(struct ahd_softc *ahd, struct seq_file *m,
 	tinfo = ahd_fetch_transinfo(ahd, channel, our_id,
 				    target_id, &tstate);
 	seq_printf(m, "Target %d Negotiation Settings\n", target_id);
-	seq_printf(m, "\tUser: ");
+	seq_puts(m, "\tUser: ");
 	ahd_format_transinfo(m, &tinfo->user);
 	starget = ahd->platform_data->starget[target_id];
 	if (starget == NULL)
 		return;
 
-	seq_printf(m, "\tGoal: ");
+	seq_puts(m, "\tGoal: ");
 	ahd_format_transinfo(m, &tinfo->goal);
-	seq_printf(m, "\tCurr: ");
+	seq_puts(m, "\tCurr: ");
 	ahd_format_transinfo(m, &tinfo->curr);
 
 	for (lun = 0; lun < AHD_NUM_LUNS; lun++) {
@@ -291,19 +289,19 @@ ahd_linux_show_info(struct seq_file *m, struct Scsi_Host *shost)
 	max_targ = 16;
 
 	if (ahd->seep_config == NULL)
-		seq_printf(m, "No Serial EEPROM\n");
+		seq_puts(m, "No Serial EEPROM\n");
 	else {
-		seq_printf(m, "Serial EEPROM:\n");
+		seq_puts(m, "Serial EEPROM:\n");
 		for (i = 0; i < sizeof(*ahd->seep_config)/2; i++) {
 			if (((i % 8) == 0) && (i != 0)) {
-				seq_printf(m, "\n");
+				seq_puts(m, "\n");
 			}
 			seq_printf(m, "0x%.4x ",
 				  ((uint16_t*)ahd->seep_config)[i]);
 		}
-		seq_printf(m, "\n");
+		seq_puts(m, "\n");
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	if ((ahd->features & AHD_WIDE) == 0)
 		max_targ = 8;
diff --git a/drivers/scsi/aic7xxx/aic7xxx_proc.c b/drivers/scsi/aic7xxx/aic7xxx_proc.c
index 64eec6c..25511ca 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_proc.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_proc.c
@@ -119,15 +119,15 @@ ahc_format_transinfo(struct seq_file *m, struct ahc_transinfo *tinfo)
 
 	if (tinfo->width > 0) {
 		if (freq != 0) {
-			seq_printf(m, ", ");
+			seq_puts(m, ", ");
 		} else {
-			seq_printf(m, " (");
+			seq_puts(m, " (");
 		}
 		seq_printf(m, "%dbit)", 8 * (0x01 << tinfo->width));
 	} else if (freq != 0) {
-		seq_printf(m, ")");
+		seq_puts(m, ")");
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 }
 
 static void
@@ -145,15 +145,15 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct seq_file *m,
 	if ((ahc->features & AHC_TWIN) != 0)
 		seq_printf(m, "Channel %c ", channel);
 	seq_printf(m, "Target %d Negotiation Settings\n", target_id);
-	seq_printf(m, "\tUser: ");
+	seq_puts(m, "\tUser: ");
 	ahc_format_transinfo(m, &tinfo->user);
 	starget = ahc->platform_data->starget[target_offset];
 	if (!starget)
 		return;
 
-	seq_printf(m, "\tGoal: ");
+	seq_puts(m, "\tGoal: ");
 	ahc_format_transinfo(m, &tinfo->goal);
-	seq_printf(m, "\tCurr: ");
+	seq_puts(m, "\tCurr: ");
 	ahc_format_transinfo(m, &tinfo->curr);
 
 	for (lun = 0; lun < AHC_NUM_LUNS; lun++) {
@@ -303,19 +303,19 @@ ahc_linux_show_info(struct seq_file *m, struct Scsi_Host *shost)
 
 
 	if (ahc->seep_config == NULL)
-		seq_printf(m, "No Serial EEPROM\n");
+		seq_puts(m, "No Serial EEPROM\n");
 	else {
-		seq_printf(m, "Serial EEPROM:\n");
+		seq_puts(m, "Serial EEPROM:\n");
 		for (i = 0; i < sizeof(*ahc->seep_config)/2; i++) {
 			if (((i % 8) == 0) && (i != 0)) {
-				seq_printf(m, "\n");
+				seq_puts(m, "\n");
 			}
 			seq_printf(m, "0x%.4x ",
 				  ((uint16_t*)ahc->seep_config)[i]);
 		}
-		seq_printf(m, "\n");
+		seq_puts(m, "\n");
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	max_targ = 16;
 	if ((ahc->features & (AHC_WIDE|AHC_TWIN)) == 0)
diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c
index e64c3af..decdc71 100644
--- a/drivers/scsi/arm/fas216.c
+++ b/drivers/scsi/arm/fas216.c
@@ -2990,7 +2990,7 @@ void fas216_print_devices(FAS216_Info *info, struct seq_file *m)
 	struct fas216_device *dev;
 	struct scsi_device *scd;
 
-	seq_printf(m, "Device/Lun TaggedQ       Parity   Sync\n");
+	seq_puts(m, "Device/Lun TaggedQ       Parity   Sync\n");
 
 	shost_for_each_device(scd, info->host) {
 		dev = &info->device[scd->id];
@@ -3000,7 +3000,7 @@ void fas216_print_devices(FAS216_Info *info, struct seq_file *m)
 				     scd->simple_tags ? "en" : "dis",
 				     scd->current_tag);
 		else
-			seq_printf(m, "unsupported   ");
+			seq_puts(m, "unsupported   ");
 
 		seq_printf(m, "%3sabled ", dev->parity_enabled ? "en" : "dis");
 
@@ -3008,7 +3008,7 @@ void fas216_print_devices(FAS216_Info *info, struct seq_file *m)
 			seq_printf(m, "offset %d, %d ns\n",
 				     dev->sof, dev->period * 4);
 		else
-			seq_printf(m, "async\n");
+			seq_puts(m, "async\n");
 	}
 }
 
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
index 6daed6b..04d0c6e 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -711,12 +711,12 @@ static void show_Scsi_Cmnd(struct scsi_cmnd *cmd, struct seq_file *m)
 	unsigned char *command;
 	seq_printf(m, "scsi%d: destination target %d, lun %llu\n",
 		H_NO(cmd), cmd->device->id, cmd->device->lun);
-	seq_printf(m, "        command = ");
+	seq_puts(m, "        command = ");
 	command = cmd->cmnd;
 	seq_printf(m, "%2d (0x%02x)", command[0], command[0]);
 	for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i)
 		seq_printf(m, " %02x", command[i]);
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 }
 
 static int __maybe_unused NCR5380_show_info(struct seq_file *m,
diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c
index a795d81..0b02467 100644
--- a/drivers/scsi/atp870u.c
+++ b/drivers/scsi/atp870u.c
@@ -3101,9 +3101,9 @@ static const char *atp870u_info(struct Scsi_Host *notused)
 
 static int atp870u_show_info(struct seq_file *m, struct Scsi_Host *HBAptr)
 {
-	seq_printf(m, "ACARD AEC-671X Driver Version: 2.6+ac\n");
-	seq_printf(m, "\n");
-	seq_printf(m, "Adapter Configuration:\n");
+	seq_puts(m, "ACARD AEC-671X Driver Version: 2.6+ac\n");
+	seq_puts(m, "\n");
+	seq_puts(m, "Adapter Configuration:\n");
 	seq_printf(m, "               Base IO: %#.4lx\n", HBAptr->io_port);
 	seq_printf(m, "                   IRQ: %d\n", HBAptr->irq);
 	return 0;
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
index 0a1ed50..3a55ea2 100644
--- a/drivers/scsi/dc395x.c
+++ b/drivers/scsi/dc395x.c
@@ -4623,8 +4623,8 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
 	unsigned long flags;
 	int dev;
 
-	seq_printf(m, DC395X_BANNER " PCI SCSI Host Adapter\n");
-	seq_printf(m, " Driver Version " DC395X_VERSION "\n");
+	seq_puts(m, DC395X_BANNER " PCI SCSI Host Adapter\n");
+	seq_puts(m, " Driver Version " DC395X_VERSION "\n");
 
 	DC395x_LOCK_IO(acb->scsi_host, flags);
 
@@ -4655,7 +4655,8 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
 	     acb->dcb_map[11], acb->dcb_map[12], acb->dcb_map[13],
 	     acb->dcb_map[14], acb->dcb_map[15]);
 
-	seq_printf(m, "Un ID LUN Prty Sync Wide DsCn SndS TagQ nego_period SyncFreq SyncOffs MaxCmd\n");
+	seq_puts(m,
+		 "Un ID LUN Prty Sync Wide DsCn SndS TagQ nego_period SyncFreq SyncOffs MaxCmd\n");
 
 	dev = 0;
 	list_for_each_entry(dcb, &acb->dcb_list, list) {
@@ -4681,7 +4682,7 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
 			seq_printf(m, "   %2i.%1i M     %02i ", spd, spd1,
 				(dcb->sync_offset & 0x0f));
 		} else
-			seq_printf(m, "                 ");
+			seq_puts(m, "                 ");
 
 		/* Add more info ... */
 		seq_printf(m, "     %02i\n", dcb->max_command);
@@ -4689,9 +4690,9 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
 	}
 
 	if (timer_pending(&acb->waiting_timer))
-		seq_printf(m, "Waiting queue timer running\n");
+		seq_puts(m, "Waiting queue timer running\n");
 	else
-		seq_printf(m, "\n");
+		seq_puts(m, "\n");
 
 	list_for_each_entry(dcb, &acb->dcb_list, list) {
 		struct ScsiReqBlk *srb;
@@ -4708,7 +4709,7 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
 		list_for_each_entry(srb, &dcb->srb_going_list, list)
 			seq_printf(m, " %p", srb->cmd);
 		if (!list_empty(&dcb->srb_waiting_list) || !list_empty(&dcb->srb_going_list))
-			seq_printf(m, "\n");
+			seq_puts(m, "\n");
 	}
 
 	if (debug_enabled(DBG_1)) {
@@ -4716,7 +4717,7 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
 		list_for_each_entry(dcb, &acb->dcb_list, list) {
 			seq_printf(m, "%p -> ", dcb);
 		}
-		seq_printf(m, "END\n");
+		seq_puts(m, "END\n");
 	}
 
 	DC395x_UNLOCK_IO(acb->scsi_host, flags);
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 0bf9769..2806cfb 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -568,7 +568,7 @@ static int adpt_show_info(struct seq_file *m, struct Scsi_Host *host)
 	seq_printf(m, "\tpost fifo size  = %d\n\treply fifo size = %d\n\tsg table size   = %d\n\n",
 			host->can_queue, (int) pHba->reply_fifo_size , host->sg_tablesize);
 
-	seq_printf(m, "Devices:\n");
+	seq_puts(m, "Devices:\n");
 	for(chan = 0; chan < MAX_CHANNEL; chan++) {
 		for(id = 0; id < MAX_ID; id++) {
 			d = pHba->channel[chan].device[id];
diff --git a/drivers/scsi/eata_pio.c b/drivers/scsi/eata_pio.c
index 8319d2b..ca8003f 100644
--- a/drivers/scsi/eata_pio.c
+++ b/drivers/scsi/eata_pio.c
@@ -102,7 +102,7 @@ static int eata_pio_show_info(struct seq_file *m, struct Scsi_Host *shost)
 		   shost->host_no, SD(shost)->name);
 	seq_printf(m, "Firmware revision: v%s\n",
 		   SD(shost)->revision);
-	seq_printf(m, "IO: PIO\n");
+	seq_puts(m, "IO: PIO\n");
 	seq_printf(m, "Base IO : %#.4x\n", (u32) shost->base);
 	seq_printf(m, "Host Bus: %s\n",
 		   (SD(shost)->bustype == 'P')?"PCI ":
diff --git a/drivers/scsi/gdth_proc.c b/drivers/scsi/gdth_proc.c
index 9fb6326..e66e997 100644
--- a/drivers/scsi/gdth_proc.c
+++ b/drivers/scsi/gdth_proc.c
@@ -173,7 +173,7 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
     /* request is i.e. "cat /proc/scsi/gdth/0" */ 
     /* format: %-15s\t%-10s\t%-15s\t%s */
     /* driver parameters */
-    seq_printf(m, "Driver Parameters:\n");
+    seq_puts(m, "Driver Parameters:\n");
     if (reserve_list[0] == 0xff)
         strcpy(hrec, "--");
     else {
@@ -192,7 +192,7 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
                    max_ids, hdr_channel);
 
     /* controller information */
-    seq_printf(m,"\nDisk Array Controller Information:\n");
+    seq_puts(m, "\nDisk Array Controller Information:\n");
     seq_printf(m,
                    " Number:       \t%d         \tName:          \t%s\n",
                    ha->hanum, ha->binfo.type_string);
@@ -219,7 +219,7 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
 
 #ifdef GDTH_DMA_STATISTICS
     /* controller statistics */
-    seq_printf(m,"\nController Statistics:\n");
+    seq_puts(m, "\nController Statistics:\n");
     seq_printf(m,
                    " 32-bit DMA buffer:\t%lu\t64-bit DMA buffer:\t%lu\n",
                    ha->dma32_cnt, ha->dma64_cnt);
@@ -227,7 +227,7 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
 
     if (ha->more_proc) {
         /* more information: 2. about physical devices */
-        seq_printf(m, "\nPhysical Devices:");
+        seq_puts(m, "\nPhysical Devices:");
         flag = FALSE;
             
         buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr);
@@ -326,10 +326,10 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
         gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr);
 
         if (!flag)
-            seq_printf(m, "\n --\n");
+            seq_puts(m, "\n --\n");
 
         /* 3. about logical drives */
-        seq_printf(m,"\nLogical Drives:");
+        seq_puts(m, "\nLogical Drives:");
         flag = FALSE;
 
         buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr);
@@ -411,10 +411,10 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
         gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr);
         
         if (!flag)
-            seq_printf(m, "\n --\n");
+            seq_puts(m, "\n --\n");
 
         /* 4. about array drives */
-        seq_printf(m,"\nArray Drives:");
+        seq_puts(m, "\nArray Drives:");
         flag = FALSE;
 
         buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr);
@@ -471,10 +471,10 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
         gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr);
         
         if (!flag)
-            seq_printf(m, "\n --\n");
+            seq_puts(m, "\n --\n");
 
         /* 5. about host drives */
-        seq_printf(m,"\nHost Drives:");
+        seq_puts(m, "\nHost Drives:");
         flag = FALSE;
 
         buf = gdth_ioctl_alloc(ha, sizeof(gdth_hget_str), FALSE, &paddr);
@@ -527,11 +527,11 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
         }
         
         if (!flag)
-            seq_printf(m, "\n --\n");
+            seq_puts(m, "\n --\n");
     }
 
     /* controller events */
-    seq_printf(m,"\nController Events:\n");
+    seq_puts(m, "\nController Events:\n");
 
     for (id = -1;;) {
         id = gdth_read_event(ha, id, estr);
diff --git a/drivers/scsi/in2000.c b/drivers/scsi/in2000.c
index ddf0694..a73395e 100644
--- a/drivers/scsi/in2000.c
+++ b/drivers/scsi/in2000.c
@@ -2226,36 +2226,36 @@ static int in2000_show_info(struct seq_file *m, struct Scsi_Host *instance)
 
 	if (hd->proc & PR_INFO) {
 		seq_printf(m, "\ndip_switch=%02x: irq=%d io=%02x floppy=%s sync/DOS5=%s", (hd->dip_switch & 0x7f), instance->irq, hd->io_base, (hd->dip_switch & 0x40) ? "Yes" : "No", (hd->dip_switch & 0x20) ? "Yes" : "No");
-		seq_printf(m, "\nsync_xfer[] =       ");
+		seq_puts(m, "\nsync_xfer[] =       ");
 		for (x = 0; x < 7; x++)
 			seq_printf(m, "\t%02x", hd->sync_xfer[x]);
-		seq_printf(m, "\nsync_stat[] =       ");
+		seq_puts(m, "\nsync_stat[] =       ");
 		for (x = 0; x < 7; x++)
 			seq_printf(m, "\t%02x", hd->sync_stat[x]);
 	}
 #ifdef PROC_STATISTICS
 	if (hd->proc & PR_STATISTICS) {
-		seq_printf(m, "\ncommands issued:    ");
+		seq_puts(m, "\ncommands issued:    ");
 		for (x = 0; x < 7; x++)
 			seq_printf(m, "\t%ld", hd->cmd_cnt[x]);
-		seq_printf(m, "\ndisconnects allowed:");
+		seq_puts(m, "\ndisconnects allowed:");
 		for (x = 0; x < 7; x++)
 			seq_printf(m, "\t%ld", hd->disc_allowed_cnt[x]);
-		seq_printf(m, "\ndisconnects done:   ");
+		seq_puts(m, "\ndisconnects done:   ");
 		for (x = 0; x < 7; x++)
 			seq_printf(m, "\t%ld", hd->disc_done_cnt[x]);
 		seq_printf(m, "\ninterrupts:      \t%ld", hd->int_cnt);
 	}
 #endif
 	if (hd->proc & PR_CONNECTED) {
-		seq_printf(m, "\nconnected:     ");
+		seq_puts(m, "\nconnected:     ");
 		if (hd->connected) {
 			cmd = (Scsi_Cmnd *) hd->connected;
 			seq_printf(m, " %d:%llu(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
 		}
 	}
 	if (hd->proc & PR_INPUTQ) {
-		seq_printf(m, "\ninput_Q:       ");
+		seq_puts(m, "\ninput_Q:       ");
 		cmd = (Scsi_Cmnd *) hd->input_Q;
 		while (cmd) {
 			seq_printf(m, " %d:%llu(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
@@ -2263,7 +2263,7 @@ static int in2000_show_info(struct seq_file *m, struct Scsi_Host *instance)
 		}
 	}
 	if (hd->proc & PR_DISCQ) {
-		seq_printf(m, "\ndisconnected_Q:");
+		seq_puts(m, "\ndisconnected_Q:");
 		cmd = (Scsi_Cmnd *) hd->disconnected_Q;
 		while (cmd) {
 			seq_printf(m, " %d:%llu(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
@@ -2273,7 +2273,7 @@ static int in2000_show_info(struct seq_file *m, struct Scsi_Host *instance)
 	if (hd->proc & PR_TEST) {
 		;		/* insert your own custom function here */
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 	spin_unlock_irqrestore(instance->host_lock, flags);
 #endif				/* PROC_INTERFACE */
 	return 0;
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index e5c2843..615a9a3 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -2038,15 +2038,14 @@ ips_host_info(ips_ha_t *ha, struct seq_file *m)
 {
 	METHOD_TRACE("ips_host_info", 1);
 
-	seq_printf(m, "\nIBM ServeRAID General Information:\n\n");
+	seq_puts(m, "\nIBM ServeRAID General Information:\n\n");
 
 	if ((le32_to_cpu(ha->nvram->signature) == IPS_NVRAM_P5_SIG) &&
 	    (le16_to_cpu(ha->nvram->adapter_type) != 0))
 		seq_printf(m, "\tController Type                   : %s\n",
 			  ips_adapter_name[ha->ad_type - 1]);
 	else
-		seq_printf(m,
-			  "\tController Type                   : Unknown\n");
+		seq_puts(m, "\tController Type                   : Unknown\n");
 
 	if (ha->io_addr)
 		seq_printf(m,
@@ -2138,7 +2137,7 @@ ips_host_info(ips_ha_t *ha, struct seq_file *m)
 	seq_printf(m, "\tCurrent Active PT Commands        : %d\n",
 		  ha->num_ioctl);
 
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 	return 0;
 }
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 2485255..bc7b34c 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -2240,7 +2240,7 @@ proc_show_battery(struct seq_file *m, void *v)
 		goto free_pdev;
 
 	if( mega_adapinq(adapter, dma_handle) != 0 ) {
-		seq_printf(m, "Adapter inquiry failed.\n");
+		seq_puts(m, "Adapter inquiry failed.\n");
 		printk(KERN_WARNING "megaraid: inquiry failed.\n");
 		goto free_inquiry;
 	}
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
index 3e77551..8f6b1b4 100644
--- a/drivers/scsi/nsp32.c
+++ b/drivers/scsi/nsp32.c
@@ -1456,7 +1456,7 @@ static int nsp32_show_info(struct seq_file *m, struct Scsi_Host *host)
 	data = (nsp32_hw_data *)host->hostdata;
 	base = host->io_port;
 
-	seq_printf(m, "NinjaSCSI-32 status\n\n");
+	seq_puts(m, "NinjaSCSI-32 status\n\n");
 	seq_printf(m, "Driver version:        %s, $Revision: 1.33 $\n", nsp32_release_version);
 	seq_printf(m, "SCSI host No.:         %d\n",		hostno);
 	seq_printf(m, "IRQ:                   %d\n",		host->irq);
@@ -1478,25 +1478,25 @@ static int nsp32_show_info(struct seq_file *m, struct Scsi_Host *host)
 	spin_unlock_irqrestore(&(data->Lock), flags);
 
 
-	seq_printf(m, "SDTR status\n");
+	seq_puts(m, "SDTR status\n");
 	for (id = 0; id < ARRAY_SIZE(data->target); id++) {
 
 		seq_printf(m, "id %d: ", id);
 
 		if (id == host->this_id) {
-			seq_printf(m, "----- NinjaSCSI-32 host adapter\n");
+			seq_puts(m, "----- NinjaSCSI-32 host adapter\n");
 			continue;
 		}
 
 		if (data->target[id].sync_flag == SDTR_DONE) {
 			if (data->target[id].period == 0            &&
 			    data->target[id].offset == ASYNC_OFFSET ) {
-				seq_printf(m, "async");
+				seq_puts(m, "async");
 			} else {
-				seq_printf(m, " sync");
+				seq_puts(m, " sync");
 			}
 		} else {
-			seq_printf(m, " none");
+			seq_puts(m, " none");
 		}
 
 		if (data->target[id].period != 0) {
@@ -1509,7 +1509,7 @@ static int nsp32_show_info(struct seq_file *m, struct Scsi_Host *host)
 				data->target[id].offset
 				);
 		}
-		seq_printf(m, "\n");
+		seq_puts(m, "\n");
 	}
 	return 0;
 }
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index 83db942..bf883a6 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -1375,58 +1375,58 @@ static int nsp_show_info(struct seq_file *m, struct Scsi_Host *host)
 	hostno = host->host_no;
 	data = (nsp_hw_data *)host->hostdata;
 
-	seq_printf(m, "NinjaSCSI status\n\n");
-	seq_printf(m, "Driver version:        $Revision: 1.23 $\n");
+	seq_puts(m, "NinjaSCSI status\n\n");
+	seq_puts(m, "Driver version:        $Revision: 1.23 $\n");
 	seq_printf(m, "SCSI host No.:         %d\n",          hostno);
 	seq_printf(m, "IRQ:                   %d\n",          host->irq);
 	seq_printf(m, "IO:                    0x%lx-0x%lx\n", host->io_port, host->io_port + host->n_io_port - 1);
 	seq_printf(m, "MMIO(virtual address): 0x%lx-0x%lx\n", host->base, host->base + data->MmioLength - 1);
 	seq_printf(m, "sg_tablesize:          %d\n",          host->sg_tablesize);
 
-	seq_printf(m, "burst transfer mode:   ");
+	seq_puts(m, "burst transfer mode:   ");
 	switch (nsp_burst_mode) {
 	case BURST_IO8:
-		seq_printf(m, "io8");
+		seq_puts(m, "io8");
 		break;
 	case BURST_IO32:
-		seq_printf(m, "io32");
+		seq_puts(m, "io32");
 		break;
 	case BURST_MEM32:
-		seq_printf(m, "mem32");
+		seq_puts(m, "mem32");
 		break;
 	default:
-		seq_printf(m, "???");
+		seq_puts(m, "???");
 		break;
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 
 
 	spin_lock_irqsave(&(data->Lock), flags);
 	seq_printf(m, "CurrentSC:             0x%p\n\n",      data->CurrentSC);
 	spin_unlock_irqrestore(&(data->Lock), flags);
 
-	seq_printf(m, "SDTR status\n");
+	seq_puts(m, "SDTR status\n");
 	for(id = 0; id < ARRAY_SIZE(data->Sync); id++) {
 
 		seq_printf(m, "id %d: ", id);
 
 		if (id == host->this_id) {
-			seq_printf(m, "----- NinjaSCSI-3 host adapter\n");
+			seq_puts(m, "----- NinjaSCSI-3 host adapter\n");
 			continue;
 		}
 
 		switch(data->Sync[id].SyncNegotiation) {
 		case SYNC_OK:
-			seq_printf(m, " sync");
+			seq_puts(m, " sync");
 			break;
 		case SYNC_NG:
-			seq_printf(m, "async");
+			seq_puts(m, "async");
 			break;
 		case SYNC_NOT_YET:
-			seq_printf(m, " none");
+			seq_puts(m, " none");
 			break;
 		default:
-			seq_printf(m, "?????");
+			seq_puts(m, "?????");
 			break;
 		}
 
@@ -1439,7 +1439,7 @@ static int nsp_show_info(struct seq_file *m, struct Scsi_Host *host)
 				data->Sync[id].SyncOffset
 				);
 		}
-		seq_printf(m, "\n");
+		seq_puts(m, "\n");
 	}
 	return 0;
 }
diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c
index 2ca39b8..c837ba3 100644
--- a/drivers/scsi/qla2xxx/qla_dfs.c
+++ b/drivers/scsi/qla2xxx/qla_dfs.c
@@ -23,10 +23,10 @@ qla2x00_dfs_fce_show(struct seq_file *s, void *unused)
 
 	mutex_lock(&ha->fce_mutex);
 
-	seq_printf(s, "FCE Trace Buffer\n");
+	seq_puts(s, "FCE Trace Buffer\n");
 	seq_printf(s, "In Pointer = %llx\n\n", (unsigned long long)ha->fce_wr);
 	seq_printf(s, "Base = %llx\n\n", (unsigned long long) ha->fce_dma);
-	seq_printf(s, "FCE Enable Registers\n");
+	seq_puts(s, "FCE Enable Registers\n");
 	seq_printf(s, "%08x %08x %08x %08x %08x %08x\n",
 	    ha->fce_mb[0], ha->fce_mb[2], ha->fce_mb[3], ha->fce_mb[4],
 	    ha->fce_mb[5], ha->fce_mb[6]);
@@ -38,11 +38,11 @@ qla2x00_dfs_fce_show(struct seq_file *s, void *unused)
 			seq_printf(s, "\n%llx: ",
 			    (unsigned long long)((cnt * 4) + fce_start));
 		else
-			seq_printf(s, " ");
+			seq_puts(s, " ");
 		seq_printf(s, "%08x", *fce++);
 	}
 
-	seq_printf(s, "\nEnd\n");
+	seq_puts(s, "\nEnd\n");
 
 	mutex_unlock(&ha->fce_mutex);
 
diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c
index 6fcefa2..581de8f 100644
--- a/drivers/scsi/scsi_proc.c
+++ b/drivers/scsi/scsi_proc.c
@@ -189,36 +189,36 @@ static int proc_print_scsidevice(struct device *dev, void *data)
 		sdev->host->host_no, sdev->channel, sdev->id, sdev->lun);
 	for (i = 0; i < 8; i++) {
 		if (sdev->vendor[i] >= 0x20)
-			seq_printf(s, "%c", sdev->vendor[i]);
+			seq_putc(s, sdev->vendor[i]);
 		else
-			seq_printf(s, " ");
+			seq_puts(s, " ");
 	}
 
-	seq_printf(s, " Model: ");
+	seq_puts(s, " Model: ");
 	for (i = 0; i < 16; i++) {
 		if (sdev->model[i] >= 0x20)
-			seq_printf(s, "%c", sdev->model[i]);
+			seq_putc(s, sdev->model[i]);
 		else
-			seq_printf(s, " ");
+			seq_puts(s, " ");
 	}
 
-	seq_printf(s, " Rev: ");
+	seq_puts(s, " Rev: ");
 	for (i = 0; i < 4; i++) {
 		if (sdev->rev[i] >= 0x20)
-			seq_printf(s, "%c", sdev->rev[i]);
+			seq_putc(s, sdev->rev[i]);
 		else
-			seq_printf(s, " ");
+			seq_puts(s, " ");
 	}
 
-	seq_printf(s, "\n");
+	seq_puts(s, "\n");
 
 	seq_printf(s, "  Type:   %s ", scsi_device_type(sdev->type));
 	seq_printf(s, "               ANSI  SCSI revision: %02x",
 			sdev->scsi_level - (sdev->scsi_level > 1));
 	if (sdev->scsi_level == 2)
-		seq_printf(s, " CCS\n");
+		seq_puts(s, " CCS\n");
 	else
-		seq_printf(s, "\n");
+		seq_puts(s, "\n");
 
 out:
 	return 0;
diff --git a/drivers/scsi/scsi_trace.c b/drivers/scsi/scsi_trace.c
index 503594e..e4e122b 100644
--- a/drivers/scsi/scsi_trace.c
+++ b/drivers/scsi/scsi_trace.c
@@ -143,7 +143,7 @@ scsi_trace_rw32(struct trace_seq *p, unsigned char *cdb, int len)
 		cmd = "WRITE_SAME";
 		break;
 	default:
-		trace_seq_printf(p, "UNKNOWN");
+		trace_seq_puts(p, "UNKNOWN");
 		goto out;
 	}
 
@@ -204,7 +204,7 @@ scsi_trace_service_action_in(struct trace_seq *p, unsigned char *cdb, int len)
 		cmd = "GET_LBA_STATUS";
 		break;
 	default:
-		trace_seq_printf(p, "UNKNOWN");
+		trace_seq_puts(p, "UNKNOWN");
 		goto out;
 	}
 
@@ -249,7 +249,7 @@ scsi_trace_misc(struct trace_seq *p, unsigned char *cdb, int len)
 {
 	const char *ret = trace_seq_buffer_ptr(p);
 
-	trace_seq_printf(p, "-");
+	trace_seq_puts(p, "-");
 	trace_seq_putc(p, 0);
 
 	return ret;
diff --git a/drivers/scsi/wd33c93.c b/drivers/scsi/wd33c93.c
index c0506de..6e041a7 100644
--- a/drivers/scsi/wd33c93.c
+++ b/drivers/scsi/wd33c93.c
@@ -2143,22 +2143,22 @@ wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance)
 		seq_printf(m, "\nclock_freq=%02x no_sync=%02x no_dma=%d"
 			" dma_mode=%02x fast=%d",
 			hd->clock_freq, hd->no_sync, hd->no_dma, hd->dma_mode, hd->fast);
-		seq_printf(m, "\nsync_xfer[] =       ");
+		seq_puts(m, "\nsync_xfer[] =       ");
 		for (x = 0; x < 7; x++)
 			seq_printf(m, "\t%02x", hd->sync_xfer[x]);
-		seq_printf(m, "\nsync_stat[] =       ");
+		seq_puts(m, "\nsync_stat[] =       ");
 		for (x = 0; x < 7; x++)
 			seq_printf(m, "\t%02x", hd->sync_stat[x]);
 	}
 #ifdef PROC_STATISTICS
 	if (hd->proc & PR_STATISTICS) {
-		seq_printf(m, "\ncommands issued:    ");
+		seq_puts(m, "\ncommands issued:    ");
 		for (x = 0; x < 7; x++)
 			seq_printf(m, "\t%ld", hd->cmd_cnt[x]);
-		seq_printf(m, "\ndisconnects allowed:");
+		seq_puts(m, "\ndisconnects allowed:");
 		for (x = 0; x < 7; x++)
 			seq_printf(m, "\t%ld", hd->disc_allowed_cnt[x]);
-		seq_printf(m, "\ndisconnects done:   ");
+		seq_puts(m, "\ndisconnects done:   ");
 		for (x = 0; x < 7; x++)
 			seq_printf(m, "\t%ld", hd->disc_done_cnt[x]);
 		seq_printf(m,
@@ -2167,7 +2167,7 @@ wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance)
 	}
 #endif
 	if (hd->proc & PR_CONNECTED) {
-		seq_printf(m, "\nconnected:     ");
+		seq_puts(m, "\nconnected:     ");
 		if (hd->connected) {
 			cmd = (struct scsi_cmnd *) hd->connected;
 			seq_printf(m, " %d:%llu(%02x)",
@@ -2175,7 +2175,7 @@ wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance)
 		}
 	}
 	if (hd->proc & PR_INPUTQ) {
-		seq_printf(m, "\ninput_Q:       ");
+		seq_puts(m, "\ninput_Q:       ");
 		cmd = (struct scsi_cmnd *) hd->input_Q;
 		while (cmd) {
 			seq_printf(m, " %d:%llu(%02x)",
@@ -2184,7 +2184,7 @@ wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance)
 		}
 	}
 	if (hd->proc & PR_DISCQ) {
-		seq_printf(m, "\ndisconnected_Q:");
+		seq_puts(m, "\ndisconnected_Q:");
 		cmd = (struct scsi_cmnd *) hd->disconnected_Q;
 		while (cmd) {
 			seq_printf(m, " %d:%llu(%02x)",
@@ -2192,7 +2192,7 @@ wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance)
 			cmd = (struct scsi_cmnd *) cmd->host_scribble;
 		}
 	}
-	seq_printf(m, "\n");
+	seq_puts(m, "\n");
 	spin_unlock_irq(&hd->lock);
 #endif				/* PROC_INTERFACE */
 	return 0;
diff --git a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c
index 2d7c62f..0c0f17b 100644
--- a/drivers/scsi/wd7000.c
+++ b/drivers/scsi/wd7000.c
@@ -1330,9 +1330,9 @@ static int wd7000_show_info(struct seq_file *m, struct Scsi_Host *host)
 	icmbs = adapter->mb.icmb;
 
 	seq_printf(m, "\nControl port value: 0x%x\n", adapter->control);
-	seq_printf(m, "Incoming mailbox:\n");
+	seq_puts(m, "Incoming mailbox:\n");
 	seq_printf(m, "  size: %d\n", ICMB_CNT);
-	seq_printf(m, "  queued messages: ");
+	seq_puts(m, "  queued messages: ");
 
 	for (i = count = 0; i < ICMB_CNT; i++)
 		if (icmbs[i].status) {
@@ -1340,12 +1340,12 @@ static int wd7000_show_info(struct seq_file *m, struct Scsi_Host *host)
 			seq_printf(m, "0x%x ", i);
 		}
 
-	seq_printf(m, count ? "\n" : "none\n");
+	seq_puts(m, count ? "\n" : "none\n");
 
-	seq_printf(m, "Outgoing mailbox:\n");
+	seq_puts(m, "Outgoing mailbox:\n");
 	seq_printf(m, "  size: %d\n", OGMB_CNT);
 	seq_printf(m, "  next message: 0x%x\n", adapter->next_ogmb);
-	seq_printf(m, "  queued messages: ");
+	seq_puts(m, "  queued messages: ");
 
 	for (i = count = 0; i < OGMB_CNT; i++)
 		if (ogmbs[i].status) {
@@ -1353,7 +1353,7 @@ static int wd7000_show_info(struct seq_file *m, struct Scsi_Host *host)
 			seq_printf(m, "0x%x ", i);
 		}
 
-	seq_printf(m, count ? "\n" : "none\n");
+	seq_puts(m, count ? "\n" : "none\n");
 #endif
 
 	spin_unlock_irqrestore(host->host_lock, flags);
-- 
2.0.4


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

* [PATCH v2 5/6] scsi: misc: Merge consecutive seq_puts calls
  2014-12-02 23:10 ` [PATCH v2 0/6] " Rasmus Villemoes
                     ` (3 preceding siblings ...)
  2014-12-02 23:10   ` [PATCH v2 4/6] scsi: misc: " Rasmus Villemoes
@ 2014-12-02 23:10   ` Rasmus Villemoes
  2015-01-30  1:42     ` Finn Thain
  2014-12-02 23:10   ` [PATCH v2 6/6] scsi: misc: Print single-character strings with seq_putc Rasmus Villemoes
                     ` (2 subsequent siblings)
  7 siblings, 1 reply; 26+ messages in thread
From: Rasmus Villemoes @ 2014-12-02 23:10 UTC (permalink / raw)
  To: James E.J. Bottomley, Finn Thain
  Cc: linux-scsi, linux-kernel, Rasmus Villemoes

Consecutive seq_puts calls with literal strings may be replaced by a
single call, saving a little .text.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 drivers/scsi/advansys.c      | 43 +++++++++++++++----------------------------
 drivers/scsi/atp870u.c       |  5 ++---
 drivers/scsi/dc395x.c        |  4 ++--
 drivers/scsi/pcmcia/nsp_cs.c |  4 ++--
 4 files changed, 21 insertions(+), 35 deletions(-)

diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index d31fc6d..c4d0910 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -2903,11 +2903,9 @@ static void asc_prt_adv_bios(struct seq_file *m, struct Scsi_Host *shost)
 	 * the BIOS code segment base address.
 	 */
 	if (boardp->bios_signature != 0x55AA) {
-		seq_puts(m, "Disabled or Pre-3.1\n");
-		seq_puts(m,
-			 "BIOS either disabled or Pre-3.1. If it is pre-3.1, then a newer version\n");
-		seq_puts(m,
-			 "can be found at the ConnectCom FTP site: ftp://ftp.connectcom.net/pub\n");
+		seq_puts(m, "Disabled or Pre-3.1\n"
+			"BIOS either disabled or Pre-3.1. If it is pre-3.1, then a newer version\n"
+			"can be found at the ConnectCom FTP site: ftp://ftp.connectcom.net/pub\n");
 	} else {
 		major = (boardp->bios_version >> 12) & 0xF;
 		minor = (boardp->bios_version >> 8) & 0xF;
@@ -2923,9 +2921,8 @@ static void asc_prt_adv_bios(struct seq_file *m, struct Scsi_Host *shost)
 		 */
 		if (major < 3 || (major <= 3 && minor < 1) ||
 		    (major <= 3 && minor <= 1 && letter < ('I' - 'A'))) {
-			seq_puts(m,
-				 "Newer version of ROM BIOS is available at the ConnectCom FTP site:\n");
-			seq_puts(m, "ftp://ftp.connectcom.net/pub\n");
+			seq_puts(m, "Newer version of ROM BIOS is available at the ConnectCom FTP site:\n"
+				"ftp://ftp.connectcom.net/pub\n");
 		}
 	}
 }
@@ -3071,27 +3068,23 @@ static void asc_prt_asc_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 	seq_puts(m, " Target ID:           ");
 	for (i = 0; i <= ASC_MAX_TID; i++)
 		seq_printf(m, " %d", i);
-	seq_puts(m, "\n");
 
-	seq_puts(m, " Disconnects:         ");
+	seq_puts(m, "\n Disconnects:         ");
 	for (i = 0; i <= ASC_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (ep->disc_enable & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_puts(m, "\n");
 
-	seq_puts(m, " Command Queuing:     ");
+	seq_puts(m, "\n Command Queuing:     ");
 	for (i = 0; i <= ASC_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (ep->use_cmd_qng & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_puts(m, "\n");
 
-	seq_puts(m, " Start Motor:         ");
+	seq_puts(m, "\n Start Motor:         ");
 	for (i = 0; i <= ASC_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (ep->start_motor & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_puts(m, "\n");
 
-	seq_puts(m, " Synchronous Transfer:");
+	seq_puts(m, "\n Synchronous Transfer:");
 	for (i = 0; i <= ASC_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (ep->init_sdtr & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
@@ -3410,10 +3403,9 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
 			   i,
 			   (v->use_tagged_qng & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
 	}
-	seq_puts(m, "\n");
 
 	/* Current number of commands waiting for a device. */
-	seq_puts(m, " Command Queue Pending:");
+	seq_puts(m, "\n Command Queue Pending:");
 	for (i = 0; i <= ASC_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3421,10 +3413,9 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
 		}
 		seq_printf(m, " %X:%u", i, v->cur_dvc_qng[i]);
 	}
-	seq_puts(m, "\n");
 
 	/* Current limit on number of commands that can be sent to a device. */
-	seq_puts(m, " Command Queue Limit:");
+	seq_puts(m, "\n Command Queue Limit:");
 	for (i = 0; i <= ASC_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3432,10 +3423,9 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
 		}
 		seq_printf(m, " %X:%u", i, v->max_dvc_qng[i]);
 	}
-	seq_puts(m, "\n");
 
 	/* Indicate whether the device has returned queue full status. */
-	seq_puts(m, " Command Queue Full:");
+	seq_puts(m, "\n Command Queue Full:");
 	for (i = 0; i <= ASC_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3447,9 +3437,8 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
 		else
 			seq_printf(m, " %X:N", i);
 	}
-	seq_puts(m, "\n");
 
-	seq_puts(m, " Synchronous Transfer:");
+	seq_puts(m, "\n Synchronous Transfer:");
 	for (i = 0; i <= ASC_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3555,9 +3544,8 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 			   i,
 			   (tagqng_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
 	}
-	seq_puts(m, "\n");
 
-	seq_puts(m, " Queue Limit:");
+	seq_puts(m, "\n Queue Limit:");
 	for (i = 0; i <= ADV_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3569,9 +3557,8 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 
 		seq_printf(m, " %X:%d", i, lrambyte);
 	}
-	seq_puts(m, "\n");
 
-	seq_puts(m, " Command Pending:");
+	seq_puts(m, "\n Command Pending:");
 	for (i = 0; i <= ADV_MAX_TID; i++) {
 		if ((chip_scsi_id == i) ||
 		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c
index 0b02467..0836433 100644
--- a/drivers/scsi/atp870u.c
+++ b/drivers/scsi/atp870u.c
@@ -3101,9 +3101,8 @@ static const char *atp870u_info(struct Scsi_Host *notused)
 
 static int atp870u_show_info(struct seq_file *m, struct Scsi_Host *HBAptr)
 {
-	seq_puts(m, "ACARD AEC-671X Driver Version: 2.6+ac\n");
-	seq_puts(m, "\n");
-	seq_puts(m, "Adapter Configuration:\n");
+	seq_puts(m, "ACARD AEC-671X Driver Version: 2.6+ac\n\n"
+		"Adapter Configuration:\n");
 	seq_printf(m, "               Base IO: %#.4lx\n", HBAptr->io_port);
 	seq_printf(m, "                   IRQ: %d\n", HBAptr->irq);
 	return 0;
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
index 3a55ea2..48c79f9 100644
--- a/drivers/scsi/dc395x.c
+++ b/drivers/scsi/dc395x.c
@@ -4623,8 +4623,8 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
 	unsigned long flags;
 	int dev;
 
-	seq_puts(m, DC395X_BANNER " PCI SCSI Host Adapter\n");
-	seq_puts(m, " Driver Version " DC395X_VERSION "\n");
+	seq_puts(m, DC395X_BANNER " PCI SCSI Host Adapter\n"
+		" Driver Version " DC395X_VERSION "\n");
 
 	DC395x_LOCK_IO(acb->scsi_host, flags);
 
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index bf883a6..acf558a 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -1375,8 +1375,8 @@ static int nsp_show_info(struct seq_file *m, struct Scsi_Host *host)
 	hostno = host->host_no;
 	data = (nsp_hw_data *)host->hostdata;
 
-	seq_puts(m, "NinjaSCSI status\n\n");
-	seq_puts(m, "Driver version:        $Revision: 1.23 $\n");
+	seq_puts(m, "NinjaSCSI status\n\n"
+		"Driver version:        $Revision: 1.23 $\n");
 	seq_printf(m, "SCSI host No.:         %d\n",          hostno);
 	seq_printf(m, "IRQ:                   %d\n",          host->irq);
 	seq_printf(m, "IO:                    0x%lx-0x%lx\n", host->io_port, host->io_port + host->n_io_port - 1);
-- 
2.0.4


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

* [PATCH v2 6/6] scsi: misc: Print single-character strings with seq_putc
  2014-12-02 23:10 ` [PATCH v2 0/6] " Rasmus Villemoes
                     ` (4 preceding siblings ...)
  2014-12-02 23:10   ` [PATCH v2 5/6] scsi: misc: Merge consecutive seq_puts calls Rasmus Villemoes
@ 2014-12-02 23:10   ` Rasmus Villemoes
  2015-01-30  1:44     ` Finn Thain
  2015-01-21 12:08   ` [PATCH v2 0/6] scsi: Some seq_file cleanups/optimizations Rasmus Villemoes
  2015-01-29  6:56   ` Finn Thain
  7 siblings, 1 reply; 26+ messages in thread
From: Rasmus Villemoes @ 2014-12-02 23:10 UTC (permalink / raw)
  To: James E.J. Bottomley, Finn Thain
  Cc: linux-scsi, linux-kernel, Rasmus Villemoes

Using seq_putc to print a single character saves at least a strlen()
call and a memory access, and may also give a small .text reduction.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 drivers/scsi/NCR5380.c              |  2 +-
 drivers/scsi/advansys.c             | 34 +++++++++++++++++-----------------
 drivers/scsi/aic7xxx/aic79xx_proc.c | 10 +++++-----
 drivers/scsi/aic7xxx/aic7xxx_proc.c | 10 +++++-----
 drivers/scsi/atari_NCR5380.c        |  2 +-
 drivers/scsi/dc395x.c               |  4 ++--
 drivers/scsi/esas2r/esas2r_main.c   |  2 +-
 drivers/scsi/in2000.c               |  2 +-
 drivers/scsi/ips.c                  |  2 +-
 drivers/scsi/nsp32.c                |  2 +-
 drivers/scsi/pcmcia/nsp_cs.c        |  4 ++--
 drivers/scsi/qla2xxx/qla_dfs.c      |  2 +-
 drivers/scsi/scsi_proc.c            | 10 +++++-----
 drivers/scsi/scsi_trace.c           |  2 +-
 drivers/scsi/wd33c93.c              |  2 +-
 15 files changed, 45 insertions(+), 45 deletions(-)

diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index a30af00..8981701 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -764,7 +764,7 @@ static void lprint_command(unsigned char *command, struct seq_file *m)
 	lprint_opcode(command[0], m);
 	for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i)
 		seq_printf(m, "%02x ", command[i]);
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 }
 
 static void lprint_opcode(int opcode, struct seq_file *m)
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index c4d0910..81ffb0f 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -3088,7 +3088,7 @@ static void asc_prt_asc_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 	for (i = 0; i <= ASC_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (ep->init_sdtr & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 #ifdef CONFIG_ISA
 	if (asc_dvc_varp->bus_type & ASC_IS_ISA) {
@@ -3203,7 +3203,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 	seq_puts(m, " Target ID:           ");
 	for (i = 0; i <= ADV_MAX_TID; i++)
 		seq_printf(m, " %X", i);
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
 		word = ep_3550->disc_enable;
@@ -3216,7 +3216,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 	for (i = 0; i <= ADV_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
 		word = ep_3550->tagqng_able;
@@ -3229,7 +3229,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 	for (i = 0; i <= ADV_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
 		word = ep_3550->start_motor;
@@ -3242,7 +3242,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 	for (i = 0; i <= ADV_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
 		seq_puts(m, " Synchronous Transfer:");
@@ -3250,7 +3250,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 			seq_printf(m, " %c",
 				   (ep_3550->sdtr_able & ADV_TID_TO_TIDMASK(i)) ?
 				   'Y' : 'N');
-		seq_puts(m, "\n");
+		seq_putc(m, '\n');
 	}
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
@@ -3259,7 +3259,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 			seq_printf(m, " %c",
 				   (ep_3550->ultra_able & ADV_TID_TO_TIDMASK(i))
 				   ? 'Y' : 'N');
-		seq_puts(m, "\n");
+		seq_putc(m, '\n');
 	}
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
@@ -3273,7 +3273,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 	for (i = 0; i <= ADV_MAX_TID; i++)
 		seq_printf(m, " %c",
 			   (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800 ||
 	    adv_dvc_varp->chip_type == ADV_CHIP_ASC38C1600) {
@@ -3318,7 +3318,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
 				seq_puts(m, "\n  ");
 			sdtr_speed >>= 4;
 		}
-		seq_puts(m, "\n");
+		seq_putc(m, '\n');
 	}
 }
 
@@ -3448,7 +3448,7 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
 			   i,
 			   (v->sdtr_done & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
 	}
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 	for (i = 0; i <= ASC_MAX_TID; i++) {
 		uchar syn_period_ix;
@@ -3483,7 +3483,7 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
 			seq_puts(m, "*\n");
 			renegotiate = 1;
 		} else {
-			seq_puts(m, "\n");
+			seq_putc(m, '\n');
 		}
 	}
 
@@ -3570,7 +3570,7 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 
 		seq_printf(m, " %X:%d", i, lrambyte);
 	}
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 	AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able);
 	seq_puts(m, " Wide Enabled:");
@@ -3584,7 +3584,7 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 			   i,
 			   (wdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
 	}
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 	AdvReadWordLram(iop_base, ASC_MC_WDTR_DONE, wdtr_done);
 	seq_puts(m, " Transfer Bit Width:");
@@ -3603,11 +3603,11 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 
 		if ((wdtr_able & ADV_TID_TO_TIDMASK(i)) &&
 		    (wdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) {
-			seq_puts(m, "*");
+			seq_putc(m, '*');
 			renegotiate = 1;
 		}
 	}
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 	AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able);
 	seq_puts(m, " Synchronous Enabled:");
@@ -3621,7 +3621,7 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 			   i,
 			   (sdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
 	}
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 	AdvReadWordLram(iop_base, ASC_MC_SDTR_DONE, sdtr_done);
 	for (i = 0; i <= ADV_MAX_TID; i++) {
@@ -3670,7 +3670,7 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
 			seq_puts(m, "*\n");
 			renegotiate = 1;
 		} else {
-			seq_puts(m, "\n");
+			seq_putc(m, '\n');
 		}
 	}
 
diff --git a/drivers/scsi/aic7xxx/aic79xx_proc.c b/drivers/scsi/aic7xxx/aic79xx_proc.c
index e095598..add2da5 100644
--- a/drivers/scsi/aic7xxx/aic79xx_proc.c
+++ b/drivers/scsi/aic7xxx/aic79xx_proc.c
@@ -148,9 +148,9 @@ ahd_format_transinfo(struct seq_file *m, struct ahd_transinfo *tinfo)
 		}
 		seq_printf(m, "%dbit)", 8 * (0x01 << tinfo->width));
 	} else if (freq != 0) {
-		seq_puts(m, ")");
+		seq_putc(m, ')');
 	}
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 }
 
 static void
@@ -294,14 +294,14 @@ ahd_linux_show_info(struct seq_file *m, struct Scsi_Host *shost)
 		seq_puts(m, "Serial EEPROM:\n");
 		for (i = 0; i < sizeof(*ahd->seep_config)/2; i++) {
 			if (((i % 8) == 0) && (i != 0)) {
-				seq_puts(m, "\n");
+				seq_putc(m, '\n');
 			}
 			seq_printf(m, "0x%.4x ",
 				  ((uint16_t*)ahd->seep_config)[i]);
 		}
-		seq_puts(m, "\n");
+		seq_putc(m, '\n');
 	}
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 	if ((ahd->features & AHD_WIDE) == 0)
 		max_targ = 8;
diff --git a/drivers/scsi/aic7xxx/aic7xxx_proc.c b/drivers/scsi/aic7xxx/aic7xxx_proc.c
index 25511ca..1845960 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_proc.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_proc.c
@@ -125,9 +125,9 @@ ahc_format_transinfo(struct seq_file *m, struct ahc_transinfo *tinfo)
 		}
 		seq_printf(m, "%dbit)", 8 * (0x01 << tinfo->width));
 	} else if (freq != 0) {
-		seq_puts(m, ")");
+		seq_putc(m, ')');
 	}
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 }
 
 static void
@@ -308,14 +308,14 @@ ahc_linux_show_info(struct seq_file *m, struct Scsi_Host *shost)
 		seq_puts(m, "Serial EEPROM:\n");
 		for (i = 0; i < sizeof(*ahc->seep_config)/2; i++) {
 			if (((i % 8) == 0) && (i != 0)) {
-				seq_puts(m, "\n");
+				seq_putc(m, '\n');
 			}
 			seq_printf(m, "0x%.4x ",
 				  ((uint16_t*)ahc->seep_config)[i]);
 		}
-		seq_puts(m, "\n");
+		seq_putc(m, '\n');
 	}
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 	max_targ = 16;
 	if ((ahc->features & (AHC_WIDE|AHC_TWIN)) == 0)
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
index 04d0c6e..a702554 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -716,7 +716,7 @@ static void show_Scsi_Cmnd(struct scsi_cmnd *cmd, struct seq_file *m)
 	seq_printf(m, "%2d (0x%02x)", command[0], command[0]);
 	for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i)
 		seq_printf(m, " %02x", command[i]);
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 }
 
 static int __maybe_unused NCR5380_show_info(struct seq_file *m,
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
index 48c79f9..5ee7f44 100644
--- a/drivers/scsi/dc395x.c
+++ b/drivers/scsi/dc395x.c
@@ -4692,7 +4692,7 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
 	if (timer_pending(&acb->waiting_timer))
 		seq_puts(m, "Waiting queue timer running\n");
 	else
-		seq_puts(m, "\n");
+		seq_putc(m, '\n');
 
 	list_for_each_entry(dcb, &acb->dcb_list, list) {
 		struct ScsiReqBlk *srb;
@@ -4709,7 +4709,7 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
 		list_for_each_entry(srb, &dcb->srb_going_list, list)
 			seq_printf(m, " %p", srb->cmd);
 		if (!list_empty(&dcb->srb_waiting_list) || !list_empty(&dcb->srb_going_list))
-			seq_puts(m, "\n");
+			seq_putc(m, '\n');
 	}
 
 	if (debug_enabled(DBG_1)) {
diff --git a/drivers/scsi/esas2r/esas2r_main.c b/drivers/scsi/esas2r/esas2r_main.c
index 593ff8a..226c280 100644
--- a/drivers/scsi/esas2r/esas2r_main.c
+++ b/drivers/scsi/esas2r/esas2r_main.c
@@ -750,7 +750,7 @@ int esas2r_show_info(struct seq_file *m, struct Scsi_Host *sh)
 	if (dev_count == 0)
 		seq_puts(m, "none\n");
 
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 	return 0;
 
 }
diff --git a/drivers/scsi/in2000.c b/drivers/scsi/in2000.c
index a73395e..3882d9f 100644
--- a/drivers/scsi/in2000.c
+++ b/drivers/scsi/in2000.c
@@ -2273,7 +2273,7 @@ static int in2000_show_info(struct seq_file *m, struct Scsi_Host *instance)
 	if (hd->proc & PR_TEST) {
 		;		/* insert your own custom function here */
 	}
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 	spin_unlock_irqrestore(instance->host_lock, flags);
 #endif				/* PROC_INTERFACE */
 	return 0;
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index 615a9a3..7542f11 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -2137,7 +2137,7 @@ ips_host_info(ips_ha_t *ha, struct seq_file *m)
 	seq_printf(m, "\tCurrent Active PT Commands        : %d\n",
 		  ha->num_ioctl);
 
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 	return 0;
 }
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
index 8f6b1b4..c6077ce 100644
--- a/drivers/scsi/nsp32.c
+++ b/drivers/scsi/nsp32.c
@@ -1509,7 +1509,7 @@ static int nsp32_show_info(struct seq_file *m, struct Scsi_Host *host)
 				data->target[id].offset
 				);
 		}
-		seq_puts(m, "\n");
+		seq_putc(m, '\n');
 	}
 	return 0;
 }
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index acf558a..1b6c883 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -1398,7 +1398,7 @@ static int nsp_show_info(struct seq_file *m, struct Scsi_Host *host)
 		seq_puts(m, "???");
 		break;
 	}
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 
 	spin_lock_irqsave(&(data->Lock), flags);
@@ -1439,7 +1439,7 @@ static int nsp_show_info(struct seq_file *m, struct Scsi_Host *host)
 				data->Sync[id].SyncOffset
 				);
 		}
-		seq_puts(m, "\n");
+		seq_putc(m, '\n');
 	}
 	return 0;
 }
diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c
index c837ba3..15cf074 100644
--- a/drivers/scsi/qla2xxx/qla_dfs.c
+++ b/drivers/scsi/qla2xxx/qla_dfs.c
@@ -38,7 +38,7 @@ qla2x00_dfs_fce_show(struct seq_file *s, void *unused)
 			seq_printf(s, "\n%llx: ",
 			    (unsigned long long)((cnt * 4) + fce_start));
 		else
-			seq_puts(s, " ");
+			seq_putc(s, ' ');
 		seq_printf(s, "%08x", *fce++);
 	}
 
diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c
index 581de8f..251598e 100644
--- a/drivers/scsi/scsi_proc.c
+++ b/drivers/scsi/scsi_proc.c
@@ -191,7 +191,7 @@ static int proc_print_scsidevice(struct device *dev, void *data)
 		if (sdev->vendor[i] >= 0x20)
 			seq_putc(s, sdev->vendor[i]);
 		else
-			seq_puts(s, " ");
+			seq_putc(s, ' ');
 	}
 
 	seq_puts(s, " Model: ");
@@ -199,7 +199,7 @@ static int proc_print_scsidevice(struct device *dev, void *data)
 		if (sdev->model[i] >= 0x20)
 			seq_putc(s, sdev->model[i]);
 		else
-			seq_puts(s, " ");
+			seq_putc(s, ' ');
 	}
 
 	seq_puts(s, " Rev: ");
@@ -207,10 +207,10 @@ static int proc_print_scsidevice(struct device *dev, void *data)
 		if (sdev->rev[i] >= 0x20)
 			seq_putc(s, sdev->rev[i]);
 		else
-			seq_puts(s, " ");
+			seq_putc(s, ' ');
 	}
 
-	seq_puts(s, "\n");
+	seq_putc(s, '\n');
 
 	seq_printf(s, "  Type:   %s ", scsi_device_type(sdev->type));
 	seq_printf(s, "               ANSI  SCSI revision: %02x",
@@ -218,7 +218,7 @@ static int proc_print_scsidevice(struct device *dev, void *data)
 	if (sdev->scsi_level == 2)
 		seq_puts(s, " CCS\n");
 	else
-		seq_puts(s, "\n");
+		seq_putc(s, '\n');
 
 out:
 	return 0;
diff --git a/drivers/scsi/scsi_trace.c b/drivers/scsi/scsi_trace.c
index e4e122b..5cc386c 100644
--- a/drivers/scsi/scsi_trace.c
+++ b/drivers/scsi/scsi_trace.c
@@ -249,7 +249,7 @@ scsi_trace_misc(struct trace_seq *p, unsigned char *cdb, int len)
 {
 	const char *ret = trace_seq_buffer_ptr(p);
 
-	trace_seq_puts(p, "-");
+	trace_seq_putc(p, '-');
 	trace_seq_putc(p, 0);
 
 	return ret;
diff --git a/drivers/scsi/wd33c93.c b/drivers/scsi/wd33c93.c
index 6e041a7..9e09da4 100644
--- a/drivers/scsi/wd33c93.c
+++ b/drivers/scsi/wd33c93.c
@@ -2192,7 +2192,7 @@ wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance)
 			cmd = (struct scsi_cmnd *) cmd->host_scribble;
 		}
 	}
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 	spin_unlock_irq(&hd->lock);
 #endif				/* PROC_INTERFACE */
 	return 0;
-- 
2.0.4


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

* Re: [PATCH v2 0/6] scsi: Some seq_file cleanups/optimizations
  2014-12-02 23:10 ` [PATCH v2 0/6] " Rasmus Villemoes
                     ` (5 preceding siblings ...)
  2014-12-02 23:10   ` [PATCH v2 6/6] scsi: misc: Print single-character strings with seq_putc Rasmus Villemoes
@ 2015-01-21 12:08   ` Rasmus Villemoes
  2015-01-29  6:56   ` Finn Thain
  7 siblings, 0 replies; 26+ messages in thread
From: Rasmus Villemoes @ 2015-01-21 12:08 UTC (permalink / raw)
  To: James E.J. Bottomley; +Cc: Finn Thain, linux-scsi, linux-kernel

On Wed, Dec 03 2014, Rasmus Villemoes <linux@rasmusvillemoes.dk> wrote:

> These patches mostly replace seq_printf with simpler and faster
> equivalents, e.g. seq_printf(m, "something") => seq_puts(m,
> "something") and seq_printf(m, "\n") => seq_putc(m, '\n). But before
> my Coccinelle scripts could be unleashed I had to clean up an
> unnecessary macro.
>
> The patches don't change the semantics of the code (well, that's the
> idea anyway), but should make it slightly smaller and faster.
>
> v2: Redone on top of git://git.infradead.org/users/hch/scsi-queue.git drivers-for-3.19
>

Ping. Was this picked up, or did it just go to /dev/null?

Rasmus

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

* Re: [PATCH v2 0/6] scsi: Some seq_file cleanups/optimizations
  2014-12-02 23:10 ` [PATCH v2 0/6] " Rasmus Villemoes
                     ` (6 preceding siblings ...)
  2015-01-21 12:08   ` [PATCH v2 0/6] scsi: Some seq_file cleanups/optimizations Rasmus Villemoes
@ 2015-01-29  6:56   ` Finn Thain
  2015-01-29  9:16     ` Rasmus Villemoes
  7 siblings, 1 reply; 26+ messages in thread
From: Finn Thain @ 2015-01-29  6:56 UTC (permalink / raw)
  To: Rasmus Villemoes
  Cc: James E.J. Bottomley, linux-fsdevel, linux-scsi, linux-kernel


I have one reservation about this patch series.

For example, the changes,

-	seq_printf(m, "%s", p);
+	seq_puts(m, p);

These calls are not equivalent because the bounds check is not the same. 
seq_puts will fail when m->count + strlen(p) == m->size.

seq_write() does the same check as seq_puts() but the other routines vary.

There's a similar situation with the changes,

-	seq_puts(m, "x");
+	seq_putc(m, 'x');

Have you considered what the implications might be? Are there any?

-- 

On Wed, 3 Dec 2014, Rasmus Villemoes wrote:

> These patches mostly replace seq_printf with simpler and faster
> equivalents, e.g. seq_printf(m, "something") => seq_puts(m,
> "something") and seq_printf(m, "\n") => seq_putc(m, '\n). But before
> my Coccinelle scripts could be unleashed I had to clean up an
> unnecessary macro.
> 
> The patches don't change the semantics of the code (well, that's the
> idea anyway), but should make it slightly smaller and faster.
> 
> v2: Redone on top of git://git.infradead.org/users/hch/scsi-queue.git drivers-for-3.19
> 
> Rasmus Villemoes (6):
>   scsi: Remove SPRINTF macro
>   scsi/advansys: Replace seq_printf with seq_puts
>   scsi/aha152x: Replace seq_printf with seq_puts
>   scsi: misc:  Replace seq_printf with seq_puts
>   scsi: misc: Merge consecutive seq_puts calls
>   scsi: misc: Print single-character strings with seq_putc
> 
>  drivers/scsi/BusLogic.c             |  10 +-
>  drivers/scsi/NCR5380.c              |  20 ++-
>  drivers/scsi/advansys.c             | 142 ++++++++---------
>  drivers/scsi/aha152x.c              | 295 ++++++++++++++++++------------------
>  drivers/scsi/aic7xxx/aic79xx_proc.c |  38 +++--
>  drivers/scsi/aic7xxx/aic7xxx_proc.c |  24 +--
>  drivers/scsi/arm/fas216.c           |   6 +-
>  drivers/scsi/atari_NCR5380.c        |   4 +-
>  drivers/scsi/atp870u.c              |   5 +-
>  drivers/scsi/dc395x.c               |  79 +++++-----
>  drivers/scsi/dpt_i2o.c              |   2 +-
>  drivers/scsi/eata_pio.c             |   2 +-
>  drivers/scsi/esas2r/esas2r_main.c   |   2 +-
>  drivers/scsi/gdth_proc.c            |  24 +--
>  drivers/scsi/in2000.c               |  18 +--
>  drivers/scsi/ips.c                  |   7 +-
>  drivers/scsi/megaraid.c             |   2 +-
>  drivers/scsi/nsp32.c                |  41 +++--
>  drivers/scsi/pcmcia/nsp_cs.c        |  50 +++---
>  drivers/scsi/qla2xxx/qla_dfs.c      |   8 +-
>  drivers/scsi/scsi_proc.c            |  22 +--
>  drivers/scsi/scsi_trace.c           |   6 +-
>  drivers/scsi/wd33c93.c              |  18 +--
>  drivers/scsi/wd7000.c               |  41 +++--
>  24 files changed, 412 insertions(+), 454 deletions(-)
> 
> 

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

* Re: [PATCH v2 0/6] scsi: Some seq_file cleanups/optimizations
  2015-01-29  6:56   ` Finn Thain
@ 2015-01-29  9:16     ` Rasmus Villemoes
  2015-01-29 14:22       ` Steven Rostedt
  0 siblings, 1 reply; 26+ messages in thread
From: Rasmus Villemoes @ 2015-01-29  9:16 UTC (permalink / raw)
  To: Finn Thain
  Cc: James E.J. Bottomley, linux-fsdevel, linux-scsi, linux-kernel,
	Steven Rostedt

On Thu, Jan 29 2015, Finn Thain <fthain@telegraphics.com.au> wrote:

> I have one reservation about this patch series.
>
> For example, the changes,
>
> -	seq_printf(m, "%s", p);
> +	seq_puts(m, p);
>
> These calls are not equivalent because the bounds check is not the same. 
> seq_puts will fail when m->count + strlen(p) == m->size.
>

So will seq_printf:

int seq_vprintf(struct seq_file *m, const char *f, va_list args)
{
	int len;

	if (m->count < m->size) {
		len = vsnprintf(m->buf + m->count, m->size - m->count, f, args);
		if (m->count + len < m->size) {
			m->count += len;
			return 0;
		}
	}
	seq_set_overflow(m);
	return -1;
}

The return value from vsnprintf("%s", p) is by definition the length of
the string p. Yes, vsnprintf may write some of the bytes from the
string to the buffer, but those are effectively discarded if they don't
all fit, since m->count is not updated.

> There's a similar situation with the changes,
>
> -	seq_puts(m, "x");
> +	seq_putc(m, 'x');

It's true that this may cause 'x' to be printed which it might not have
been before. I think this is a bug in seq_puts - it should use <= for
its bounds check. OTOH, seq_printf probably needs to continue using <,
because if the return value is == m->size-m->count, vsnprintf will have
truncated the output, overwriting the last byte with a '\0'.

> Have you considered what the implications might be? Are there any?

I must admit I hadn't thought that deeply about it before, but now it
seems that my patches can only end up utilizing m->buf a bit better
(well, 8 bits, to be precise). If I understand the whole seq_*
interface, overflow will just cause a larger buffer to be allocated and
all the print functions to be called again.

Steven, you've been doing some cleanup in this area, among other things
trying to make all the seq_* functions return void. Could you fill me in
on the status of that?

Rasmus

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

* Re: [PATCH v2 0/6] scsi: Some seq_file cleanups/optimizations
  2015-01-29  9:16     ` Rasmus Villemoes
@ 2015-01-29 14:22       ` Steven Rostedt
  0 siblings, 0 replies; 26+ messages in thread
From: Steven Rostedt @ 2015-01-29 14:22 UTC (permalink / raw)
  To: Rasmus Villemoes
  Cc: Finn Thain, James E.J. Bottomley, linux-fsdevel, linux-scsi,
	linux-kernel

On Thu, 29 Jan 2015 10:16:16 +0100
Rasmus Villemoes <linux@rasmusvillemoes.dk> wrote:

> Steven, you've been doing some cleanup in this area, among other things
> trying to make all the seq_* functions return void. Could you fill me in
> on the status of that?

Yes, the entire seq_*() operations are ambiguous in how they handle
filling the buffers. Don't worry about side effects of using one seq
operation over another (I highly doubt anyone will notice).

I had to stop doing the cleanups to work on other things, but I have
patches to make all seq operations perform the same (and also use the
new seq_buf infrastructure).

And, please ignore any return value from the seq operations. If you
want to know if the buffer is full use seq_has_overflowed() to find out.

I'll try to continue this clean up as a side project.

-- Steve


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

* Re: [PATCH v2 1/6] scsi: Remove SPRINTF macro
  2014-12-02 23:10   ` [PATCH v2 1/6] scsi: Remove SPRINTF macro Rasmus Villemoes
@ 2015-01-30  1:37     ` Finn Thain
  0 siblings, 0 replies; 26+ messages in thread
From: Finn Thain @ 2015-01-30  1:37 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: James E.J. Bottomley, linux-scsi, linux-kernel


On Wed, 3 Dec 2014, Rasmus Villemoes wrote:

> The macro SPRINTF doesn't save a lot of typing or make the code more
> readable, and depending on a specific identifier (m) in the
> surrounding scope is generally frowned upon. Nuke it.

Yes. I was going to eliminate this macro from NCR5380.c too, for 
consistency with atari_NCR5380.

Reviewed-by: Finn Thain <fthain@telegraphics.com.au>

For the NCR5380 bits:

Acked-by: Finn Thain <fthain@telegraphics.com.au>


> 
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> ---
>  drivers/scsi/NCR5380.c       |  20 ++-
>  drivers/scsi/aha152x.c       | 295 +++++++++++++++++++++----------------------
>  drivers/scsi/dc395x.c        |  78 ++++++------
>  drivers/scsi/nsp32.c         |  41 +++---
>  drivers/scsi/pcmcia/nsp_cs.c |  50 ++++----
>  drivers/scsi/wd7000.c        |  41 +++---
>  6 files changed, 252 insertions(+), 273 deletions(-)
> 
> diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
> index 36244d6..aca181e 100644
> --- a/drivers/scsi/NCR5380.c
> +++ b/drivers/scsi/NCR5380.c
> @@ -716,8 +716,6 @@ static int __maybe_unused NCR5380_write_info(struct Scsi_Host *instance,
>  }
>  #endif
>  
> -#undef SPRINTF
> -#define SPRINTF(args...) seq_printf(m, ## args)
>  static
>  void lprint_Scsi_Cmnd(struct scsi_cmnd *cmd, struct seq_file *m);
>  static
> @@ -734,19 +732,19 @@ static int __maybe_unused NCR5380_show_info(struct seq_file *m,
>  	hostdata = (struct NCR5380_hostdata *) instance->hostdata;
>  
>  #ifdef PSEUDO_DMA
> -	SPRINTF("Highwater I/O busy spin counts: write %d, read %d\n",
> +	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_irq(instance->host_lock);
>  	if (!hostdata->connected)
> -		SPRINTF("scsi%d: no currently connected command\n", instance->host_no);
> +		seq_printf(m, "scsi%d: no currently connected command\n", instance->host_no);
>  	else
>  		lprint_Scsi_Cmnd((struct scsi_cmnd *) hostdata->connected, m);
> -	SPRINTF("scsi%d: issue_queue\n", instance->host_no);
> +	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);
>  
> -	SPRINTF("scsi%d: disconnected_queue\n", instance->host_no);
> +	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_irq(instance->host_lock);
> @@ -755,8 +753,8 @@ static int __maybe_unused NCR5380_show_info(struct seq_file *m,
>  
>  static void lprint_Scsi_Cmnd(struct scsi_cmnd *cmd, struct seq_file *m)
>  {
> -	SPRINTF("scsi%d : destination target %d, lun %llu\n", cmd->device->host->host_no, cmd->device->id, cmd->device->lun);
> -	SPRINTF("        command = ");
> +	seq_printf(m, "scsi%d : destination target %d, lun %llu\n", cmd->device->host->host_no, cmd->device->id, cmd->device->lun);
> +	seq_printf(m, "        command = ");
>  	lprint_command(cmd->cmnd, m);
>  }
>  
> @@ -765,13 +763,13 @@ 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)
> -		SPRINTF("%02x ", command[i]);
> -	SPRINTF("\n");
> +		seq_printf(m, "%02x ", command[i]);
> +	seq_printf(m, "\n");
>  }
>  
>  static void lprint_opcode(int opcode, struct seq_file *m)
>  {
> -	SPRINTF("%2d (0x%02x)", opcode, opcode);
> +	seq_printf(m, "%2d (0x%02x)", opcode, opcode);
>  }
>  
>  
> diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
> index 2b960b3..f14ad8a 100644
> --- a/drivers/scsi/aha152x.c
> +++ b/drivers/scsi/aha152x.c
> @@ -2490,299 +2490,296 @@ static void show_queues(struct Scsi_Host *shpnt)
>  	disp_enintr(shpnt);
>  }
>  
> -#undef SPRINTF
> -#define SPRINTF(args...) seq_printf(m, ##args)
> -
>  static void get_command(struct seq_file *m, Scsi_Cmnd * ptr)
>  {
>  	int i;
>  
> -	SPRINTF("%p: target=%d; lun=%d; cmnd=( ",
> +	seq_printf(m, "%p: target=%d; lun=%d; cmnd=( ",
>  		ptr, ptr->device->id, (u8)ptr->device->lun);
>  
>  	for (i = 0; i < COMMAND_SIZE(ptr->cmnd[0]); i++)
> -		SPRINTF("0x%02x ", ptr->cmnd[i]);
> +		seq_printf(m, "0x%02x ", ptr->cmnd[i]);
>  
> -	SPRINTF("); resid=%d; residual=%d; buffers=%d; phase |",
> +	seq_printf(m, "); resid=%d; residual=%d; buffers=%d; phase |",
>  		scsi_get_resid(ptr), ptr->SCp.this_residual,
>  		ptr->SCp.buffers_residual);
>  
>  	if (ptr->SCp.phase & not_issued)
> -		SPRINTF("not issued|");
> +		seq_printf(m, "not issued|");
>  	if (ptr->SCp.phase & selecting)
> -		SPRINTF("selecting|");
> +		seq_printf(m, "selecting|");
>  	if (ptr->SCp.phase & disconnected)
> -		SPRINTF("disconnected|");
> +		seq_printf(m, "disconnected|");
>  	if (ptr->SCp.phase & aborted)
> -		SPRINTF("aborted|");
> +		seq_printf(m, "aborted|");
>  	if (ptr->SCp.phase & identified)
> -		SPRINTF("identified|");
> +		seq_printf(m, "identified|");
>  	if (ptr->SCp.phase & completed)
> -		SPRINTF("completed|");
> +		seq_printf(m, "completed|");
>  	if (ptr->SCp.phase & spiordy)
> -		SPRINTF("spiordy|");
> +		seq_printf(m, "spiordy|");
>  	if (ptr->SCp.phase & syncneg)
> -		SPRINTF("syncneg|");
> -	SPRINTF("; next=0x%p\n", SCNEXT(ptr));
> +		seq_printf(m, "syncneg|");
> +	seq_printf(m, "; next=0x%p\n", SCNEXT(ptr));
>  }
>  
>  static void get_ports(struct seq_file *m, struct Scsi_Host *shpnt)
>  {
>  	int s;
>  
> -	SPRINTF("\n%s: %s(%s) ", CURRENT_SC ? "on bus" : "waiting", states[STATE].name, states[PREVSTATE].name);
> +	seq_printf(m, "\n%s: %s(%s) ", CURRENT_SC ? "on bus" : "waiting", states[STATE].name, states[PREVSTATE].name);
>  
>  	s = GETPORT(SCSISEQ);
> -	SPRINTF("SCSISEQ( ");
> +	seq_printf(m, "SCSISEQ( ");
>  	if (s & TEMODEO)
> -		SPRINTF("TARGET MODE ");
> +		seq_printf(m, "TARGET MODE ");
>  	if (s & ENSELO)
> -		SPRINTF("SELO ");
> +		seq_printf(m, "SELO ");
>  	if (s & ENSELI)
> -		SPRINTF("SELI ");
> +		seq_printf(m, "SELI ");
>  	if (s & ENRESELI)
> -		SPRINTF("RESELI ");
> +		seq_printf(m, "RESELI ");
>  	if (s & ENAUTOATNO)
> -		SPRINTF("AUTOATNO ");
> +		seq_printf(m, "AUTOATNO ");
>  	if (s & ENAUTOATNI)
> -		SPRINTF("AUTOATNI ");
> +		seq_printf(m, "AUTOATNI ");
>  	if (s & ENAUTOATNP)
> -		SPRINTF("AUTOATNP ");
> +		seq_printf(m, "AUTOATNP ");
>  	if (s & SCSIRSTO)
> -		SPRINTF("SCSIRSTO ");
> -	SPRINTF(");");
> +		seq_printf(m, "SCSIRSTO ");
> +	seq_printf(m, ");");
>  
> -	SPRINTF(" SCSISIG(");
> +	seq_printf(m, " SCSISIG(");
>  	s = GETPORT(SCSISIG);
>  	switch (s & P_MASK) {
>  	case P_DATAO:
> -		SPRINTF("DATA OUT");
> +		seq_printf(m, "DATA OUT");
>  		break;
>  	case P_DATAI:
> -		SPRINTF("DATA IN");
> +		seq_printf(m, "DATA IN");
>  		break;
>  	case P_CMD:
> -		SPRINTF("COMMAND");
> +		seq_printf(m, "COMMAND");
>  		break;
>  	case P_STATUS:
> -		SPRINTF("STATUS");
> +		seq_printf(m, "STATUS");
>  		break;
>  	case P_MSGO:
> -		SPRINTF("MESSAGE OUT");
> +		seq_printf(m, "MESSAGE OUT");
>  		break;
>  	case P_MSGI:
> -		SPRINTF("MESSAGE IN");
> +		seq_printf(m, "MESSAGE IN");
>  		break;
>  	default:
> -		SPRINTF("*invalid*");
> +		seq_printf(m, "*invalid*");
>  		break;
>  	}
>  
> -	SPRINTF("); ");
> +	seq_printf(m, "); ");
>  
> -	SPRINTF("INTSTAT (%s); ", TESTHI(DMASTAT, INTSTAT) ? "hi" : "lo");
> +	seq_printf(m, "INTSTAT (%s); ", TESTHI(DMASTAT, INTSTAT) ? "hi" : "lo");
>  
> -	SPRINTF("SSTAT( ");
> +	seq_printf(m, "SSTAT( ");
>  	s = GETPORT(SSTAT0);
>  	if (s & TARGET)
> -		SPRINTF("TARGET ");
> +		seq_printf(m, "TARGET ");
>  	if (s & SELDO)
> -		SPRINTF("SELDO ");
> +		seq_printf(m, "SELDO ");
>  	if (s & SELDI)
> -		SPRINTF("SELDI ");
> +		seq_printf(m, "SELDI ");
>  	if (s & SELINGO)
> -		SPRINTF("SELINGO ");
> +		seq_printf(m, "SELINGO ");
>  	if (s & SWRAP)
> -		SPRINTF("SWRAP ");
> +		seq_printf(m, "SWRAP ");
>  	if (s & SDONE)
> -		SPRINTF("SDONE ");
> +		seq_printf(m, "SDONE ");
>  	if (s & SPIORDY)
> -		SPRINTF("SPIORDY ");
> +		seq_printf(m, "SPIORDY ");
>  	if (s & DMADONE)
> -		SPRINTF("DMADONE ");
> +		seq_printf(m, "DMADONE ");
>  
>  	s = GETPORT(SSTAT1);
>  	if (s & SELTO)
> -		SPRINTF("SELTO ");
> +		seq_printf(m, "SELTO ");
>  	if (s & ATNTARG)
> -		SPRINTF("ATNTARG ");
> +		seq_printf(m, "ATNTARG ");
>  	if (s & SCSIRSTI)
> -		SPRINTF("SCSIRSTI ");
> +		seq_printf(m, "SCSIRSTI ");
>  	if (s & PHASEMIS)
> -		SPRINTF("PHASEMIS ");
> +		seq_printf(m, "PHASEMIS ");
>  	if (s & BUSFREE)
> -		SPRINTF("BUSFREE ");
> +		seq_printf(m, "BUSFREE ");
>  	if (s & SCSIPERR)
> -		SPRINTF("SCSIPERR ");
> +		seq_printf(m, "SCSIPERR ");
>  	if (s & PHASECHG)
> -		SPRINTF("PHASECHG ");
> +		seq_printf(m, "PHASECHG ");
>  	if (s & REQINIT)
> -		SPRINTF("REQINIT ");
> -	SPRINTF("); ");
> +		seq_printf(m, "REQINIT ");
> +	seq_printf(m, "); ");
>  
>  
> -	SPRINTF("SSTAT( ");
> +	seq_printf(m, "SSTAT( ");
>  
>  	s = GETPORT(SSTAT0) & GETPORT(SIMODE0);
>  
>  	if (s & TARGET)
> -		SPRINTF("TARGET ");
> +		seq_printf(m, "TARGET ");
>  	if (s & SELDO)
> -		SPRINTF("SELDO ");
> +		seq_printf(m, "SELDO ");
>  	if (s & SELDI)
> -		SPRINTF("SELDI ");
> +		seq_printf(m, "SELDI ");
>  	if (s & SELINGO)
> -		SPRINTF("SELINGO ");
> +		seq_printf(m, "SELINGO ");
>  	if (s & SWRAP)
> -		SPRINTF("SWRAP ");
> +		seq_printf(m, "SWRAP ");
>  	if (s & SDONE)
> -		SPRINTF("SDONE ");
> +		seq_printf(m, "SDONE ");
>  	if (s & SPIORDY)
> -		SPRINTF("SPIORDY ");
> +		seq_printf(m, "SPIORDY ");
>  	if (s & DMADONE)
> -		SPRINTF("DMADONE ");
> +		seq_printf(m, "DMADONE ");
>  
>  	s = GETPORT(SSTAT1) & GETPORT(SIMODE1);
>  
>  	if (s & SELTO)
> -		SPRINTF("SELTO ");
> +		seq_printf(m, "SELTO ");
>  	if (s & ATNTARG)
> -		SPRINTF("ATNTARG ");
> +		seq_printf(m, "ATNTARG ");
>  	if (s & SCSIRSTI)
> -		SPRINTF("SCSIRSTI ");
> +		seq_printf(m, "SCSIRSTI ");
>  	if (s & PHASEMIS)
> -		SPRINTF("PHASEMIS ");
> +		seq_printf(m, "PHASEMIS ");
>  	if (s & BUSFREE)
> -		SPRINTF("BUSFREE ");
> +		seq_printf(m, "BUSFREE ");
>  	if (s & SCSIPERR)
> -		SPRINTF("SCSIPERR ");
> +		seq_printf(m, "SCSIPERR ");
>  	if (s & PHASECHG)
> -		SPRINTF("PHASECHG ");
> +		seq_printf(m, "PHASECHG ");
>  	if (s & REQINIT)
> -		SPRINTF("REQINIT ");
> -	SPRINTF("); ");
> +		seq_printf(m, "REQINIT ");
> +	seq_printf(m, "); ");
>  
> -	SPRINTF("SXFRCTL0( ");
> +	seq_printf(m, "SXFRCTL0( ");
>  
>  	s = GETPORT(SXFRCTL0);
>  	if (s & SCSIEN)
> -		SPRINTF("SCSIEN ");
> +		seq_printf(m, "SCSIEN ");
>  	if (s & DMAEN)
> -		SPRINTF("DMAEN ");
> +		seq_printf(m, "DMAEN ");
>  	if (s & CH1)
> -		SPRINTF("CH1 ");
> +		seq_printf(m, "CH1 ");
>  	if (s & CLRSTCNT)
> -		SPRINTF("CLRSTCNT ");
> +		seq_printf(m, "CLRSTCNT ");
>  	if (s & SPIOEN)
> -		SPRINTF("SPIOEN ");
> +		seq_printf(m, "SPIOEN ");
>  	if (s & CLRCH1)
> -		SPRINTF("CLRCH1 ");
> -	SPRINTF("); ");
> +		seq_printf(m, "CLRCH1 ");
> +	seq_printf(m, "); ");
>  
> -	SPRINTF("SIGNAL( ");
> +	seq_printf(m, "SIGNAL( ");
>  
>  	s = GETPORT(SCSISIG);
>  	if (s & SIG_ATNI)
> -		SPRINTF("ATNI ");
> +		seq_printf(m, "ATNI ");
>  	if (s & SIG_SELI)
> -		SPRINTF("SELI ");
> +		seq_printf(m, "SELI ");
>  	if (s & SIG_BSYI)
> -		SPRINTF("BSYI ");
> +		seq_printf(m, "BSYI ");
>  	if (s & SIG_REQI)
> -		SPRINTF("REQI ");
> +		seq_printf(m, "REQI ");
>  	if (s & SIG_ACKI)
> -		SPRINTF("ACKI ");
> -	SPRINTF("); ");
> +		seq_printf(m, "ACKI ");
> +	seq_printf(m, "); ");
>  
> -	SPRINTF("SELID(%02x), ", GETPORT(SELID));
> +	seq_printf(m, "SELID(%02x), ", GETPORT(SELID));
>  
> -	SPRINTF("STCNT(%d), ", GETSTCNT());
> +	seq_printf(m, "STCNT(%d), ", GETSTCNT());
>  
> -	SPRINTF("SSTAT2( ");
> +	seq_printf(m, "SSTAT2( ");
>  
>  	s = GETPORT(SSTAT2);
>  	if (s & SOFFSET)
> -		SPRINTF("SOFFSET ");
> +		seq_printf(m, "SOFFSET ");
>  	if (s & SEMPTY)
> -		SPRINTF("SEMPTY ");
> +		seq_printf(m, "SEMPTY ");
>  	if (s & SFULL)
> -		SPRINTF("SFULL ");
> -	SPRINTF("); SFCNT (%d); ", s & (SFULL | SFCNT));
> +		seq_printf(m, "SFULL ");
> +	seq_printf(m, "); SFCNT (%d); ", s & (SFULL | SFCNT));
>  
>  	s = GETPORT(SSTAT3);
> -	SPRINTF("SCSICNT (%d), OFFCNT(%d), ", (s & 0xf0) >> 4, s & 0x0f);
> +	seq_printf(m, "SCSICNT (%d), OFFCNT(%d), ", (s & 0xf0) >> 4, s & 0x0f);
>  
> -	SPRINTF("SSTAT4( ");
> +	seq_printf(m, "SSTAT4( ");
>  	s = GETPORT(SSTAT4);
>  	if (s & SYNCERR)
> -		SPRINTF("SYNCERR ");
> +		seq_printf(m, "SYNCERR ");
>  	if (s & FWERR)
> -		SPRINTF("FWERR ");
> +		seq_printf(m, "FWERR ");
>  	if (s & FRERR)
> -		SPRINTF("FRERR ");
> -	SPRINTF("); ");
> +		seq_printf(m, "FRERR ");
> +	seq_printf(m, "); ");
>  
> -	SPRINTF("DMACNTRL0( ");
> +	seq_printf(m, "DMACNTRL0( ");
>  	s = GETPORT(DMACNTRL0);
> -	SPRINTF("%s ", s & _8BIT ? "8BIT" : "16BIT");
> -	SPRINTF("%s ", s & DMA ? "DMA" : "PIO");
> -	SPRINTF("%s ", s & WRITE_READ ? "WRITE" : "READ");
> +	seq_printf(m, "%s ", s & _8BIT ? "8BIT" : "16BIT");
> +	seq_printf(m, "%s ", s & DMA ? "DMA" : "PIO");
> +	seq_printf(m, "%s ", s & WRITE_READ ? "WRITE" : "READ");
>  	if (s & ENDMA)
> -		SPRINTF("ENDMA ");
> +		seq_printf(m, "ENDMA ");
>  	if (s & INTEN)
> -		SPRINTF("INTEN ");
> +		seq_printf(m, "INTEN ");
>  	if (s & RSTFIFO)
> -		SPRINTF("RSTFIFO ");
> +		seq_printf(m, "RSTFIFO ");
>  	if (s & SWINT)
> -		SPRINTF("SWINT ");
> -	SPRINTF("); ");
> +		seq_printf(m, "SWINT ");
> +	seq_printf(m, "); ");
>  
> -	SPRINTF("DMASTAT( ");
> +	seq_printf(m, "DMASTAT( ");
>  	s = GETPORT(DMASTAT);
>  	if (s & ATDONE)
> -		SPRINTF("ATDONE ");
> +		seq_printf(m, "ATDONE ");
>  	if (s & WORDRDY)
> -		SPRINTF("WORDRDY ");
> +		seq_printf(m, "WORDRDY ");
>  	if (s & DFIFOFULL)
> -		SPRINTF("DFIFOFULL ");
> +		seq_printf(m, "DFIFOFULL ");
>  	if (s & DFIFOEMP)
> -		SPRINTF("DFIFOEMP ");
> -	SPRINTF(")\n");
> +		seq_printf(m, "DFIFOEMP ");
> +	seq_printf(m, ")\n");
>  
> -	SPRINTF("enabled interrupts( ");
> +	seq_printf(m, "enabled interrupts( ");
>  
>  	s = GETPORT(SIMODE0);
>  	if (s & ENSELDO)
> -		SPRINTF("ENSELDO ");
> +		seq_printf(m, "ENSELDO ");
>  	if (s & ENSELDI)
> -		SPRINTF("ENSELDI ");
> +		seq_printf(m, "ENSELDI ");
>  	if (s & ENSELINGO)
> -		SPRINTF("ENSELINGO ");
> +		seq_printf(m, "ENSELINGO ");
>  	if (s & ENSWRAP)
> -		SPRINTF("ENSWRAP ");
> +		seq_printf(m, "ENSWRAP ");
>  	if (s & ENSDONE)
> -		SPRINTF("ENSDONE ");
> +		seq_printf(m, "ENSDONE ");
>  	if (s & ENSPIORDY)
> -		SPRINTF("ENSPIORDY ");
> +		seq_printf(m, "ENSPIORDY ");
>  	if (s & ENDMADONE)
> -		SPRINTF("ENDMADONE ");
> +		seq_printf(m, "ENDMADONE ");
>  
>  	s = GETPORT(SIMODE1);
>  	if (s & ENSELTIMO)
> -		SPRINTF("ENSELTIMO ");
> +		seq_printf(m, "ENSELTIMO ");
>  	if (s & ENATNTARG)
> -		SPRINTF("ENATNTARG ");
> +		seq_printf(m, "ENATNTARG ");
>  	if (s & ENPHASEMIS)
> -		SPRINTF("ENPHASEMIS ");
> +		seq_printf(m, "ENPHASEMIS ");
>  	if (s & ENBUSFREE)
> -		SPRINTF("ENBUSFREE ");
> +		seq_printf(m, "ENBUSFREE ");
>  	if (s & ENSCSIPERR)
> -		SPRINTF("ENSCSIPERR ");
> +		seq_printf(m, "ENSCSIPERR ");
>  	if (s & ENPHASECHG)
> -		SPRINTF("ENPHASECHG ");
> +		seq_printf(m, "ENPHASECHG ");
>  	if (s & ENREQINIT)
> -		SPRINTF("ENREQINIT ");
> -	SPRINTF(")\n");
> +		seq_printf(m, "ENREQINIT ");
> +	seq_printf(m, ")\n");
>  }
>  
>  static int aha152x_set_info(struct Scsi_Host *shpnt, char *buffer, int length)
> @@ -2825,56 +2822,56 @@ static int aha152x_show_info(struct seq_file *m, struct Scsi_Host *shpnt)
>  	Scsi_Cmnd *ptr;
>  	unsigned long flags;
>  
> -	SPRINTF(AHA152X_REVID "\n");
> +	seq_printf(m, AHA152X_REVID "\n");
>  
> -	SPRINTF("ioports 0x%04lx to 0x%04lx\n",
> +	seq_printf(m, "ioports 0x%04lx to 0x%04lx\n",
>  		shpnt->io_port, shpnt->io_port + shpnt->n_io_port - 1);
> -	SPRINTF("interrupt 0x%02x\n", shpnt->irq);
> -	SPRINTF("disconnection/reconnection %s\n",
> +	seq_printf(m, "interrupt 0x%02x\n", shpnt->irq);
> +	seq_printf(m, "disconnection/reconnection %s\n",
>  		RECONNECT ? "enabled" : "disabled");
> -	SPRINTF("parity checking %s\n",
> +	seq_printf(m, "parity checking %s\n",
>  		PARITY ? "enabled" : "disabled");
> -	SPRINTF("synchronous transfers %s\n",
> +	seq_printf(m, "synchronous transfers %s\n",
>  		SYNCHRONOUS ? "enabled" : "disabled");
> -	SPRINTF("%d commands currently queued\n", HOSTDATA(shpnt)->commands);
> +	seq_printf(m, "%d commands currently queued\n", HOSTDATA(shpnt)->commands);
>  
>  	if(SYNCHRONOUS) {
> -		SPRINTF("synchronously operating targets (tick=50 ns):\n");
> +		seq_printf(m, "synchronously operating targets (tick=50 ns):\n");
>  		for (i = 0; i < 8; i++)
>  			if (HOSTDATA(shpnt)->syncrate[i] & 0x7f)
> -				SPRINTF("target %d: period %dT/%dns; req/ack offset %d\n",
> +				seq_printf(m, "target %d: period %dT/%dns; req/ack offset %d\n",
>  					i,
>  					(((HOSTDATA(shpnt)->syncrate[i] & 0x70) >> 4) + 2),
>  					(((HOSTDATA(shpnt)->syncrate[i] & 0x70) >> 4) + 2) * 50,
>  				    HOSTDATA(shpnt)->syncrate[i] & 0x0f);
>  	}
> -	SPRINTF("\nqueue status:\n");
> +	seq_printf(m, "\nqueue status:\n");
>  	DO_LOCK(flags);
>  	if (ISSUE_SC) {
> -		SPRINTF("not yet issued commands:\n");
> +		seq_printf(m, "not yet issued commands:\n");
>  		for (ptr = ISSUE_SC; ptr; ptr = SCNEXT(ptr))
>  			get_command(m, ptr);
>  	} else
> -		SPRINTF("no not yet issued commands\n");
> +		seq_printf(m, "no not yet issued commands\n");
>  	DO_UNLOCK(flags);
>  
>  	if (CURRENT_SC) {
> -		SPRINTF("current command:\n");
> +		seq_printf(m, "current command:\n");
>  		get_command(m, CURRENT_SC);
>  	} else
> -		SPRINTF("no current command\n");
> +		seq_printf(m, "no current command\n");
>  
>  	if (DISCONNECTED_SC) {
> -		SPRINTF("disconnected commands:\n");
> +		seq_printf(m, "disconnected commands:\n");
>  		for (ptr = DISCONNECTED_SC; ptr; ptr = SCNEXT(ptr))
>  			get_command(m, ptr);
>  	} else
> -		SPRINTF("no disconnected commands\n");
> +		seq_printf(m, "no disconnected commands\n");
>  
>  	get_ports(m, shpnt);
>  
>  #if defined(AHA152X_STAT)
> -	SPRINTF("statistics:\n"
> +	seq_printf(m, "statistics:\n"
>  		"total commands:               %d\n"
>  		"disconnections:               %d\n"
>  		"busfree with check condition: %d\n"
> @@ -2894,7 +2891,7 @@ static int aha152x_show_info(struct seq_file *m, struct Scsi_Host *shpnt)
>  		HOSTDATA(shpnt)->busfree_without_done_command,
>  		HOSTDATA(shpnt)->busfree_without_any_action);
>  	for(i=0; i<maxstate; i++) {
> -		SPRINTF("%-10s %-12d %-12d %-12ld\n",
> +		seq_printf(m, "%-10s %-12d %-12d %-12ld\n",
>  			states[i].name,
>  			HOSTDATA(shpnt)->count_trans[i],
>  			HOSTDATA(shpnt)->count[i],
> diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
> index 0c6be0a..0a1ed50 100644
> --- a/drivers/scsi/dc395x.c
> +++ b/drivers/scsi/dc395x.c
> @@ -4610,13 +4610,10 @@ static void adapter_uninit(struct AdapterCtlBlk *acb)
>  }
>  
>  
> -#undef SPRINTF
> -#define SPRINTF(args...) seq_printf(m,##args)
> -
>  #undef YESNO
>  #define YESNO(YN) \
> - if (YN) SPRINTF(" Yes ");\
> - else SPRINTF(" No  ")
> + if (YN) seq_printf(m, " Yes ");\
> + else seq_printf(m, " No  ")
>  
>  static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
>  {
> @@ -4626,47 +4623,44 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
>  	unsigned long flags;
>  	int dev;
>  
> -	SPRINTF(DC395X_BANNER " PCI SCSI Host Adapter\n");
> -	SPRINTF(" Driver Version " DC395X_VERSION "\n");
> +	seq_printf(m, DC395X_BANNER " PCI SCSI Host Adapter\n");
> +	seq_printf(m, " Driver Version " DC395X_VERSION "\n");
>  
>  	DC395x_LOCK_IO(acb->scsi_host, flags);
>  
> -	SPRINTF("SCSI Host Nr %i, ", host->host_no);
> -	SPRINTF("DC395U/UW/F DC315/U %s\n",
> +	seq_printf(m, "SCSI Host Nr %i, ", host->host_no);
> +	seq_printf(m, "DC395U/UW/F DC315/U %s\n",
>  		(acb->config & HCC_WIDE_CARD) ? "Wide" : "");
> -	SPRINTF("io_port_base 0x%04lx, ", acb->io_port_base);
> -	SPRINTF("irq_level 0x%04x, ", acb->irq_level);
> -	SPRINTF(" SelTimeout %ims\n", (1638 * acb->sel_timeout) / 1000);
> +	seq_printf(m, "io_port_base 0x%04lx, ", acb->io_port_base);
> +	seq_printf(m, "irq_level 0x%04x, ", acb->irq_level);
> +	seq_printf(m, " SelTimeout %ims\n", (1638 * acb->sel_timeout) / 1000);
>  
> -	SPRINTF("MaxID %i, MaxLUN %llu, ", host->max_id, host->max_lun);
> -	SPRINTF("AdapterID %i\n", host->this_id);
> +	seq_printf(m, "MaxID %i, MaxLUN %llu, ", host->max_id, host->max_lun);
> +	seq_printf(m, "AdapterID %i\n", host->this_id);
>  
> -	SPRINTF("tag_max_num %i", acb->tag_max_num);
> -	/*SPRINTF(", DMA_Status %i\n", DC395x_read8(acb, TRM_S1040_DMA_STATUS)); */
> -	SPRINTF(", FilterCfg 0x%02x",
> +	seq_printf(m, "tag_max_num %i", acb->tag_max_num);
> +	/*seq_printf(m, ", DMA_Status %i\n", DC395x_read8(acb, TRM_S1040_DMA_STATUS)); */
> +	seq_printf(m, ", FilterCfg 0x%02x",
>  		DC395x_read8(acb, TRM_S1040_SCSI_CONFIG1));
> -	SPRINTF(", DelayReset %is\n", acb->eeprom.delay_time);
> -	/*SPRINTF("\n"); */
> +	seq_printf(m, ", DelayReset %is\n", acb->eeprom.delay_time);
> +	/*seq_printf(m, "\n"); */
>  
> -	SPRINTF("Nr of DCBs: %i\n", list_size(&acb->dcb_list));
> -	SPRINTF
> -	    ("Map of attached LUNs: %02x %02x %02x %02x %02x %02x %02x %02x\n",
> +	seq_printf(m, "Nr of DCBs: %i\n", list_size(&acb->dcb_list));
> +	seq_printf(m, "Map of attached LUNs: %02x %02x %02x %02x %02x %02x %02x %02x\n",
>  	     acb->dcb_map[0], acb->dcb_map[1], acb->dcb_map[2],
>  	     acb->dcb_map[3], acb->dcb_map[4], acb->dcb_map[5],
>  	     acb->dcb_map[6], acb->dcb_map[7]);
> -	SPRINTF
> -	    ("                      %02x %02x %02x %02x %02x %02x %02x %02x\n",
> +	seq_printf(m, "                      %02x %02x %02x %02x %02x %02x %02x %02x\n",
>  	     acb->dcb_map[8], acb->dcb_map[9], acb->dcb_map[10],
>  	     acb->dcb_map[11], acb->dcb_map[12], acb->dcb_map[13],
>  	     acb->dcb_map[14], acb->dcb_map[15]);
>  
> -	SPRINTF
> -	    ("Un ID LUN Prty Sync Wide DsCn SndS TagQ nego_period SyncFreq SyncOffs MaxCmd\n");
> +	seq_printf(m, "Un ID LUN Prty Sync Wide DsCn SndS TagQ nego_period SyncFreq SyncOffs MaxCmd\n");
>  
>  	dev = 0;
>  	list_for_each_entry(dcb, &acb->dcb_list, list) {
>  		int nego_period;
> -		SPRINTF("%02i %02i  %02i ", dev, dcb->target_id,
> +		seq_printf(m, "%02i %02i  %02i ", dev, dcb->target_id,
>  			dcb->target_lun);
>  		YESNO(dcb->dev_mode & NTC_DO_PARITY_CHK);
>  		YESNO(dcb->sync_offset);
> @@ -4676,53 +4670,53 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
>  		YESNO(dcb->sync_mode & EN_TAG_QUEUEING);
>  		nego_period = clock_period[dcb->sync_period & 0x07] << 2;
>  		if (dcb->sync_offset)
> -			SPRINTF("  %03i ns ", nego_period);
> +			seq_printf(m, "  %03i ns ", nego_period);
>  		else
> -			SPRINTF(" (%03i ns)", (dcb->min_nego_period << 2));
> +			seq_printf(m, " (%03i ns)", (dcb->min_nego_period << 2));
>  
>  		if (dcb->sync_offset & 0x0f) {
>  			spd = 1000 / (nego_period);
>  			spd1 = 1000 % (nego_period);
>  			spd1 = (spd1 * 10 + nego_period / 2) / (nego_period);
> -			SPRINTF("   %2i.%1i M     %02i ", spd, spd1,
> +			seq_printf(m, "   %2i.%1i M     %02i ", spd, spd1,
>  				(dcb->sync_offset & 0x0f));
>  		} else
> -			SPRINTF("                 ");
> +			seq_printf(m, "                 ");
>  
>  		/* Add more info ... */
> -		SPRINTF("     %02i\n", dcb->max_command);
> +		seq_printf(m, "     %02i\n", dcb->max_command);
>  		dev++;
>  	}
>  
>  	if (timer_pending(&acb->waiting_timer))
> -		SPRINTF("Waiting queue timer running\n");
> +		seq_printf(m, "Waiting queue timer running\n");
>  	else
> -		SPRINTF("\n");
> +		seq_printf(m, "\n");
>  
>  	list_for_each_entry(dcb, &acb->dcb_list, list) {
>  		struct ScsiReqBlk *srb;
>  		if (!list_empty(&dcb->srb_waiting_list))
> -			SPRINTF("DCB (%02i-%i): Waiting: %i:",
> +			seq_printf(m, "DCB (%02i-%i): Waiting: %i:",
>  				dcb->target_id, dcb->target_lun,
>  				list_size(&dcb->srb_waiting_list));
>                  list_for_each_entry(srb, &dcb->srb_waiting_list, list)
> -			SPRINTF(" %p", srb->cmd);
> +			seq_printf(m, " %p", srb->cmd);
>  		if (!list_empty(&dcb->srb_going_list))
> -			SPRINTF("\nDCB (%02i-%i): Going  : %i:",
> +			seq_printf(m, "\nDCB (%02i-%i): Going  : %i:",
>  				dcb->target_id, dcb->target_lun,
>  				list_size(&dcb->srb_going_list));
>  		list_for_each_entry(srb, &dcb->srb_going_list, list)
> -			SPRINTF(" %p", srb->cmd);
> +			seq_printf(m, " %p", srb->cmd);
>  		if (!list_empty(&dcb->srb_waiting_list) || !list_empty(&dcb->srb_going_list))
> -			SPRINTF("\n");
> +			seq_printf(m, "\n");
>  	}
>  
>  	if (debug_enabled(DBG_1)) {
> -		SPRINTF("DCB list for ACB %p:\n", acb);
> +		seq_printf(m, "DCB list for ACB %p:\n", acb);
>  		list_for_each_entry(dcb, &acb->dcb_list, list) {
> -			SPRINTF("%p -> ", dcb);
> +			seq_printf(m, "%p -> ", dcb);
>  		}
> -		SPRINTF("END\n");
> +		seq_printf(m, "END\n");
>  	}
>  
>  	DC395x_UNLOCK_IO(acb->scsi_host, flags);
> diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
> index 90abb03..3e77551 100644
> --- a/drivers/scsi/nsp32.c
> +++ b/drivers/scsi/nsp32.c
> @@ -1441,8 +1441,6 @@ static irqreturn_t do_nsp32_isr(int irq, void *dev_id)
>  	return IRQ_RETVAL(handled);
>  }
>  
> -#undef SPRINTF
> -#define SPRINTF(args...) seq_printf(m, ##args)
>  
>  static int nsp32_show_info(struct seq_file *m, struct Scsi_Host *host)
>  {
> @@ -1458,64 +1456,63 @@ static int nsp32_show_info(struct seq_file *m, struct Scsi_Host *host)
>  	data = (nsp32_hw_data *)host->hostdata;
>  	base = host->io_port;
>  
> -	SPRINTF("NinjaSCSI-32 status\n\n");
> -	SPRINTF("Driver version:        %s, $Revision: 1.33 $\n", nsp32_release_version);
> -	SPRINTF("SCSI host No.:         %d\n",		hostno);
> -	SPRINTF("IRQ:                   %d\n",		host->irq);
> -	SPRINTF("IO:                    0x%lx-0x%lx\n", host->io_port, host->io_port + host->n_io_port - 1);
> -	SPRINTF("MMIO(virtual address): 0x%lx-0x%lx\n",	host->base, host->base + data->MmioLength - 1);
> -	SPRINTF("sg_tablesize:          %d\n",		host->sg_tablesize);
> -	SPRINTF("Chip revision:         0x%x\n",       	(nsp32_read2(base, INDEX_REG) >> 8) & 0xff);
> +	seq_printf(m, "NinjaSCSI-32 status\n\n");
> +	seq_printf(m, "Driver version:        %s, $Revision: 1.33 $\n", nsp32_release_version);
> +	seq_printf(m, "SCSI host No.:         %d\n",		hostno);
> +	seq_printf(m, "IRQ:                   %d\n",		host->irq);
> +	seq_printf(m, "IO:                    0x%lx-0x%lx\n", host->io_port, host->io_port + host->n_io_port - 1);
> +	seq_printf(m, "MMIO(virtual address): 0x%lx-0x%lx\n",	host->base, host->base + data->MmioLength - 1);
> +	seq_printf(m, "sg_tablesize:          %d\n",		host->sg_tablesize);
> +	seq_printf(m, "Chip revision:         0x%x\n",		(nsp32_read2(base, INDEX_REG) >> 8) & 0xff);
>  
>  	mode_reg = nsp32_index_read1(base, CHIP_MODE);
>  	model    = data->pci_devid->driver_data;
>  
>  #ifdef CONFIG_PM
> -	SPRINTF("Power Management:      %s\n",          (mode_reg & OPTF) ? "yes" : "no");
> +	seq_printf(m, "Power Management:      %s\n",          (mode_reg & OPTF) ? "yes" : "no");
>  #endif
> -	SPRINTF("OEM:                   %ld, %s\n",     (mode_reg & (OEM0|OEM1)), nsp32_model[model]);
> +	seq_printf(m, "OEM:                   %ld, %s\n",     (mode_reg & (OEM0|OEM1)), nsp32_model[model]);
>  
>  	spin_lock_irqsave(&(data->Lock), flags);
> -	SPRINTF("CurrentSC:             0x%p\n\n",      data->CurrentSC);
> +	seq_printf(m, "CurrentSC:             0x%p\n\n",      data->CurrentSC);
>  	spin_unlock_irqrestore(&(data->Lock), flags);
>  
>  
> -	SPRINTF("SDTR status\n");
> +	seq_printf(m, "SDTR status\n");
>  	for (id = 0; id < ARRAY_SIZE(data->target); id++) {
>  
> -                SPRINTF("id %d: ", id);
> +		seq_printf(m, "id %d: ", id);
>  
>  		if (id == host->this_id) {
> -			SPRINTF("----- NinjaSCSI-32 host adapter\n");
> +			seq_printf(m, "----- NinjaSCSI-32 host adapter\n");
>  			continue;
>  		}
>  
>  		if (data->target[id].sync_flag == SDTR_DONE) {
>  			if (data->target[id].period == 0            &&
>  			    data->target[id].offset == ASYNC_OFFSET ) {
> -				SPRINTF("async");
> +				seq_printf(m, "async");
>  			} else {
> -				SPRINTF(" sync");
> +				seq_printf(m, " sync");
>  			}
>  		} else {
> -			SPRINTF(" none");
> +			seq_printf(m, " none");
>  		}
>  
>  		if (data->target[id].period != 0) {
>  
>  			speed = 1000000 / (data->target[id].period * 4);
>  
> -			SPRINTF(" transfer %d.%dMB/s, offset %d",
> +			seq_printf(m, " transfer %d.%dMB/s, offset %d",
>  				speed / 1000,
>  				speed % 1000,
>  				data->target[id].offset
>  				);
>  		}
> -		SPRINTF("\n");
> +		seq_printf(m, "\n");
>  	}
>  	return 0;
>  }
> -#undef SPRINTF
>  
>  
>  
> diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
> index 34aad32..83db942 100644
> --- a/drivers/scsi/pcmcia/nsp_cs.c
> +++ b/drivers/scsi/pcmcia/nsp_cs.c
> @@ -1364,9 +1364,6 @@ static const char *nsp_info(struct Scsi_Host *shpnt)
>  	return data->nspinfo;
>  }
>  
> -#undef SPRINTF
> -#define SPRINTF(args...) seq_printf(m, ##args)
> -
>  static int nsp_show_info(struct seq_file *m, struct Scsi_Host *host)
>  {
>  	int id;
> @@ -1378,75 +1375,74 @@ static int nsp_show_info(struct seq_file *m, struct Scsi_Host *host)
>  	hostno = host->host_no;
>  	data = (nsp_hw_data *)host->hostdata;
>  
> -	SPRINTF("NinjaSCSI status\n\n");
> -	SPRINTF("Driver version:        $Revision: 1.23 $\n");
> -	SPRINTF("SCSI host No.:         %d\n",          hostno);
> -	SPRINTF("IRQ:                   %d\n",          host->irq);
> -	SPRINTF("IO:                    0x%lx-0x%lx\n", host->io_port, host->io_port + host->n_io_port - 1);
> -	SPRINTF("MMIO(virtual address): 0x%lx-0x%lx\n", host->base, host->base + data->MmioLength - 1);
> -	SPRINTF("sg_tablesize:          %d\n",          host->sg_tablesize);
> +	seq_printf(m, "NinjaSCSI status\n\n");
> +	seq_printf(m, "Driver version:        $Revision: 1.23 $\n");
> +	seq_printf(m, "SCSI host No.:         %d\n",          hostno);
> +	seq_printf(m, "IRQ:                   %d\n",          host->irq);
> +	seq_printf(m, "IO:                    0x%lx-0x%lx\n", host->io_port, host->io_port + host->n_io_port - 1);
> +	seq_printf(m, "MMIO(virtual address): 0x%lx-0x%lx\n", host->base, host->base + data->MmioLength - 1);
> +	seq_printf(m, "sg_tablesize:          %d\n",          host->sg_tablesize);
>  
> -	SPRINTF("burst transfer mode:   ");
> +	seq_printf(m, "burst transfer mode:   ");
>  	switch (nsp_burst_mode) {
>  	case BURST_IO8:
> -		SPRINTF("io8");
> +		seq_printf(m, "io8");
>  		break;
>  	case BURST_IO32:
> -		SPRINTF("io32");
> +		seq_printf(m, "io32");
>  		break;
>  	case BURST_MEM32:
> -		SPRINTF("mem32");
> +		seq_printf(m, "mem32");
>  		break;
>  	default:
> -		SPRINTF("???");
> +		seq_printf(m, "???");
>  		break;
>  	}
> -	SPRINTF("\n");
> +	seq_printf(m, "\n");
>  
>  
>  	spin_lock_irqsave(&(data->Lock), flags);
> -	SPRINTF("CurrentSC:             0x%p\n\n",      data->CurrentSC);
> +	seq_printf(m, "CurrentSC:             0x%p\n\n",      data->CurrentSC);
>  	spin_unlock_irqrestore(&(data->Lock), flags);
>  
> -	SPRINTF("SDTR status\n");
> +	seq_printf(m, "SDTR status\n");
>  	for(id = 0; id < ARRAY_SIZE(data->Sync); id++) {
>  
> -		SPRINTF("id %d: ", id);
> +		seq_printf(m, "id %d: ", id);
>  
>  		if (id == host->this_id) {
> -			SPRINTF("----- NinjaSCSI-3 host adapter\n");
> +			seq_printf(m, "----- NinjaSCSI-3 host adapter\n");
>  			continue;
>  		}
>  
>  		switch(data->Sync[id].SyncNegotiation) {
>  		case SYNC_OK:
> -			SPRINTF(" sync");
> +			seq_printf(m, " sync");
>  			break;
>  		case SYNC_NG:
> -			SPRINTF("async");
> +			seq_printf(m, "async");
>  			break;
>  		case SYNC_NOT_YET:
> -			SPRINTF(" none");
> +			seq_printf(m, " none");
>  			break;
>  		default:
> -			SPRINTF("?????");
> +			seq_printf(m, "?????");
>  			break;
>  		}
>  
>  		if (data->Sync[id].SyncPeriod != 0) {
>  			speed = 1000000 / (data->Sync[id].SyncPeriod * 4);
>  
> -			SPRINTF(" transfer %d.%dMB/s, offset %d",
> +			seq_printf(m, " transfer %d.%dMB/s, offset %d",
>  				speed / 1000,
>  				speed % 1000,
>  				data->Sync[id].SyncOffset
>  				);
>  		}
> -		SPRINTF("\n");
> +		seq_printf(m, "\n");
>  	}
>  	return 0;
>  }
> -#undef SPRINTF
>  
>  /*---------------------------------------------------------------*/
>  /* error handler                                                 */
> diff --git a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c
> index f94d736..2d7c62f 100644
> --- a/drivers/scsi/wd7000.c
> +++ b/drivers/scsi/wd7000.c
> @@ -1295,9 +1295,6 @@ static void wd7000_revision(Adapter * host)
>  }
>  
>  
> -#undef SPRINTF
> -#define SPRINTF(args...) { seq_printf(m, ## args); }
> -
>  static int wd7000_set_info(struct Scsi_Host *host, char *buffer, int length)
>  {
>  	dprintk("Buffer = <%.*s>, length = %d\n", length, buffer, length);
> @@ -1320,43 +1317,43 @@ static int wd7000_show_info(struct seq_file *m, struct Scsi_Host *host)
>  #endif
>  
>  	spin_lock_irqsave(host->host_lock, flags);
> -	SPRINTF("Host scsi%d: Western Digital WD-7000 (rev %d.%d)\n", host->host_no, adapter->rev1, adapter->rev2);
> -	SPRINTF("  IO base:      0x%x\n", adapter->iobase);
> -	SPRINTF("  IRQ:          %d\n", adapter->irq);
> -	SPRINTF("  DMA channel:  %d\n", adapter->dma);
> -	SPRINTF("  Interrupts:   %d\n", adapter->int_counter);
> -	SPRINTF("  BUS_ON time:  %d nanoseconds\n", adapter->bus_on * 125);
> -	SPRINTF("  BUS_OFF time: %d nanoseconds\n", adapter->bus_off * 125);
> +	seq_printf(m, "Host scsi%d: Western Digital WD-7000 (rev %d.%d)\n", host->host_no, adapter->rev1, adapter->rev2);
> +	seq_printf(m, "  IO base:      0x%x\n", adapter->iobase);
> +	seq_printf(m, "  IRQ:          %d\n", adapter->irq);
> +	seq_printf(m, "  DMA channel:  %d\n", adapter->dma);
> +	seq_printf(m, "  Interrupts:   %d\n", adapter->int_counter);
> +	seq_printf(m, "  BUS_ON time:  %d nanoseconds\n", adapter->bus_on * 125);
> +	seq_printf(m, "  BUS_OFF time: %d nanoseconds\n", adapter->bus_off * 125);
>  
>  #ifdef WD7000_DEBUG
>  	ogmbs = adapter->mb.ogmb;
>  	icmbs = adapter->mb.icmb;
>  
> -	SPRINTF("\nControl port value: 0x%x\n", adapter->control);
> -	SPRINTF("Incoming mailbox:\n");
> -	SPRINTF("  size: %d\n", ICMB_CNT);
> -	SPRINTF("  queued messages: ");
> +	seq_printf(m, "\nControl port value: 0x%x\n", adapter->control);
> +	seq_printf(m, "Incoming mailbox:\n");
> +	seq_printf(m, "  size: %d\n", ICMB_CNT);
> +	seq_printf(m, "  queued messages: ");
>  
>  	for (i = count = 0; i < ICMB_CNT; i++)
>  		if (icmbs[i].status) {
>  			count++;
> -			SPRINTF("0x%x ", i);
> +			seq_printf(m, "0x%x ", i);
>  		}
>  
> -	SPRINTF(count ? "\n" : "none\n");
> +	seq_printf(m, count ? "\n" : "none\n");
>  
> -	SPRINTF("Outgoing mailbox:\n");
> -	SPRINTF("  size: %d\n", OGMB_CNT);
> -	SPRINTF("  next message: 0x%x\n", adapter->next_ogmb);
> -	SPRINTF("  queued messages: ");
> +	seq_printf(m, "Outgoing mailbox:\n");
> +	seq_printf(m, "  size: %d\n", OGMB_CNT);
> +	seq_printf(m, "  next message: 0x%x\n", adapter->next_ogmb);
> +	seq_printf(m, "  queued messages: ");
>  
>  	for (i = count = 0; i < OGMB_CNT; i++)
>  		if (ogmbs[i].status) {
>  			count++;
> -			SPRINTF("0x%x ", i);
> +			seq_printf(m, "0x%x ", i);
>  		}
>  
> -	SPRINTF(count ? "\n" : "none\n");
> +	seq_printf(m, count ? "\n" : "none\n");
>  #endif
>  
>  	spin_unlock_irqrestore(host->host_lock, flags);
> 

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

* Re: [PATCH v2 2/6] scsi/advansys: Replace seq_printf with seq_puts
  2014-12-02 23:10   ` [PATCH v2 2/6] scsi/advansys: Replace seq_printf with seq_puts Rasmus Villemoes
@ 2015-01-30  1:38     ` Finn Thain
  0 siblings, 0 replies; 26+ messages in thread
From: Finn Thain @ 2015-01-30  1:38 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: James E.J. Bottomley, linux-scsi, linux-kernel


Reviewed-by: Finn Thain <fthain@telegraphics.com.au>


On Wed, 3 Dec 2014, Rasmus Villemoes wrote:

> Using seq_printf to print a simple string is a lot more expensive than
> it needs to be, since seq_puts exists. Replace seq_printf with
> seq_puts when possible.
> 
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> ---
>  drivers/scsi/advansys.c | 155 +++++++++++++++++++++++-------------------------
>  1 file changed, 75 insertions(+), 80 deletions(-)
> 
> diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
> index 6719a33..d31fc6d 100644
> --- a/drivers/scsi/advansys.c
> +++ b/drivers/scsi/advansys.c
> @@ -2880,7 +2880,7 @@ static void asc_prt_board_devices(struct seq_file *m, struct Scsi_Host *shost)
>  		chip_scsi_id = boardp->dvc_var.adv_dvc_var.chip_scsi_id;
>  	}
>  
> -	seq_printf(m, "Target IDs Detected:");
> +	seq_puts(m, "Target IDs Detected:");
>  	for (i = 0; i <= ADV_MAX_TID; i++) {
>  		if (boardp->init_tidmask & ADV_TID_TO_TIDMASK(i))
>  			seq_printf(m, " %X,", i);
> @@ -2896,18 +2896,18 @@ static void asc_prt_adv_bios(struct seq_file *m, struct Scsi_Host *shost)
>  	struct asc_board *boardp = shost_priv(shost);
>  	ushort major, minor, letter;
>  
> -	seq_printf(m, "\nROM BIOS Version: ");
> +	seq_puts(m, "\nROM BIOS Version: ");
>  
>  	/*
>  	 * If the BIOS saved a valid signature, then fill in
>  	 * the BIOS code segment base address.
>  	 */
>  	if (boardp->bios_signature != 0x55AA) {
> -		seq_printf(m, "Disabled or Pre-3.1\n");
> -		seq_printf(m,
> -			  "BIOS either disabled or Pre-3.1. If it is pre-3.1, then a newer version\n");
> -		seq_printf(m,
> -			  "can be found at the ConnectCom FTP site: ftp://ftp.connectcom.net/pub\n");
> +		seq_puts(m, "Disabled or Pre-3.1\n");
> +		seq_puts(m,
> +			 "BIOS either disabled or Pre-3.1. If it is pre-3.1, then a newer version\n");
> +		seq_puts(m,
> +			 "can be found at the ConnectCom FTP site: ftp://ftp.connectcom.net/pub\n");
>  	} else {
>  		major = (boardp->bios_version >> 12) & 0xF;
>  		minor = (boardp->bios_version >> 8) & 0xF;
> @@ -2923,10 +2923,9 @@ static void asc_prt_adv_bios(struct seq_file *m, struct Scsi_Host *shost)
>  		 */
>  		if (major < 3 || (major <= 3 && minor < 1) ||
>  		    (major <= 3 && minor <= 1 && letter < ('I' - 'A'))) {
> -			seq_printf(m,
> -				   "Newer version of ROM BIOS is available at the ConnectCom FTP site:\n");
> -			seq_printf(m,
> -				   "ftp://ftp.connectcom.net/pub\n");
> +			seq_puts(m,
> +				 "Newer version of ROM BIOS is available at the ConnectCom FTP site:\n");
> +			seq_puts(m, "ftp://ftp.connectcom.net/pub\n");
>  		}
>  	}
>  }
> @@ -3056,11 +3055,10 @@ static void asc_prt_asc_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
>  	    == ASC_TRUE)
>  		seq_printf(m, " Serial Number: %s\n", serialstr);
>  	else if (ep->adapter_info[5] == 0xBB)
> -		seq_printf(m,
> -			   " Default Settings Used for EEPROM-less Adapter.\n");
> +		seq_puts(m,
> +			 " Default Settings Used for EEPROM-less Adapter.\n");
>  	else
> -		seq_printf(m,
> -			   " Serial Number Signature Not Present.\n");
> +		seq_puts(m, " Serial Number Signature Not Present.\n");
>  
>  	seq_printf(m,
>  		   " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n",
> @@ -3070,34 +3068,34 @@ static void asc_prt_asc_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
>  	seq_printf(m,
>  		   " cntl 0x%x, no_scam 0x%x\n", ep->cntl, ep->no_scam);
>  
> -	seq_printf(m, " Target ID:           ");
> +	seq_puts(m, " Target ID:           ");
>  	for (i = 0; i <= ASC_MAX_TID; i++)
>  		seq_printf(m, " %d", i);
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  
> -	seq_printf(m, " Disconnects:         ");
> +	seq_puts(m, " Disconnects:         ");
>  	for (i = 0; i <= ASC_MAX_TID; i++)
>  		seq_printf(m, " %c",
>  			   (ep->disc_enable & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  
> -	seq_printf(m, " Command Queuing:     ");
> +	seq_puts(m, " Command Queuing:     ");
>  	for (i = 0; i <= ASC_MAX_TID; i++)
>  		seq_printf(m, " %c",
>  			   (ep->use_cmd_qng & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  
> -	seq_printf(m, " Start Motor:         ");
> +	seq_puts(m, " Start Motor:         ");
>  	for (i = 0; i <= ASC_MAX_TID; i++)
>  		seq_printf(m, " %c",
>  			   (ep->start_motor & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  
> -	seq_printf(m, " Synchronous Transfer:");
> +	seq_puts(m, " Synchronous Transfer:");
>  	for (i = 0; i <= ASC_MAX_TID; i++)
>  		seq_printf(m, " %c",
>  			   (ep->init_sdtr & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  
>  #ifdef CONFIG_ISA
>  	if (asc_dvc_varp->bus_type & ASC_IS_ISA) {
> @@ -3151,7 +3149,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
>  	if (asc_get_eeprom_string(wordp, serialstr) == ASC_TRUE)
>  		seq_printf(m, " Serial Number: %s\n", serialstr);
>  	else
> -		seq_printf(m, " Serial Number Signature Not Present.\n");
> +		seq_puts(m, " Serial Number Signature Not Present.\n");
>  
>  	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550)
>  		seq_printf(m,
> @@ -3209,10 +3207,10 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
>  			   ep_38C1600->termination_lvd, termstr,
>  			   ep_38C1600->bios_ctrl);
>  
> -	seq_printf(m, " Target ID:           ");
> +	seq_puts(m, " Target ID:           ");
>  	for (i = 0; i <= ADV_MAX_TID; i++)
>  		seq_printf(m, " %X", i);
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  
>  	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
>  		word = ep_3550->disc_enable;
> @@ -3221,11 +3219,11 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
>  	} else {
>  		word = ep_38C1600->disc_enable;
>  	}
> -	seq_printf(m, " Disconnects:         ");
> +	seq_puts(m, " Disconnects:         ");
>  	for (i = 0; i <= ADV_MAX_TID; i++)
>  		seq_printf(m, " %c",
>  			   (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  
>  	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
>  		word = ep_3550->tagqng_able;
> @@ -3234,11 +3232,11 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
>  	} else {
>  		word = ep_38C1600->tagqng_able;
>  	}
> -	seq_printf(m, " Command Queuing:     ");
> +	seq_puts(m, " Command Queuing:     ");
>  	for (i = 0; i <= ADV_MAX_TID; i++)
>  		seq_printf(m, " %c",
>  			   (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  
>  	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
>  		word = ep_3550->start_motor;
> @@ -3247,28 +3245,28 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
>  	} else {
>  		word = ep_38C1600->start_motor;
>  	}
> -	seq_printf(m, " Start Motor:         ");
> +	seq_puts(m, " Start Motor:         ");
>  	for (i = 0; i <= ADV_MAX_TID; i++)
>  		seq_printf(m, " %c",
>  			   (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  
>  	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
> -		seq_printf(m, " Synchronous Transfer:");
> +		seq_puts(m, " Synchronous Transfer:");
>  		for (i = 0; i <= ADV_MAX_TID; i++)
>  			seq_printf(m, " %c",
>  				   (ep_3550->sdtr_able & ADV_TID_TO_TIDMASK(i)) ?
>  				   'Y' : 'N');
> -		seq_printf(m, "\n");
> +		seq_puts(m, "\n");
>  	}
>  
>  	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
> -		seq_printf(m, " Ultra Transfer:      ");
> +		seq_puts(m, " Ultra Transfer:      ");
>  		for (i = 0; i <= ADV_MAX_TID; i++)
>  			seq_printf(m, " %c",
>  				   (ep_3550->ultra_able & ADV_TID_TO_TIDMASK(i))
>  				   ? 'Y' : 'N');
> -		seq_printf(m, "\n");
> +		seq_puts(m, "\n");
>  	}
>  
>  	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
> @@ -3278,16 +3276,15 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
>  	} else {
>  		word = ep_38C1600->wdtr_able;
>  	}
> -	seq_printf(m, " Wide Transfer:       ");
> +	seq_puts(m, " Wide Transfer:       ");
>  	for (i = 0; i <= ADV_MAX_TID; i++)
>  		seq_printf(m, " %c",
>  			   (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  
>  	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800 ||
>  	    adv_dvc_varp->chip_type == ADV_CHIP_ASC38C1600) {
> -		seq_printf(m,
> -			   " Synchronous Transfer Speed (Mhz):\n  ");
> +		seq_puts(m, " Synchronous Transfer Speed (Mhz):\n  ");
>  		for (i = 0; i <= ADV_MAX_TID; i++) {
>  			char *speed_str;
>  
> @@ -3325,10 +3322,10 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
>  			}
>  			seq_printf(m, "%X:%s ", i, speed_str);
>  			if (i == 7)
> -				seq_printf(m, "\n  ");
> +				seq_puts(m, "\n  ");
>  			sdtr_speed >>= 4;
>  		}
> -		seq_printf(m, "\n");
> +		seq_puts(m, "\n");
>  	}
>  }
>  
> @@ -3403,7 +3400,7 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  	seq_printf(m,
>  		   " Total Command Pending: %d\n", v->cur_total_qng);
>  
> -	seq_printf(m, " Command Queuing:");
> +	seq_puts(m, " Command Queuing:");
>  	for (i = 0; i <= ASC_MAX_TID; i++) {
>  		if ((chip_scsi_id == i) ||
>  		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
> @@ -3413,10 +3410,10 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  			   i,
>  			   (v->use_tagged_qng & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
>  	}
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  
>  	/* Current number of commands waiting for a device. */
> -	seq_printf(m, " Command Queue Pending:");
> +	seq_puts(m, " Command Queue Pending:");
>  	for (i = 0; i <= ASC_MAX_TID; i++) {
>  		if ((chip_scsi_id == i) ||
>  		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
> @@ -3424,10 +3421,10 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  		}
>  		seq_printf(m, " %X:%u", i, v->cur_dvc_qng[i]);
>  	}
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  
>  	/* Current limit on number of commands that can be sent to a device. */
> -	seq_printf(m, " Command Queue Limit:");
> +	seq_puts(m, " Command Queue Limit:");
>  	for (i = 0; i <= ASC_MAX_TID; i++) {
>  		if ((chip_scsi_id == i) ||
>  		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
> @@ -3435,10 +3432,10 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  		}
>  		seq_printf(m, " %X:%u", i, v->max_dvc_qng[i]);
>  	}
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  
>  	/* Indicate whether the device has returned queue full status. */
> -	seq_printf(m, " Command Queue Full:");
> +	seq_puts(m, " Command Queue Full:");
>  	for (i = 0; i <= ASC_MAX_TID; i++) {
>  		if ((chip_scsi_id == i) ||
>  		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
> @@ -3450,9 +3447,9 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  		else
>  			seq_printf(m, " %X:N", i);
>  	}
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  
> -	seq_printf(m, " Synchronous Transfer:");
> +	seq_puts(m, " Synchronous Transfer:");
>  	for (i = 0; i <= ASC_MAX_TID; i++) {
>  		if ((chip_scsi_id == i) ||
>  		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
> @@ -3462,7 +3459,7 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  			   i,
>  			   (v->sdtr_done & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
>  	}
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  
>  	for (i = 0; i <= ASC_MAX_TID; i++) {
>  		uchar syn_period_ix;
> @@ -3476,7 +3473,7 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  		seq_printf(m, "  %X:", i);
>  
>  		if ((boardp->sdtr_data[i] & ASC_SYN_MAX_OFFSET) == 0) {
> -			seq_printf(m, " Asynchronous");
> +			seq_puts(m, " Asynchronous");
>  		} else {
>  			syn_period_ix =
>  			    (boardp->sdtr_data[i] >> 4) & (v->max_sdtr_index -
> @@ -3494,16 +3491,15 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  		}
>  
>  		if ((v->sdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) {
> -			seq_printf(m, "*\n");
> +			seq_puts(m, "*\n");
>  			renegotiate = 1;
>  		} else {
> -			seq_printf(m, "\n");
> +			seq_puts(m, "\n");
>  		}
>  	}
>  
>  	if (renegotiate) {
> -		seq_printf(m,
> -			   " * = Re-negotiation pending before next command.\n");
> +		seq_puts(m, " * = Re-negotiation pending before next command.\n");
>  	}
>  }
>  
> @@ -3548,7 +3544,7 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  		   c->mcode_date, c->mcode_version);
>  
>  	AdvReadWordLram(iop_base, ASC_MC_TAGQNG_ABLE, tagqng_able);
> -	seq_printf(m, " Queuing Enabled:");
> +	seq_puts(m, " Queuing Enabled:");
>  	for (i = 0; i <= ADV_MAX_TID; i++) {
>  		if ((chip_scsi_id == i) ||
>  		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
> @@ -3559,9 +3555,9 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  			   i,
>  			   (tagqng_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
>  	}
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  
> -	seq_printf(m, " Queue Limit:");
> +	seq_puts(m, " Queue Limit:");
>  	for (i = 0; i <= ADV_MAX_TID; i++) {
>  		if ((chip_scsi_id == i) ||
>  		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
> @@ -3573,9 +3569,9 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  
>  		seq_printf(m, " %X:%d", i, lrambyte);
>  	}
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  
> -	seq_printf(m, " Command Pending:");
> +	seq_puts(m, " Command Pending:");
>  	for (i = 0; i <= ADV_MAX_TID; i++) {
>  		if ((chip_scsi_id == i) ||
>  		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
> @@ -3587,10 +3583,10 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  
>  		seq_printf(m, " %X:%d", i, lrambyte);
>  	}
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  
>  	AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able);
> -	seq_printf(m, " Wide Enabled:");
> +	seq_puts(m, " Wide Enabled:");
>  	for (i = 0; i <= ADV_MAX_TID; i++) {
>  		if ((chip_scsi_id == i) ||
>  		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
> @@ -3601,10 +3597,10 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  			   i,
>  			   (wdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
>  	}
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  
>  	AdvReadWordLram(iop_base, ASC_MC_WDTR_DONE, wdtr_done);
> -	seq_printf(m, " Transfer Bit Width:");
> +	seq_puts(m, " Transfer Bit Width:");
>  	for (i = 0; i <= ADV_MAX_TID; i++) {
>  		if ((chip_scsi_id == i) ||
>  		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
> @@ -3620,14 +3616,14 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  
>  		if ((wdtr_able & ADV_TID_TO_TIDMASK(i)) &&
>  		    (wdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) {
> -			seq_printf(m, "*");
> +			seq_puts(m, "*");
>  			renegotiate = 1;
>  		}
>  	}
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  
>  	AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able);
> -	seq_printf(m, " Synchronous Enabled:");
> +	seq_puts(m, " Synchronous Enabled:");
>  	for (i = 0; i <= ADV_MAX_TID; i++) {
>  		if ((chip_scsi_id == i) ||
>  		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
> @@ -3638,7 +3634,7 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  			   i,
>  			   (sdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
>  	}
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  
>  	AdvReadWordLram(iop_base, ASC_MC_SDTR_DONE, sdtr_done);
>  	for (i = 0; i <= ADV_MAX_TID; i++) {
> @@ -3657,14 +3653,14 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  		seq_printf(m, "  %X:", i);
>  
>  		if ((lramword & 0x1F) == 0) {	/* Check for REQ/ACK Offset 0. */
> -			seq_printf(m, " Asynchronous");
> +			seq_puts(m, " Asynchronous");
>  		} else {
> -			seq_printf(m, " Transfer Period Factor: ");
> +			seq_puts(m, " Transfer Period Factor: ");
>  
>  			if ((lramword & 0x1F00) == 0x1100) {	/* 80 Mhz */
> -				seq_printf(m, "9 (80.0 Mhz),");
> +				seq_puts(m, "9 (80.0 Mhz),");
>  			} else if ((lramword & 0x1F00) == 0x1000) {	/* 40 Mhz */
> -				seq_printf(m, "10 (40.0 Mhz),");
> +				seq_puts(m, "10 (40.0 Mhz),");
>  			} else {	/* 20 Mhz or below. */
>  
>  				period = (((lramword >> 8) * 25) + 50) / 4;
> @@ -3684,16 +3680,15 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  		}
>  
>  		if ((sdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) {
> -			seq_printf(m, "*\n");
> +			seq_puts(m, "*\n");
>  			renegotiate = 1;
>  		} else {
> -			seq_printf(m, "\n");
> +			seq_puts(m, "\n");
>  		}
>  	}
>  
>  	if (renegotiate) {
> -		seq_printf(m,
> -			   " * = Re-negotiation pending before next command.\n");
> +		seq_puts(m, " * = Re-negotiation pending before next command.\n");
>  	}
>  }
>  
> 


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

* Re: [PATCH v2 3/6] scsi/aha152x: Replace seq_printf with seq_puts
  2014-12-02 23:10   ` [PATCH v2 3/6] scsi/aha152x: " Rasmus Villemoes
@ 2015-01-30  1:40     ` Finn Thain
  0 siblings, 0 replies; 26+ messages in thread
From: Finn Thain @ 2015-01-30  1:40 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: James E.J. Bottomley, linux-scsi, linux-kernel


Reviewed-by: Finn Thain <fthain@telegraphics.com.au>


On Wed, 3 Dec 2014, Rasmus Villemoes wrote:

> Using seq_printf to print a simple string is a lot more expensive than
> it needs to be, since seq_puts exists. Replace seq_printf with
> seq_puts when possible.
> 
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> ---
>  drivers/scsi/aha152x.c | 248 ++++++++++++++++++++++++-------------------------
>  1 file changed, 124 insertions(+), 124 deletions(-)
> 
> diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
> index f14ad8a..e31c460 100644
> --- a/drivers/scsi/aha152x.c
> +++ b/drivers/scsi/aha152x.c
> @@ -2505,21 +2505,21 @@ static void get_command(struct seq_file *m, Scsi_Cmnd * ptr)
>  		ptr->SCp.buffers_residual);
>  
>  	if (ptr->SCp.phase & not_issued)
> -		seq_printf(m, "not issued|");
> +		seq_puts(m, "not issued|");
>  	if (ptr->SCp.phase & selecting)
> -		seq_printf(m, "selecting|");
> +		seq_puts(m, "selecting|");
>  	if (ptr->SCp.phase & disconnected)
> -		seq_printf(m, "disconnected|");
> +		seq_puts(m, "disconnected|");
>  	if (ptr->SCp.phase & aborted)
> -		seq_printf(m, "aborted|");
> +		seq_puts(m, "aborted|");
>  	if (ptr->SCp.phase & identified)
> -		seq_printf(m, "identified|");
> +		seq_puts(m, "identified|");
>  	if (ptr->SCp.phase & completed)
> -		seq_printf(m, "completed|");
> +		seq_puts(m, "completed|");
>  	if (ptr->SCp.phase & spiordy)
> -		seq_printf(m, "spiordy|");
> +		seq_puts(m, "spiordy|");
>  	if (ptr->SCp.phase & syncneg)
> -		seq_printf(m, "syncneg|");
> +		seq_puts(m, "syncneg|");
>  	seq_printf(m, "; next=0x%p\n", SCNEXT(ptr));
>  }
>  
> @@ -2530,256 +2530,256 @@ static void get_ports(struct seq_file *m, struct Scsi_Host *shpnt)
>  	seq_printf(m, "\n%s: %s(%s) ", CURRENT_SC ? "on bus" : "waiting", states[STATE].name, states[PREVSTATE].name);
>  
>  	s = GETPORT(SCSISEQ);
> -	seq_printf(m, "SCSISEQ( ");
> +	seq_puts(m, "SCSISEQ( ");
>  	if (s & TEMODEO)
> -		seq_printf(m, "TARGET MODE ");
> +		seq_puts(m, "TARGET MODE ");
>  	if (s & ENSELO)
> -		seq_printf(m, "SELO ");
> +		seq_puts(m, "SELO ");
>  	if (s & ENSELI)
> -		seq_printf(m, "SELI ");
> +		seq_puts(m, "SELI ");
>  	if (s & ENRESELI)
> -		seq_printf(m, "RESELI ");
> +		seq_puts(m, "RESELI ");
>  	if (s & ENAUTOATNO)
> -		seq_printf(m, "AUTOATNO ");
> +		seq_puts(m, "AUTOATNO ");
>  	if (s & ENAUTOATNI)
> -		seq_printf(m, "AUTOATNI ");
> +		seq_puts(m, "AUTOATNI ");
>  	if (s & ENAUTOATNP)
> -		seq_printf(m, "AUTOATNP ");
> +		seq_puts(m, "AUTOATNP ");
>  	if (s & SCSIRSTO)
> -		seq_printf(m, "SCSIRSTO ");
> -	seq_printf(m, ");");
> +		seq_puts(m, "SCSIRSTO ");
> +	seq_puts(m, ");");
>  
> -	seq_printf(m, " SCSISIG(");
> +	seq_puts(m, " SCSISIG(");
>  	s = GETPORT(SCSISIG);
>  	switch (s & P_MASK) {
>  	case P_DATAO:
> -		seq_printf(m, "DATA OUT");
> +		seq_puts(m, "DATA OUT");
>  		break;
>  	case P_DATAI:
> -		seq_printf(m, "DATA IN");
> +		seq_puts(m, "DATA IN");
>  		break;
>  	case P_CMD:
> -		seq_printf(m, "COMMAND");
> +		seq_puts(m, "COMMAND");
>  		break;
>  	case P_STATUS:
> -		seq_printf(m, "STATUS");
> +		seq_puts(m, "STATUS");
>  		break;
>  	case P_MSGO:
> -		seq_printf(m, "MESSAGE OUT");
> +		seq_puts(m, "MESSAGE OUT");
>  		break;
>  	case P_MSGI:
> -		seq_printf(m, "MESSAGE IN");
> +		seq_puts(m, "MESSAGE IN");
>  		break;
>  	default:
> -		seq_printf(m, "*invalid*");
> +		seq_puts(m, "*invalid*");
>  		break;
>  	}
>  
> -	seq_printf(m, "); ");
> +	seq_puts(m, "); ");
>  
>  	seq_printf(m, "INTSTAT (%s); ", TESTHI(DMASTAT, INTSTAT) ? "hi" : "lo");
>  
> -	seq_printf(m, "SSTAT( ");
> +	seq_puts(m, "SSTAT( ");
>  	s = GETPORT(SSTAT0);
>  	if (s & TARGET)
> -		seq_printf(m, "TARGET ");
> +		seq_puts(m, "TARGET ");
>  	if (s & SELDO)
> -		seq_printf(m, "SELDO ");
> +		seq_puts(m, "SELDO ");
>  	if (s & SELDI)
> -		seq_printf(m, "SELDI ");
> +		seq_puts(m, "SELDI ");
>  	if (s & SELINGO)
> -		seq_printf(m, "SELINGO ");
> +		seq_puts(m, "SELINGO ");
>  	if (s & SWRAP)
> -		seq_printf(m, "SWRAP ");
> +		seq_puts(m, "SWRAP ");
>  	if (s & SDONE)
> -		seq_printf(m, "SDONE ");
> +		seq_puts(m, "SDONE ");
>  	if (s & SPIORDY)
> -		seq_printf(m, "SPIORDY ");
> +		seq_puts(m, "SPIORDY ");
>  	if (s & DMADONE)
> -		seq_printf(m, "DMADONE ");
> +		seq_puts(m, "DMADONE ");
>  
>  	s = GETPORT(SSTAT1);
>  	if (s & SELTO)
> -		seq_printf(m, "SELTO ");
> +		seq_puts(m, "SELTO ");
>  	if (s & ATNTARG)
> -		seq_printf(m, "ATNTARG ");
> +		seq_puts(m, "ATNTARG ");
>  	if (s & SCSIRSTI)
> -		seq_printf(m, "SCSIRSTI ");
> +		seq_puts(m, "SCSIRSTI ");
>  	if (s & PHASEMIS)
> -		seq_printf(m, "PHASEMIS ");
> +		seq_puts(m, "PHASEMIS ");
>  	if (s & BUSFREE)
> -		seq_printf(m, "BUSFREE ");
> +		seq_puts(m, "BUSFREE ");
>  	if (s & SCSIPERR)
> -		seq_printf(m, "SCSIPERR ");
> +		seq_puts(m, "SCSIPERR ");
>  	if (s & PHASECHG)
> -		seq_printf(m, "PHASECHG ");
> +		seq_puts(m, "PHASECHG ");
>  	if (s & REQINIT)
> -		seq_printf(m, "REQINIT ");
> -	seq_printf(m, "); ");
> +		seq_puts(m, "REQINIT ");
> +	seq_puts(m, "); ");
>  
>  
> -	seq_printf(m, "SSTAT( ");
> +	seq_puts(m, "SSTAT( ");
>  
>  	s = GETPORT(SSTAT0) & GETPORT(SIMODE0);
>  
>  	if (s & TARGET)
> -		seq_printf(m, "TARGET ");
> +		seq_puts(m, "TARGET ");
>  	if (s & SELDO)
> -		seq_printf(m, "SELDO ");
> +		seq_puts(m, "SELDO ");
>  	if (s & SELDI)
> -		seq_printf(m, "SELDI ");
> +		seq_puts(m, "SELDI ");
>  	if (s & SELINGO)
> -		seq_printf(m, "SELINGO ");
> +		seq_puts(m, "SELINGO ");
>  	if (s & SWRAP)
> -		seq_printf(m, "SWRAP ");
> +		seq_puts(m, "SWRAP ");
>  	if (s & SDONE)
> -		seq_printf(m, "SDONE ");
> +		seq_puts(m, "SDONE ");
>  	if (s & SPIORDY)
> -		seq_printf(m, "SPIORDY ");
> +		seq_puts(m, "SPIORDY ");
>  	if (s & DMADONE)
> -		seq_printf(m, "DMADONE ");
> +		seq_puts(m, "DMADONE ");
>  
>  	s = GETPORT(SSTAT1) & GETPORT(SIMODE1);
>  
>  	if (s & SELTO)
> -		seq_printf(m, "SELTO ");
> +		seq_puts(m, "SELTO ");
>  	if (s & ATNTARG)
> -		seq_printf(m, "ATNTARG ");
> +		seq_puts(m, "ATNTARG ");
>  	if (s & SCSIRSTI)
> -		seq_printf(m, "SCSIRSTI ");
> +		seq_puts(m, "SCSIRSTI ");
>  	if (s & PHASEMIS)
> -		seq_printf(m, "PHASEMIS ");
> +		seq_puts(m, "PHASEMIS ");
>  	if (s & BUSFREE)
> -		seq_printf(m, "BUSFREE ");
> +		seq_puts(m, "BUSFREE ");
>  	if (s & SCSIPERR)
> -		seq_printf(m, "SCSIPERR ");
> +		seq_puts(m, "SCSIPERR ");
>  	if (s & PHASECHG)
> -		seq_printf(m, "PHASECHG ");
> +		seq_puts(m, "PHASECHG ");
>  	if (s & REQINIT)
> -		seq_printf(m, "REQINIT ");
> -	seq_printf(m, "); ");
> +		seq_puts(m, "REQINIT ");
> +	seq_puts(m, "); ");
>  
> -	seq_printf(m, "SXFRCTL0( ");
> +	seq_puts(m, "SXFRCTL0( ");
>  
>  	s = GETPORT(SXFRCTL0);
>  	if (s & SCSIEN)
> -		seq_printf(m, "SCSIEN ");
> +		seq_puts(m, "SCSIEN ");
>  	if (s & DMAEN)
> -		seq_printf(m, "DMAEN ");
> +		seq_puts(m, "DMAEN ");
>  	if (s & CH1)
> -		seq_printf(m, "CH1 ");
> +		seq_puts(m, "CH1 ");
>  	if (s & CLRSTCNT)
> -		seq_printf(m, "CLRSTCNT ");
> +		seq_puts(m, "CLRSTCNT ");
>  	if (s & SPIOEN)
> -		seq_printf(m, "SPIOEN ");
> +		seq_puts(m, "SPIOEN ");
>  	if (s & CLRCH1)
> -		seq_printf(m, "CLRCH1 ");
> -	seq_printf(m, "); ");
> +		seq_puts(m, "CLRCH1 ");
> +	seq_puts(m, "); ");
>  
> -	seq_printf(m, "SIGNAL( ");
> +	seq_puts(m, "SIGNAL( ");
>  
>  	s = GETPORT(SCSISIG);
>  	if (s & SIG_ATNI)
> -		seq_printf(m, "ATNI ");
> +		seq_puts(m, "ATNI ");
>  	if (s & SIG_SELI)
> -		seq_printf(m, "SELI ");
> +		seq_puts(m, "SELI ");
>  	if (s & SIG_BSYI)
> -		seq_printf(m, "BSYI ");
> +		seq_puts(m, "BSYI ");
>  	if (s & SIG_REQI)
> -		seq_printf(m, "REQI ");
> +		seq_puts(m, "REQI ");
>  	if (s & SIG_ACKI)
> -		seq_printf(m, "ACKI ");
> -	seq_printf(m, "); ");
> +		seq_puts(m, "ACKI ");
> +	seq_puts(m, "); ");
>  
>  	seq_printf(m, "SELID(%02x), ", GETPORT(SELID));
>  
>  	seq_printf(m, "STCNT(%d), ", GETSTCNT());
>  
> -	seq_printf(m, "SSTAT2( ");
> +	seq_puts(m, "SSTAT2( ");
>  
>  	s = GETPORT(SSTAT2);
>  	if (s & SOFFSET)
> -		seq_printf(m, "SOFFSET ");
> +		seq_puts(m, "SOFFSET ");
>  	if (s & SEMPTY)
> -		seq_printf(m, "SEMPTY ");
> +		seq_puts(m, "SEMPTY ");
>  	if (s & SFULL)
> -		seq_printf(m, "SFULL ");
> +		seq_puts(m, "SFULL ");
>  	seq_printf(m, "); SFCNT (%d); ", s & (SFULL | SFCNT));
>  
>  	s = GETPORT(SSTAT3);
>  	seq_printf(m, "SCSICNT (%d), OFFCNT(%d), ", (s & 0xf0) >> 4, s & 0x0f);
>  
> -	seq_printf(m, "SSTAT4( ");
> +	seq_puts(m, "SSTAT4( ");
>  	s = GETPORT(SSTAT4);
>  	if (s & SYNCERR)
> -		seq_printf(m, "SYNCERR ");
> +		seq_puts(m, "SYNCERR ");
>  	if (s & FWERR)
> -		seq_printf(m, "FWERR ");
> +		seq_puts(m, "FWERR ");
>  	if (s & FRERR)
> -		seq_printf(m, "FRERR ");
> -	seq_printf(m, "); ");
> +		seq_puts(m, "FRERR ");
> +	seq_puts(m, "); ");
>  
> -	seq_printf(m, "DMACNTRL0( ");
> +	seq_puts(m, "DMACNTRL0( ");
>  	s = GETPORT(DMACNTRL0);
>  	seq_printf(m, "%s ", s & _8BIT ? "8BIT" : "16BIT");
>  	seq_printf(m, "%s ", s & DMA ? "DMA" : "PIO");
>  	seq_printf(m, "%s ", s & WRITE_READ ? "WRITE" : "READ");
>  	if (s & ENDMA)
> -		seq_printf(m, "ENDMA ");
> +		seq_puts(m, "ENDMA ");
>  	if (s & INTEN)
> -		seq_printf(m, "INTEN ");
> +		seq_puts(m, "INTEN ");
>  	if (s & RSTFIFO)
> -		seq_printf(m, "RSTFIFO ");
> +		seq_puts(m, "RSTFIFO ");
>  	if (s & SWINT)
> -		seq_printf(m, "SWINT ");
> -	seq_printf(m, "); ");
> +		seq_puts(m, "SWINT ");
> +	seq_puts(m, "); ");
>  
> -	seq_printf(m, "DMASTAT( ");
> +	seq_puts(m, "DMASTAT( ");
>  	s = GETPORT(DMASTAT);
>  	if (s & ATDONE)
> -		seq_printf(m, "ATDONE ");
> +		seq_puts(m, "ATDONE ");
>  	if (s & WORDRDY)
> -		seq_printf(m, "WORDRDY ");
> +		seq_puts(m, "WORDRDY ");
>  	if (s & DFIFOFULL)
> -		seq_printf(m, "DFIFOFULL ");
> +		seq_puts(m, "DFIFOFULL ");
>  	if (s & DFIFOEMP)
> -		seq_printf(m, "DFIFOEMP ");
> -	seq_printf(m, ")\n");
> +		seq_puts(m, "DFIFOEMP ");
> +	seq_puts(m, ")\n");
>  
> -	seq_printf(m, "enabled interrupts( ");
> +	seq_puts(m, "enabled interrupts( ");
>  
>  	s = GETPORT(SIMODE0);
>  	if (s & ENSELDO)
> -		seq_printf(m, "ENSELDO ");
> +		seq_puts(m, "ENSELDO ");
>  	if (s & ENSELDI)
> -		seq_printf(m, "ENSELDI ");
> +		seq_puts(m, "ENSELDI ");
>  	if (s & ENSELINGO)
> -		seq_printf(m, "ENSELINGO ");
> +		seq_puts(m, "ENSELINGO ");
>  	if (s & ENSWRAP)
> -		seq_printf(m, "ENSWRAP ");
> +		seq_puts(m, "ENSWRAP ");
>  	if (s & ENSDONE)
> -		seq_printf(m, "ENSDONE ");
> +		seq_puts(m, "ENSDONE ");
>  	if (s & ENSPIORDY)
> -		seq_printf(m, "ENSPIORDY ");
> +		seq_puts(m, "ENSPIORDY ");
>  	if (s & ENDMADONE)
> -		seq_printf(m, "ENDMADONE ");
> +		seq_puts(m, "ENDMADONE ");
>  
>  	s = GETPORT(SIMODE1);
>  	if (s & ENSELTIMO)
> -		seq_printf(m, "ENSELTIMO ");
> +		seq_puts(m, "ENSELTIMO ");
>  	if (s & ENATNTARG)
> -		seq_printf(m, "ENATNTARG ");
> +		seq_puts(m, "ENATNTARG ");
>  	if (s & ENPHASEMIS)
> -		seq_printf(m, "ENPHASEMIS ");
> +		seq_puts(m, "ENPHASEMIS ");
>  	if (s & ENBUSFREE)
> -		seq_printf(m, "ENBUSFREE ");
> +		seq_puts(m, "ENBUSFREE ");
>  	if (s & ENSCSIPERR)
> -		seq_printf(m, "ENSCSIPERR ");
> +		seq_puts(m, "ENSCSIPERR ");
>  	if (s & ENPHASECHG)
> -		seq_printf(m, "ENPHASECHG ");
> +		seq_puts(m, "ENPHASECHG ");
>  	if (s & ENREQINIT)
> -		seq_printf(m, "ENREQINIT ");
> -	seq_printf(m, ")\n");
> +		seq_puts(m, "ENREQINIT ");
> +	seq_puts(m, ")\n");
>  }
>  
>  static int aha152x_set_info(struct Scsi_Host *shpnt, char *buffer, int length)
> @@ -2822,7 +2822,7 @@ static int aha152x_show_info(struct seq_file *m, struct Scsi_Host *shpnt)
>  	Scsi_Cmnd *ptr;
>  	unsigned long flags;
>  
> -	seq_printf(m, AHA152X_REVID "\n");
> +	seq_puts(m, AHA152X_REVID "\n");
>  
>  	seq_printf(m, "ioports 0x%04lx to 0x%04lx\n",
>  		shpnt->io_port, shpnt->io_port + shpnt->n_io_port - 1);
> @@ -2836,7 +2836,7 @@ static int aha152x_show_info(struct seq_file *m, struct Scsi_Host *shpnt)
>  	seq_printf(m, "%d commands currently queued\n", HOSTDATA(shpnt)->commands);
>  
>  	if(SYNCHRONOUS) {
> -		seq_printf(m, "synchronously operating targets (tick=50 ns):\n");
> +		seq_puts(m, "synchronously operating targets (tick=50 ns):\n");
>  		for (i = 0; i < 8; i++)
>  			if (HOSTDATA(shpnt)->syncrate[i] & 0x7f)
>  				seq_printf(m, "target %d: period %dT/%dns; req/ack offset %d\n",
> @@ -2845,28 +2845,28 @@ static int aha152x_show_info(struct seq_file *m, struct Scsi_Host *shpnt)
>  					(((HOSTDATA(shpnt)->syncrate[i] & 0x70) >> 4) + 2) * 50,
>  				    HOSTDATA(shpnt)->syncrate[i] & 0x0f);
>  	}
> -	seq_printf(m, "\nqueue status:\n");
> +	seq_puts(m, "\nqueue status:\n");
>  	DO_LOCK(flags);
>  	if (ISSUE_SC) {
> -		seq_printf(m, "not yet issued commands:\n");
> +		seq_puts(m, "not yet issued commands:\n");
>  		for (ptr = ISSUE_SC; ptr; ptr = SCNEXT(ptr))
>  			get_command(m, ptr);
>  	} else
> -		seq_printf(m, "no not yet issued commands\n");
> +		seq_puts(m, "no not yet issued commands\n");
>  	DO_UNLOCK(flags);
>  
>  	if (CURRENT_SC) {
> -		seq_printf(m, "current command:\n");
> +		seq_puts(m, "current command:\n");
>  		get_command(m, CURRENT_SC);
>  	} else
> -		seq_printf(m, "no current command\n");
> +		seq_puts(m, "no current command\n");
>  
>  	if (DISCONNECTED_SC) {
> -		seq_printf(m, "disconnected commands:\n");
> +		seq_puts(m, "disconnected commands:\n");
>  		for (ptr = DISCONNECTED_SC; ptr; ptr = SCNEXT(ptr))
>  			get_command(m, ptr);
>  	} else
> -		seq_printf(m, "no disconnected commands\n");
> +		seq_puts(m, "no disconnected commands\n");
>  
>  	get_ports(m, shpnt);
>  
> 

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

* Re: [PATCH v2 4/6] scsi: misc:  Replace seq_printf with seq_puts
  2014-12-02 23:10   ` [PATCH v2 4/6] scsi: misc: " Rasmus Villemoes
@ 2015-01-30  1:41     ` Finn Thain
  0 siblings, 0 replies; 26+ messages in thread
From: Finn Thain @ 2015-01-30  1:41 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: James E.J. Bottomley, linux-scsi, linux-kernel


Reviewed-by: Finn Thain <fthain@telegraphics.com.au>

For the NCR5380 bits:

Acked-by: Finn Thain <fthain@telegraphics.com.au>


On Wed, 3 Dec 2014, Rasmus Villemoes wrote:

> Using seq_printf to print a simple string is a lot more expensive than
> it needs to be, since seq_puts exists. Replace seq_printf with
> seq_puts when possible.
> 
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> ---
>  drivers/scsi/BusLogic.c             | 10 +++++-----
>  drivers/scsi/NCR5380.c              |  4 ++--
>  drivers/scsi/aic7xxx/aic79xx_proc.c | 38 ++++++++++++++++++-------------------
>  drivers/scsi/aic7xxx/aic7xxx_proc.c | 24 +++++++++++------------
>  drivers/scsi/arm/fas216.c           |  6 +++---
>  drivers/scsi/atari_NCR5380.c        |  4 ++--
>  drivers/scsi/atp870u.c              |  6 +++---
>  drivers/scsi/dc395x.c               | 17 +++++++++--------
>  drivers/scsi/dpt_i2o.c              |  2 +-
>  drivers/scsi/eata_pio.c             |  2 +-
>  drivers/scsi/gdth_proc.c            | 24 +++++++++++------------
>  drivers/scsi/in2000.c               | 18 +++++++++---------
>  drivers/scsi/ips.c                  |  7 +++----
>  drivers/scsi/megaraid.c             |  2 +-
>  drivers/scsi/nsp32.c                | 14 +++++++-------
>  drivers/scsi/pcmcia/nsp_cs.c        | 30 ++++++++++++++---------------
>  drivers/scsi/qla2xxx/qla_dfs.c      |  8 ++++----
>  drivers/scsi/scsi_proc.c            | 22 ++++++++++-----------
>  drivers/scsi/scsi_trace.c           |  6 +++---
>  drivers/scsi/wd33c93.c              | 18 +++++++++---------
>  drivers/scsi/wd7000.c               | 12 ++++++------
>  21 files changed, 136 insertions(+), 138 deletions(-)
> 
> diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
> index 8d66a64..c7be7bb 100644
> --- a/drivers/scsi/BusLogic.c
> +++ b/drivers/scsi/BusLogic.c
> @@ -3485,7 +3485,7 @@ static int blogic_show_info(struct seq_file *m, struct Scsi_Host *shost)
>  	seq_printf(m, "\n\
>  Current Driver Queue Depth:	%d\n\
>  Currently Allocated CCBs:	%d\n", adapter->drvr_qdepth, adapter->alloc_ccbs);
> -	seq_printf(m, "\n\n\
> +	seq_puts(m, "\n\n\
>  			   DATA TRANSFER STATISTICS\n\
>  \n\
>  Target	Tagged Queuing	Queue Depth  Active  Attempted	Completed\n\
> @@ -3500,7 +3500,7 @@ Target	Tagged Queuing	Queue Depth  Active  Attempted	Completed\n\
>  		seq_printf(m,
>  				  "	    %3d       %3u    %9u	%9u\n", adapter->qdepth[tgt], adapter->active_cmds[tgt], tgt_stats[tgt].cmds_tried, tgt_stats[tgt].cmds_complete);
>  	}
> -	seq_printf(m, "\n\
> +	seq_puts(m, "\n\
>  Target  Read Commands  Write Commands   Total Bytes Read    Total Bytes Written\n\
>  ======  =============  ==============  ===================  ===================\n");
>  	for (tgt = 0; tgt < adapter->maxdev; tgt++) {
> @@ -3517,7 +3517,7 @@ Target  Read Commands  Write Commands   Total Bytes Read    Total Bytes Written\
>  		else
>  			seq_printf(m, "	     %9u\n", tgt_stats[tgt].byteswritten.units);
>  	}
> -	seq_printf(m, "\n\
> +	seq_puts(m, "\n\
>  Target  Command    0-1KB      1-2KB      2-4KB      4-8KB     8-16KB\n\
>  ======  =======  =========  =========  =========  =========  =========\n");
>  	for (tgt = 0; tgt < adapter->maxdev; tgt++) {
> @@ -3533,7 +3533,7 @@ Target  Command    0-1KB      1-2KB      2-4KB      4-8KB     8-16KB\n\
>  			    tgt_stats[tgt].write_sz_buckets[0],
>  			    tgt_stats[tgt].write_sz_buckets[1], tgt_stats[tgt].write_sz_buckets[2], tgt_stats[tgt].write_sz_buckets[3], tgt_stats[tgt].write_sz_buckets[4]);
>  	}
> -	seq_printf(m, "\n\
> +	seq_puts(m, "\n\
>  Target  Command   16-32KB    32-64KB   64-128KB   128-256KB   256KB+\n\
>  ======  =======  =========  =========  =========  =========  =========\n");
>  	for (tgt = 0; tgt < adapter->maxdev; tgt++) {
> @@ -3549,7 +3549,7 @@ Target  Command   16-32KB    32-64KB   64-128KB   128-256KB   256KB+\n\
>  			    tgt_stats[tgt].write_sz_buckets[5],
>  			    tgt_stats[tgt].write_sz_buckets[6], tgt_stats[tgt].write_sz_buckets[7], tgt_stats[tgt].write_sz_buckets[8], tgt_stats[tgt].write_sz_buckets[9]);
>  	}
> -	seq_printf(m, "\n\n\
> +	seq_puts(m, "\n\n\
>  			   ERROR RECOVERY STATISTICS\n\
>  \n\
>  	  Command Aborts      Bus Device Resets	  Host Adapter Resets\n\
> diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
> index aca181e..a30af00 100644
> --- a/drivers/scsi/NCR5380.c
> +++ b/drivers/scsi/NCR5380.c
> @@ -754,7 +754,7 @@ static int __maybe_unused NCR5380_show_info(struct seq_file *m,
>  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_printf(m, "        command = ");
> +	seq_puts(m, "        command = ");
>  	lprint_command(cmd->cmnd, m);
>  }
>  
> @@ -764,7 +764,7 @@ static void lprint_command(unsigned char *command, struct seq_file *m)
>  	lprint_opcode(command[0], m);
>  	for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i)
>  		seq_printf(m, "%02x ", command[i]);
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  }
>  
>  static void lprint_opcode(int opcode, struct seq_file *m)
> diff --git a/drivers/scsi/aic7xxx/aic79xx_proc.c b/drivers/scsi/aic7xxx/aic79xx_proc.c
> index 27dbfcc..e095598 100644
> --- a/drivers/scsi/aic7xxx/aic79xx_proc.c
> +++ b/drivers/scsi/aic7xxx/aic79xx_proc.c
> @@ -97,7 +97,7 @@ ahd_format_transinfo(struct seq_file *m, struct ahd_transinfo *tinfo)
>  	u_int mb;
>  
>  	if (tinfo->period == AHD_PERIOD_UNKNOWN) {
> -		seq_printf(m, "Renegotiation Pending\n");
> +		seq_puts(m, "Renegotiation Pending\n");
>  		return;
>  	}
>          speed = 3300;
> @@ -119,40 +119,38 @@ ahd_format_transinfo(struct seq_file *m, struct ahd_transinfo *tinfo)
>  		printed_options = 0;
>  		seq_printf(m, " (%d.%03dMHz", freq / 1000, freq % 1000);
>  		if ((tinfo->ppr_options & MSG_EXT_PPR_RD_STRM) != 0) {
> -			seq_printf(m, " RDSTRM");
> +			seq_puts(m, " RDSTRM");
>  			printed_options++;
>  		}
>  		if ((tinfo->ppr_options & MSG_EXT_PPR_DT_REQ) != 0) {
> -			seq_printf(m, "%s", printed_options ? "|DT" : " DT");
> +			seq_puts(m, printed_options ? "|DT" : " DT");
>  			printed_options++;
>  		}
>  		if ((tinfo->ppr_options & MSG_EXT_PPR_IU_REQ) != 0) {
> -			seq_printf(m, "%s", printed_options ? "|IU" : " IU");
> +			seq_puts(m, printed_options ? "|IU" : " IU");
>  			printed_options++;
>  		}
>  		if ((tinfo->ppr_options & MSG_EXT_PPR_RTI) != 0) {
> -			seq_printf(m, "%s",
> -				  printed_options ? "|RTI" : " RTI");
> +			seq_puts(m, printed_options ? "|RTI" : " RTI");
>  			printed_options++;
>  		}
>  		if ((tinfo->ppr_options & MSG_EXT_PPR_QAS_REQ) != 0) {
> -			seq_printf(m, "%s",
> -				  printed_options ? "|QAS" : " QAS");
> +			seq_puts(m, printed_options ? "|QAS" : " QAS");
>  			printed_options++;
>  		}
>  	}
>  
>  	if (tinfo->width > 0) {
>  		if (freq != 0) {
> -			seq_printf(m, ", ");
> +			seq_puts(m, ", ");
>  		} else {
> -			seq_printf(m, " (");
> +			seq_puts(m, " (");
>  		}
>  		seq_printf(m, "%dbit)", 8 * (0x01 << tinfo->width));
>  	} else if (freq != 0) {
> -		seq_printf(m, ")");
> +		seq_puts(m, ")");
>  	}
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  }
>  
>  static void
> @@ -167,15 +165,15 @@ ahd_dump_target_state(struct ahd_softc *ahd, struct seq_file *m,
>  	tinfo = ahd_fetch_transinfo(ahd, channel, our_id,
>  				    target_id, &tstate);
>  	seq_printf(m, "Target %d Negotiation Settings\n", target_id);
> -	seq_printf(m, "\tUser: ");
> +	seq_puts(m, "\tUser: ");
>  	ahd_format_transinfo(m, &tinfo->user);
>  	starget = ahd->platform_data->starget[target_id];
>  	if (starget == NULL)
>  		return;
>  
> -	seq_printf(m, "\tGoal: ");
> +	seq_puts(m, "\tGoal: ");
>  	ahd_format_transinfo(m, &tinfo->goal);
> -	seq_printf(m, "\tCurr: ");
> +	seq_puts(m, "\tCurr: ");
>  	ahd_format_transinfo(m, &tinfo->curr);
>  
>  	for (lun = 0; lun < AHD_NUM_LUNS; lun++) {
> @@ -291,19 +289,19 @@ ahd_linux_show_info(struct seq_file *m, struct Scsi_Host *shost)
>  	max_targ = 16;
>  
>  	if (ahd->seep_config == NULL)
> -		seq_printf(m, "No Serial EEPROM\n");
> +		seq_puts(m, "No Serial EEPROM\n");
>  	else {
> -		seq_printf(m, "Serial EEPROM:\n");
> +		seq_puts(m, "Serial EEPROM:\n");
>  		for (i = 0; i < sizeof(*ahd->seep_config)/2; i++) {
>  			if (((i % 8) == 0) && (i != 0)) {
> -				seq_printf(m, "\n");
> +				seq_puts(m, "\n");
>  			}
>  			seq_printf(m, "0x%.4x ",
>  				  ((uint16_t*)ahd->seep_config)[i]);
>  		}
> -		seq_printf(m, "\n");
> +		seq_puts(m, "\n");
>  	}
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  
>  	if ((ahd->features & AHD_WIDE) == 0)
>  		max_targ = 8;
> diff --git a/drivers/scsi/aic7xxx/aic7xxx_proc.c b/drivers/scsi/aic7xxx/aic7xxx_proc.c
> index 64eec6c..25511ca 100644
> --- a/drivers/scsi/aic7xxx/aic7xxx_proc.c
> +++ b/drivers/scsi/aic7xxx/aic7xxx_proc.c
> @@ -119,15 +119,15 @@ ahc_format_transinfo(struct seq_file *m, struct ahc_transinfo *tinfo)
>  
>  	if (tinfo->width > 0) {
>  		if (freq != 0) {
> -			seq_printf(m, ", ");
> +			seq_puts(m, ", ");
>  		} else {
> -			seq_printf(m, " (");
> +			seq_puts(m, " (");
>  		}
>  		seq_printf(m, "%dbit)", 8 * (0x01 << tinfo->width));
>  	} else if (freq != 0) {
> -		seq_printf(m, ")");
> +		seq_puts(m, ")");
>  	}
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  }
>  
>  static void
> @@ -145,15 +145,15 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct seq_file *m,
>  	if ((ahc->features & AHC_TWIN) != 0)
>  		seq_printf(m, "Channel %c ", channel);
>  	seq_printf(m, "Target %d Negotiation Settings\n", target_id);
> -	seq_printf(m, "\tUser: ");
> +	seq_puts(m, "\tUser: ");
>  	ahc_format_transinfo(m, &tinfo->user);
>  	starget = ahc->platform_data->starget[target_offset];
>  	if (!starget)
>  		return;
>  
> -	seq_printf(m, "\tGoal: ");
> +	seq_puts(m, "\tGoal: ");
>  	ahc_format_transinfo(m, &tinfo->goal);
> -	seq_printf(m, "\tCurr: ");
> +	seq_puts(m, "\tCurr: ");
>  	ahc_format_transinfo(m, &tinfo->curr);
>  
>  	for (lun = 0; lun < AHC_NUM_LUNS; lun++) {
> @@ -303,19 +303,19 @@ ahc_linux_show_info(struct seq_file *m, struct Scsi_Host *shost)
>  
>  
>  	if (ahc->seep_config == NULL)
> -		seq_printf(m, "No Serial EEPROM\n");
> +		seq_puts(m, "No Serial EEPROM\n");
>  	else {
> -		seq_printf(m, "Serial EEPROM:\n");
> +		seq_puts(m, "Serial EEPROM:\n");
>  		for (i = 0; i < sizeof(*ahc->seep_config)/2; i++) {
>  			if (((i % 8) == 0) && (i != 0)) {
> -				seq_printf(m, "\n");
> +				seq_puts(m, "\n");
>  			}
>  			seq_printf(m, "0x%.4x ",
>  				  ((uint16_t*)ahc->seep_config)[i]);
>  		}
> -		seq_printf(m, "\n");
> +		seq_puts(m, "\n");
>  	}
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  
>  	max_targ = 16;
>  	if ((ahc->features & (AHC_WIDE|AHC_TWIN)) == 0)
> diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c
> index e64c3af..decdc71 100644
> --- a/drivers/scsi/arm/fas216.c
> +++ b/drivers/scsi/arm/fas216.c
> @@ -2990,7 +2990,7 @@ void fas216_print_devices(FAS216_Info *info, struct seq_file *m)
>  	struct fas216_device *dev;
>  	struct scsi_device *scd;
>  
> -	seq_printf(m, "Device/Lun TaggedQ       Parity   Sync\n");
> +	seq_puts(m, "Device/Lun TaggedQ       Parity   Sync\n");
>  
>  	shost_for_each_device(scd, info->host) {
>  		dev = &info->device[scd->id];
> @@ -3000,7 +3000,7 @@ void fas216_print_devices(FAS216_Info *info, struct seq_file *m)
>  				     scd->simple_tags ? "en" : "dis",
>  				     scd->current_tag);
>  		else
> -			seq_printf(m, "unsupported   ");
> +			seq_puts(m, "unsupported   ");
>  
>  		seq_printf(m, "%3sabled ", dev->parity_enabled ? "en" : "dis");
>  
> @@ -3008,7 +3008,7 @@ void fas216_print_devices(FAS216_Info *info, struct seq_file *m)
>  			seq_printf(m, "offset %d, %d ns\n",
>  				     dev->sof, dev->period * 4);
>  		else
> -			seq_printf(m, "async\n");
> +			seq_puts(m, "async\n");
>  	}
>  }
>  
> diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
> index 6daed6b..04d0c6e 100644
> --- a/drivers/scsi/atari_NCR5380.c
> +++ b/drivers/scsi/atari_NCR5380.c
> @@ -711,12 +711,12 @@ static void show_Scsi_Cmnd(struct scsi_cmnd *cmd, struct seq_file *m)
>  	unsigned char *command;
>  	seq_printf(m, "scsi%d: destination target %d, lun %llu\n",
>  		H_NO(cmd), cmd->device->id, cmd->device->lun);
> -	seq_printf(m, "        command = ");
> +	seq_puts(m, "        command = ");
>  	command = cmd->cmnd;
>  	seq_printf(m, "%2d (0x%02x)", command[0], command[0]);
>  	for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i)
>  		seq_printf(m, " %02x", command[i]);
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  }
>  
>  static int __maybe_unused NCR5380_show_info(struct seq_file *m,
> diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c
> index a795d81..0b02467 100644
> --- a/drivers/scsi/atp870u.c
> +++ b/drivers/scsi/atp870u.c
> @@ -3101,9 +3101,9 @@ static const char *atp870u_info(struct Scsi_Host *notused)
>  
>  static int atp870u_show_info(struct seq_file *m, struct Scsi_Host *HBAptr)
>  {
> -	seq_printf(m, "ACARD AEC-671X Driver Version: 2.6+ac\n");
> -	seq_printf(m, "\n");
> -	seq_printf(m, "Adapter Configuration:\n");
> +	seq_puts(m, "ACARD AEC-671X Driver Version: 2.6+ac\n");
> +	seq_puts(m, "\n");
> +	seq_puts(m, "Adapter Configuration:\n");
>  	seq_printf(m, "               Base IO: %#.4lx\n", HBAptr->io_port);
>  	seq_printf(m, "                   IRQ: %d\n", HBAptr->irq);
>  	return 0;
> diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
> index 0a1ed50..3a55ea2 100644
> --- a/drivers/scsi/dc395x.c
> +++ b/drivers/scsi/dc395x.c
> @@ -4623,8 +4623,8 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
>  	unsigned long flags;
>  	int dev;
>  
> -	seq_printf(m, DC395X_BANNER " PCI SCSI Host Adapter\n");
> -	seq_printf(m, " Driver Version " DC395X_VERSION "\n");
> +	seq_puts(m, DC395X_BANNER " PCI SCSI Host Adapter\n");
> +	seq_puts(m, " Driver Version " DC395X_VERSION "\n");
>  
>  	DC395x_LOCK_IO(acb->scsi_host, flags);
>  
> @@ -4655,7 +4655,8 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
>  	     acb->dcb_map[11], acb->dcb_map[12], acb->dcb_map[13],
>  	     acb->dcb_map[14], acb->dcb_map[15]);
>  
> -	seq_printf(m, "Un ID LUN Prty Sync Wide DsCn SndS TagQ nego_period SyncFreq SyncOffs MaxCmd\n");
> +	seq_puts(m,
> +		 "Un ID LUN Prty Sync Wide DsCn SndS TagQ nego_period SyncFreq SyncOffs MaxCmd\n");
>  
>  	dev = 0;
>  	list_for_each_entry(dcb, &acb->dcb_list, list) {
> @@ -4681,7 +4682,7 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
>  			seq_printf(m, "   %2i.%1i M     %02i ", spd, spd1,
>  				(dcb->sync_offset & 0x0f));
>  		} else
> -			seq_printf(m, "                 ");
> +			seq_puts(m, "                 ");
>  
>  		/* Add more info ... */
>  		seq_printf(m, "     %02i\n", dcb->max_command);
> @@ -4689,9 +4690,9 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
>  	}
>  
>  	if (timer_pending(&acb->waiting_timer))
> -		seq_printf(m, "Waiting queue timer running\n");
> +		seq_puts(m, "Waiting queue timer running\n");
>  	else
> -		seq_printf(m, "\n");
> +		seq_puts(m, "\n");
>  
>  	list_for_each_entry(dcb, &acb->dcb_list, list) {
>  		struct ScsiReqBlk *srb;
> @@ -4708,7 +4709,7 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
>  		list_for_each_entry(srb, &dcb->srb_going_list, list)
>  			seq_printf(m, " %p", srb->cmd);
>  		if (!list_empty(&dcb->srb_waiting_list) || !list_empty(&dcb->srb_going_list))
> -			seq_printf(m, "\n");
> +			seq_puts(m, "\n");
>  	}
>  
>  	if (debug_enabled(DBG_1)) {
> @@ -4716,7 +4717,7 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
>  		list_for_each_entry(dcb, &acb->dcb_list, list) {
>  			seq_printf(m, "%p -> ", dcb);
>  		}
> -		seq_printf(m, "END\n");
> +		seq_puts(m, "END\n");
>  	}
>  
>  	DC395x_UNLOCK_IO(acb->scsi_host, flags);
> diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
> index 0bf9769..2806cfb 100644
> --- a/drivers/scsi/dpt_i2o.c
> +++ b/drivers/scsi/dpt_i2o.c
> @@ -568,7 +568,7 @@ static int adpt_show_info(struct seq_file *m, struct Scsi_Host *host)
>  	seq_printf(m, "\tpost fifo size  = %d\n\treply fifo size = %d\n\tsg table size   = %d\n\n",
>  			host->can_queue, (int) pHba->reply_fifo_size , host->sg_tablesize);
>  
> -	seq_printf(m, "Devices:\n");
> +	seq_puts(m, "Devices:\n");
>  	for(chan = 0; chan < MAX_CHANNEL; chan++) {
>  		for(id = 0; id < MAX_ID; id++) {
>  			d = pHba->channel[chan].device[id];
> diff --git a/drivers/scsi/eata_pio.c b/drivers/scsi/eata_pio.c
> index 8319d2b..ca8003f 100644
> --- a/drivers/scsi/eata_pio.c
> +++ b/drivers/scsi/eata_pio.c
> @@ -102,7 +102,7 @@ static int eata_pio_show_info(struct seq_file *m, struct Scsi_Host *shost)
>  		   shost->host_no, SD(shost)->name);
>  	seq_printf(m, "Firmware revision: v%s\n",
>  		   SD(shost)->revision);
> -	seq_printf(m, "IO: PIO\n");
> +	seq_puts(m, "IO: PIO\n");
>  	seq_printf(m, "Base IO : %#.4x\n", (u32) shost->base);
>  	seq_printf(m, "Host Bus: %s\n",
>  		   (SD(shost)->bustype == 'P')?"PCI ":
> diff --git a/drivers/scsi/gdth_proc.c b/drivers/scsi/gdth_proc.c
> index 9fb6326..e66e997 100644
> --- a/drivers/scsi/gdth_proc.c
> +++ b/drivers/scsi/gdth_proc.c
> @@ -173,7 +173,7 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
>      /* request is i.e. "cat /proc/scsi/gdth/0" */ 
>      /* format: %-15s\t%-10s\t%-15s\t%s */
>      /* driver parameters */
> -    seq_printf(m, "Driver Parameters:\n");
> +    seq_puts(m, "Driver Parameters:\n");
>      if (reserve_list[0] == 0xff)
>          strcpy(hrec, "--");
>      else {
> @@ -192,7 +192,7 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
>                     max_ids, hdr_channel);
>  
>      /* controller information */
> -    seq_printf(m,"\nDisk Array Controller Information:\n");
> +    seq_puts(m, "\nDisk Array Controller Information:\n");
>      seq_printf(m,
>                     " Number:       \t%d         \tName:          \t%s\n",
>                     ha->hanum, ha->binfo.type_string);
> @@ -219,7 +219,7 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
>  
>  #ifdef GDTH_DMA_STATISTICS
>      /* controller statistics */
> -    seq_printf(m,"\nController Statistics:\n");
> +    seq_puts(m, "\nController Statistics:\n");
>      seq_printf(m,
>                     " 32-bit DMA buffer:\t%lu\t64-bit DMA buffer:\t%lu\n",
>                     ha->dma32_cnt, ha->dma64_cnt);
> @@ -227,7 +227,7 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
>  
>      if (ha->more_proc) {
>          /* more information: 2. about physical devices */
> -        seq_printf(m, "\nPhysical Devices:");
> +        seq_puts(m, "\nPhysical Devices:");
>          flag = FALSE;
>              
>          buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr);
> @@ -326,10 +326,10 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
>          gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr);
>  
>          if (!flag)
> -            seq_printf(m, "\n --\n");
> +            seq_puts(m, "\n --\n");
>  
>          /* 3. about logical drives */
> -        seq_printf(m,"\nLogical Drives:");
> +        seq_puts(m, "\nLogical Drives:");
>          flag = FALSE;
>  
>          buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr);
> @@ -411,10 +411,10 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
>          gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr);
>          
>          if (!flag)
> -            seq_printf(m, "\n --\n");
> +            seq_puts(m, "\n --\n");
>  
>          /* 4. about array drives */
> -        seq_printf(m,"\nArray Drives:");
> +        seq_puts(m, "\nArray Drives:");
>          flag = FALSE;
>  
>          buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr);
> @@ -471,10 +471,10 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
>          gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr);
>          
>          if (!flag)
> -            seq_printf(m, "\n --\n");
> +            seq_puts(m, "\n --\n");
>  
>          /* 5. about host drives */
> -        seq_printf(m,"\nHost Drives:");
> +        seq_puts(m, "\nHost Drives:");
>          flag = FALSE;
>  
>          buf = gdth_ioctl_alloc(ha, sizeof(gdth_hget_str), FALSE, &paddr);
> @@ -527,11 +527,11 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
>          }
>          
>          if (!flag)
> -            seq_printf(m, "\n --\n");
> +            seq_puts(m, "\n --\n");
>      }
>  
>      /* controller events */
> -    seq_printf(m,"\nController Events:\n");
> +    seq_puts(m, "\nController Events:\n");
>  
>      for (id = -1;;) {
>          id = gdth_read_event(ha, id, estr);
> diff --git a/drivers/scsi/in2000.c b/drivers/scsi/in2000.c
> index ddf0694..a73395e 100644
> --- a/drivers/scsi/in2000.c
> +++ b/drivers/scsi/in2000.c
> @@ -2226,36 +2226,36 @@ static int in2000_show_info(struct seq_file *m, struct Scsi_Host *instance)
>  
>  	if (hd->proc & PR_INFO) {
>  		seq_printf(m, "\ndip_switch=%02x: irq=%d io=%02x floppy=%s sync/DOS5=%s", (hd->dip_switch & 0x7f), instance->irq, hd->io_base, (hd->dip_switch & 0x40) ? "Yes" : "No", (hd->dip_switch & 0x20) ? "Yes" : "No");
> -		seq_printf(m, "\nsync_xfer[] =       ");
> +		seq_puts(m, "\nsync_xfer[] =       ");
>  		for (x = 0; x < 7; x++)
>  			seq_printf(m, "\t%02x", hd->sync_xfer[x]);
> -		seq_printf(m, "\nsync_stat[] =       ");
> +		seq_puts(m, "\nsync_stat[] =       ");
>  		for (x = 0; x < 7; x++)
>  			seq_printf(m, "\t%02x", hd->sync_stat[x]);
>  	}
>  #ifdef PROC_STATISTICS
>  	if (hd->proc & PR_STATISTICS) {
> -		seq_printf(m, "\ncommands issued:    ");
> +		seq_puts(m, "\ncommands issued:    ");
>  		for (x = 0; x < 7; x++)
>  			seq_printf(m, "\t%ld", hd->cmd_cnt[x]);
> -		seq_printf(m, "\ndisconnects allowed:");
> +		seq_puts(m, "\ndisconnects allowed:");
>  		for (x = 0; x < 7; x++)
>  			seq_printf(m, "\t%ld", hd->disc_allowed_cnt[x]);
> -		seq_printf(m, "\ndisconnects done:   ");
> +		seq_puts(m, "\ndisconnects done:   ");
>  		for (x = 0; x < 7; x++)
>  			seq_printf(m, "\t%ld", hd->disc_done_cnt[x]);
>  		seq_printf(m, "\ninterrupts:      \t%ld", hd->int_cnt);
>  	}
>  #endif
>  	if (hd->proc & PR_CONNECTED) {
> -		seq_printf(m, "\nconnected:     ");
> +		seq_puts(m, "\nconnected:     ");
>  		if (hd->connected) {
>  			cmd = (Scsi_Cmnd *) hd->connected;
>  			seq_printf(m, " %d:%llu(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
>  		}
>  	}
>  	if (hd->proc & PR_INPUTQ) {
> -		seq_printf(m, "\ninput_Q:       ");
> +		seq_puts(m, "\ninput_Q:       ");
>  		cmd = (Scsi_Cmnd *) hd->input_Q;
>  		while (cmd) {
>  			seq_printf(m, " %d:%llu(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
> @@ -2263,7 +2263,7 @@ static int in2000_show_info(struct seq_file *m, struct Scsi_Host *instance)
>  		}
>  	}
>  	if (hd->proc & PR_DISCQ) {
> -		seq_printf(m, "\ndisconnected_Q:");
> +		seq_puts(m, "\ndisconnected_Q:");
>  		cmd = (Scsi_Cmnd *) hd->disconnected_Q;
>  		while (cmd) {
>  			seq_printf(m, " %d:%llu(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
> @@ -2273,7 +2273,7 @@ static int in2000_show_info(struct seq_file *m, struct Scsi_Host *instance)
>  	if (hd->proc & PR_TEST) {
>  		;		/* insert your own custom function here */
>  	}
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  	spin_unlock_irqrestore(instance->host_lock, flags);
>  #endif				/* PROC_INTERFACE */
>  	return 0;
> diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
> index e5c2843..615a9a3 100644
> --- a/drivers/scsi/ips.c
> +++ b/drivers/scsi/ips.c
> @@ -2038,15 +2038,14 @@ ips_host_info(ips_ha_t *ha, struct seq_file *m)
>  {
>  	METHOD_TRACE("ips_host_info", 1);
>  
> -	seq_printf(m, "\nIBM ServeRAID General Information:\n\n");
> +	seq_puts(m, "\nIBM ServeRAID General Information:\n\n");
>  
>  	if ((le32_to_cpu(ha->nvram->signature) == IPS_NVRAM_P5_SIG) &&
>  	    (le16_to_cpu(ha->nvram->adapter_type) != 0))
>  		seq_printf(m, "\tController Type                   : %s\n",
>  			  ips_adapter_name[ha->ad_type - 1]);
>  	else
> -		seq_printf(m,
> -			  "\tController Type                   : Unknown\n");
> +		seq_puts(m, "\tController Type                   : Unknown\n");
>  
>  	if (ha->io_addr)
>  		seq_printf(m,
> @@ -2138,7 +2137,7 @@ ips_host_info(ips_ha_t *ha, struct seq_file *m)
>  	seq_printf(m, "\tCurrent Active PT Commands        : %d\n",
>  		  ha->num_ioctl);
>  
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  
>  	return 0;
>  }
> diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
> index 2485255..bc7b34c 100644
> --- a/drivers/scsi/megaraid.c
> +++ b/drivers/scsi/megaraid.c
> @@ -2240,7 +2240,7 @@ proc_show_battery(struct seq_file *m, void *v)
>  		goto free_pdev;
>  
>  	if( mega_adapinq(adapter, dma_handle) != 0 ) {
> -		seq_printf(m, "Adapter inquiry failed.\n");
> +		seq_puts(m, "Adapter inquiry failed.\n");
>  		printk(KERN_WARNING "megaraid: inquiry failed.\n");
>  		goto free_inquiry;
>  	}
> diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
> index 3e77551..8f6b1b4 100644
> --- a/drivers/scsi/nsp32.c
> +++ b/drivers/scsi/nsp32.c
> @@ -1456,7 +1456,7 @@ static int nsp32_show_info(struct seq_file *m, struct Scsi_Host *host)
>  	data = (nsp32_hw_data *)host->hostdata;
>  	base = host->io_port;
>  
> -	seq_printf(m, "NinjaSCSI-32 status\n\n");
> +	seq_puts(m, "NinjaSCSI-32 status\n\n");
>  	seq_printf(m, "Driver version:        %s, $Revision: 1.33 $\n", nsp32_release_version);
>  	seq_printf(m, "SCSI host No.:         %d\n",		hostno);
>  	seq_printf(m, "IRQ:                   %d\n",		host->irq);
> @@ -1478,25 +1478,25 @@ static int nsp32_show_info(struct seq_file *m, struct Scsi_Host *host)
>  	spin_unlock_irqrestore(&(data->Lock), flags);
>  
>  
> -	seq_printf(m, "SDTR status\n");
> +	seq_puts(m, "SDTR status\n");
>  	for (id = 0; id < ARRAY_SIZE(data->target); id++) {
>  
>  		seq_printf(m, "id %d: ", id);
>  
>  		if (id == host->this_id) {
> -			seq_printf(m, "----- NinjaSCSI-32 host adapter\n");
> +			seq_puts(m, "----- NinjaSCSI-32 host adapter\n");
>  			continue;
>  		}
>  
>  		if (data->target[id].sync_flag == SDTR_DONE) {
>  			if (data->target[id].period == 0            &&
>  			    data->target[id].offset == ASYNC_OFFSET ) {
> -				seq_printf(m, "async");
> +				seq_puts(m, "async");
>  			} else {
> -				seq_printf(m, " sync");
> +				seq_puts(m, " sync");
>  			}
>  		} else {
> -			seq_printf(m, " none");
> +			seq_puts(m, " none");
>  		}
>  
>  		if (data->target[id].period != 0) {
> @@ -1509,7 +1509,7 @@ static int nsp32_show_info(struct seq_file *m, struct Scsi_Host *host)
>  				data->target[id].offset
>  				);
>  		}
> -		seq_printf(m, "\n");
> +		seq_puts(m, "\n");
>  	}
>  	return 0;
>  }
> diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
> index 83db942..bf883a6 100644
> --- a/drivers/scsi/pcmcia/nsp_cs.c
> +++ b/drivers/scsi/pcmcia/nsp_cs.c
> @@ -1375,58 +1375,58 @@ static int nsp_show_info(struct seq_file *m, struct Scsi_Host *host)
>  	hostno = host->host_no;
>  	data = (nsp_hw_data *)host->hostdata;
>  
> -	seq_printf(m, "NinjaSCSI status\n\n");
> -	seq_printf(m, "Driver version:        $Revision: 1.23 $\n");
> +	seq_puts(m, "NinjaSCSI status\n\n");
> +	seq_puts(m, "Driver version:        $Revision: 1.23 $\n");
>  	seq_printf(m, "SCSI host No.:         %d\n",          hostno);
>  	seq_printf(m, "IRQ:                   %d\n",          host->irq);
>  	seq_printf(m, "IO:                    0x%lx-0x%lx\n", host->io_port, host->io_port + host->n_io_port - 1);
>  	seq_printf(m, "MMIO(virtual address): 0x%lx-0x%lx\n", host->base, host->base + data->MmioLength - 1);
>  	seq_printf(m, "sg_tablesize:          %d\n",          host->sg_tablesize);
>  
> -	seq_printf(m, "burst transfer mode:   ");
> +	seq_puts(m, "burst transfer mode:   ");
>  	switch (nsp_burst_mode) {
>  	case BURST_IO8:
> -		seq_printf(m, "io8");
> +		seq_puts(m, "io8");
>  		break;
>  	case BURST_IO32:
> -		seq_printf(m, "io32");
> +		seq_puts(m, "io32");
>  		break;
>  	case BURST_MEM32:
> -		seq_printf(m, "mem32");
> +		seq_puts(m, "mem32");
>  		break;
>  	default:
> -		seq_printf(m, "???");
> +		seq_puts(m, "???");
>  		break;
>  	}
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  
>  
>  	spin_lock_irqsave(&(data->Lock), flags);
>  	seq_printf(m, "CurrentSC:             0x%p\n\n",      data->CurrentSC);
>  	spin_unlock_irqrestore(&(data->Lock), flags);
>  
> -	seq_printf(m, "SDTR status\n");
> +	seq_puts(m, "SDTR status\n");
>  	for(id = 0; id < ARRAY_SIZE(data->Sync); id++) {
>  
>  		seq_printf(m, "id %d: ", id);
>  
>  		if (id == host->this_id) {
> -			seq_printf(m, "----- NinjaSCSI-3 host adapter\n");
> +			seq_puts(m, "----- NinjaSCSI-3 host adapter\n");
>  			continue;
>  		}
>  
>  		switch(data->Sync[id].SyncNegotiation) {
>  		case SYNC_OK:
> -			seq_printf(m, " sync");
> +			seq_puts(m, " sync");
>  			break;
>  		case SYNC_NG:
> -			seq_printf(m, "async");
> +			seq_puts(m, "async");
>  			break;
>  		case SYNC_NOT_YET:
> -			seq_printf(m, " none");
> +			seq_puts(m, " none");
>  			break;
>  		default:
> -			seq_printf(m, "?????");
> +			seq_puts(m, "?????");
>  			break;
>  		}
>  
> @@ -1439,7 +1439,7 @@ static int nsp_show_info(struct seq_file *m, struct Scsi_Host *host)
>  				data->Sync[id].SyncOffset
>  				);
>  		}
> -		seq_printf(m, "\n");
> +		seq_puts(m, "\n");
>  	}
>  	return 0;
>  }
> diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c
> index 2ca39b8..c837ba3 100644
> --- a/drivers/scsi/qla2xxx/qla_dfs.c
> +++ b/drivers/scsi/qla2xxx/qla_dfs.c
> @@ -23,10 +23,10 @@ qla2x00_dfs_fce_show(struct seq_file *s, void *unused)
>  
>  	mutex_lock(&ha->fce_mutex);
>  
> -	seq_printf(s, "FCE Trace Buffer\n");
> +	seq_puts(s, "FCE Trace Buffer\n");
>  	seq_printf(s, "In Pointer = %llx\n\n", (unsigned long long)ha->fce_wr);
>  	seq_printf(s, "Base = %llx\n\n", (unsigned long long) ha->fce_dma);
> -	seq_printf(s, "FCE Enable Registers\n");
> +	seq_puts(s, "FCE Enable Registers\n");
>  	seq_printf(s, "%08x %08x %08x %08x %08x %08x\n",
>  	    ha->fce_mb[0], ha->fce_mb[2], ha->fce_mb[3], ha->fce_mb[4],
>  	    ha->fce_mb[5], ha->fce_mb[6]);
> @@ -38,11 +38,11 @@ qla2x00_dfs_fce_show(struct seq_file *s, void *unused)
>  			seq_printf(s, "\n%llx: ",
>  			    (unsigned long long)((cnt * 4) + fce_start));
>  		else
> -			seq_printf(s, " ");
> +			seq_puts(s, " ");
>  		seq_printf(s, "%08x", *fce++);
>  	}
>  
> -	seq_printf(s, "\nEnd\n");
> +	seq_puts(s, "\nEnd\n");
>  
>  	mutex_unlock(&ha->fce_mutex);
>  
> diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c
> index 6fcefa2..581de8f 100644
> --- a/drivers/scsi/scsi_proc.c
> +++ b/drivers/scsi/scsi_proc.c
> @@ -189,36 +189,36 @@ static int proc_print_scsidevice(struct device *dev, void *data)
>  		sdev->host->host_no, sdev->channel, sdev->id, sdev->lun);
>  	for (i = 0; i < 8; i++) {
>  		if (sdev->vendor[i] >= 0x20)
> -			seq_printf(s, "%c", sdev->vendor[i]);
> +			seq_putc(s, sdev->vendor[i]);
>  		else
> -			seq_printf(s, " ");
> +			seq_puts(s, " ");
>  	}
>  
> -	seq_printf(s, " Model: ");
> +	seq_puts(s, " Model: ");
>  	for (i = 0; i < 16; i++) {
>  		if (sdev->model[i] >= 0x20)
> -			seq_printf(s, "%c", sdev->model[i]);
> +			seq_putc(s, sdev->model[i]);
>  		else
> -			seq_printf(s, " ");
> +			seq_puts(s, " ");
>  	}
>  
> -	seq_printf(s, " Rev: ");
> +	seq_puts(s, " Rev: ");
>  	for (i = 0; i < 4; i++) {
>  		if (sdev->rev[i] >= 0x20)
> -			seq_printf(s, "%c", sdev->rev[i]);
> +			seq_putc(s, sdev->rev[i]);
>  		else
> -			seq_printf(s, " ");
> +			seq_puts(s, " ");
>  	}
>  
> -	seq_printf(s, "\n");
> +	seq_puts(s, "\n");
>  
>  	seq_printf(s, "  Type:   %s ", scsi_device_type(sdev->type));
>  	seq_printf(s, "               ANSI  SCSI revision: %02x",
>  			sdev->scsi_level - (sdev->scsi_level > 1));
>  	if (sdev->scsi_level == 2)
> -		seq_printf(s, " CCS\n");
> +		seq_puts(s, " CCS\n");
>  	else
> -		seq_printf(s, "\n");
> +		seq_puts(s, "\n");
>  
>  out:
>  	return 0;
> diff --git a/drivers/scsi/scsi_trace.c b/drivers/scsi/scsi_trace.c
> index 503594e..e4e122b 100644
> --- a/drivers/scsi/scsi_trace.c
> +++ b/drivers/scsi/scsi_trace.c
> @@ -143,7 +143,7 @@ scsi_trace_rw32(struct trace_seq *p, unsigned char *cdb, int len)
>  		cmd = "WRITE_SAME";
>  		break;
>  	default:
> -		trace_seq_printf(p, "UNKNOWN");
> +		trace_seq_puts(p, "UNKNOWN");
>  		goto out;
>  	}
>  
> @@ -204,7 +204,7 @@ scsi_trace_service_action_in(struct trace_seq *p, unsigned char *cdb, int len)
>  		cmd = "GET_LBA_STATUS";
>  		break;
>  	default:
> -		trace_seq_printf(p, "UNKNOWN");
> +		trace_seq_puts(p, "UNKNOWN");
>  		goto out;
>  	}
>  
> @@ -249,7 +249,7 @@ scsi_trace_misc(struct trace_seq *p, unsigned char *cdb, int len)
>  {
>  	const char *ret = trace_seq_buffer_ptr(p);
>  
> -	trace_seq_printf(p, "-");
> +	trace_seq_puts(p, "-");
>  	trace_seq_putc(p, 0);
>  
>  	return ret;
> diff --git a/drivers/scsi/wd33c93.c b/drivers/scsi/wd33c93.c
> index c0506de..6e041a7 100644
> --- a/drivers/scsi/wd33c93.c
> +++ b/drivers/scsi/wd33c93.c
> @@ -2143,22 +2143,22 @@ wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance)
>  		seq_printf(m, "\nclock_freq=%02x no_sync=%02x no_dma=%d"
>  			" dma_mode=%02x fast=%d",
>  			hd->clock_freq, hd->no_sync, hd->no_dma, hd->dma_mode, hd->fast);
> -		seq_printf(m, "\nsync_xfer[] =       ");
> +		seq_puts(m, "\nsync_xfer[] =       ");
>  		for (x = 0; x < 7; x++)
>  			seq_printf(m, "\t%02x", hd->sync_xfer[x]);
> -		seq_printf(m, "\nsync_stat[] =       ");
> +		seq_puts(m, "\nsync_stat[] =       ");
>  		for (x = 0; x < 7; x++)
>  			seq_printf(m, "\t%02x", hd->sync_stat[x]);
>  	}
>  #ifdef PROC_STATISTICS
>  	if (hd->proc & PR_STATISTICS) {
> -		seq_printf(m, "\ncommands issued:    ");
> +		seq_puts(m, "\ncommands issued:    ");
>  		for (x = 0; x < 7; x++)
>  			seq_printf(m, "\t%ld", hd->cmd_cnt[x]);
> -		seq_printf(m, "\ndisconnects allowed:");
> +		seq_puts(m, "\ndisconnects allowed:");
>  		for (x = 0; x < 7; x++)
>  			seq_printf(m, "\t%ld", hd->disc_allowed_cnt[x]);
> -		seq_printf(m, "\ndisconnects done:   ");
> +		seq_puts(m, "\ndisconnects done:   ");
>  		for (x = 0; x < 7; x++)
>  			seq_printf(m, "\t%ld", hd->disc_done_cnt[x]);
>  		seq_printf(m,
> @@ -2167,7 +2167,7 @@ wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance)
>  	}
>  #endif
>  	if (hd->proc & PR_CONNECTED) {
> -		seq_printf(m, "\nconnected:     ");
> +		seq_puts(m, "\nconnected:     ");
>  		if (hd->connected) {
>  			cmd = (struct scsi_cmnd *) hd->connected;
>  			seq_printf(m, " %d:%llu(%02x)",
> @@ -2175,7 +2175,7 @@ wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance)
>  		}
>  	}
>  	if (hd->proc & PR_INPUTQ) {
> -		seq_printf(m, "\ninput_Q:       ");
> +		seq_puts(m, "\ninput_Q:       ");
>  		cmd = (struct scsi_cmnd *) hd->input_Q;
>  		while (cmd) {
>  			seq_printf(m, " %d:%llu(%02x)",
> @@ -2184,7 +2184,7 @@ wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance)
>  		}
>  	}
>  	if (hd->proc & PR_DISCQ) {
> -		seq_printf(m, "\ndisconnected_Q:");
> +		seq_puts(m, "\ndisconnected_Q:");
>  		cmd = (struct scsi_cmnd *) hd->disconnected_Q;
>  		while (cmd) {
>  			seq_printf(m, " %d:%llu(%02x)",
> @@ -2192,7 +2192,7 @@ wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance)
>  			cmd = (struct scsi_cmnd *) cmd->host_scribble;
>  		}
>  	}
> -	seq_printf(m, "\n");
> +	seq_puts(m, "\n");
>  	spin_unlock_irq(&hd->lock);
>  #endif				/* PROC_INTERFACE */
>  	return 0;
> diff --git a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c
> index 2d7c62f..0c0f17b 100644
> --- a/drivers/scsi/wd7000.c
> +++ b/drivers/scsi/wd7000.c
> @@ -1330,9 +1330,9 @@ static int wd7000_show_info(struct seq_file *m, struct Scsi_Host *host)
>  	icmbs = adapter->mb.icmb;
>  
>  	seq_printf(m, "\nControl port value: 0x%x\n", adapter->control);
> -	seq_printf(m, "Incoming mailbox:\n");
> +	seq_puts(m, "Incoming mailbox:\n");
>  	seq_printf(m, "  size: %d\n", ICMB_CNT);
> -	seq_printf(m, "  queued messages: ");
> +	seq_puts(m, "  queued messages: ");
>  
>  	for (i = count = 0; i < ICMB_CNT; i++)
>  		if (icmbs[i].status) {
> @@ -1340,12 +1340,12 @@ static int wd7000_show_info(struct seq_file *m, struct Scsi_Host *host)
>  			seq_printf(m, "0x%x ", i);
>  		}
>  
> -	seq_printf(m, count ? "\n" : "none\n");
> +	seq_puts(m, count ? "\n" : "none\n");
>  
> -	seq_printf(m, "Outgoing mailbox:\n");
> +	seq_puts(m, "Outgoing mailbox:\n");
>  	seq_printf(m, "  size: %d\n", OGMB_CNT);
>  	seq_printf(m, "  next message: 0x%x\n", adapter->next_ogmb);
> -	seq_printf(m, "  queued messages: ");
> +	seq_puts(m, "  queued messages: ");
>  
>  	for (i = count = 0; i < OGMB_CNT; i++)
>  		if (ogmbs[i].status) {
> @@ -1353,7 +1353,7 @@ static int wd7000_show_info(struct seq_file *m, struct Scsi_Host *host)
>  			seq_printf(m, "0x%x ", i);
>  		}
>  
> -	seq_printf(m, count ? "\n" : "none\n");
> +	seq_puts(m, count ? "\n" : "none\n");
>  #endif
>  
>  	spin_unlock_irqrestore(host->host_lock, flags);
> 

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

* Re: [PATCH v2 5/6] scsi: misc: Merge consecutive seq_puts calls
  2014-12-02 23:10   ` [PATCH v2 5/6] scsi: misc: Merge consecutive seq_puts calls Rasmus Villemoes
@ 2015-01-30  1:42     ` Finn Thain
  0 siblings, 0 replies; 26+ messages in thread
From: Finn Thain @ 2015-01-30  1:42 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: James E.J. Bottomley, linux-scsi, linux-kernel


Reviewed-by: Finn Thain <fthain@telegraphics.com.au>


On Wed, 3 Dec 2014, Rasmus Villemoes wrote:

> Consecutive seq_puts calls with literal strings may be replaced by a
> single call, saving a little .text.
> 
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> ---
>  drivers/scsi/advansys.c      | 43 +++++++++++++++----------------------------
>  drivers/scsi/atp870u.c       |  5 ++---
>  drivers/scsi/dc395x.c        |  4 ++--
>  drivers/scsi/pcmcia/nsp_cs.c |  4 ++--
>  4 files changed, 21 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
> index d31fc6d..c4d0910 100644
> --- a/drivers/scsi/advansys.c
> +++ b/drivers/scsi/advansys.c
> @@ -2903,11 +2903,9 @@ static void asc_prt_adv_bios(struct seq_file *m, struct Scsi_Host *shost)
>  	 * the BIOS code segment base address.
>  	 */
>  	if (boardp->bios_signature != 0x55AA) {
> -		seq_puts(m, "Disabled or Pre-3.1\n");
> -		seq_puts(m,
> -			 "BIOS either disabled or Pre-3.1. If it is pre-3.1, then a newer version\n");
> -		seq_puts(m,
> -			 "can be found at the ConnectCom FTP site: ftp://ftp.connectcom.net/pub\n");
> +		seq_puts(m, "Disabled or Pre-3.1\n"
> +			"BIOS either disabled or Pre-3.1. If it is pre-3.1, then a newer version\n"
> +			"can be found at the ConnectCom FTP site: ftp://ftp.connectcom.net/pub\n");
>  	} else {
>  		major = (boardp->bios_version >> 12) & 0xF;
>  		minor = (boardp->bios_version >> 8) & 0xF;
> @@ -2923,9 +2921,8 @@ static void asc_prt_adv_bios(struct seq_file *m, struct Scsi_Host *shost)
>  		 */
>  		if (major < 3 || (major <= 3 && minor < 1) ||
>  		    (major <= 3 && minor <= 1 && letter < ('I' - 'A'))) {
> -			seq_puts(m,
> -				 "Newer version of ROM BIOS is available at the ConnectCom FTP site:\n");
> -			seq_puts(m, "ftp://ftp.connectcom.net/pub\n");
> +			seq_puts(m, "Newer version of ROM BIOS is available at the ConnectCom FTP site:\n"
> +				"ftp://ftp.connectcom.net/pub\n");
>  		}
>  	}
>  }
> @@ -3071,27 +3068,23 @@ static void asc_prt_asc_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
>  	seq_puts(m, " Target ID:           ");
>  	for (i = 0; i <= ASC_MAX_TID; i++)
>  		seq_printf(m, " %d", i);
> -	seq_puts(m, "\n");
>  
> -	seq_puts(m, " Disconnects:         ");
> +	seq_puts(m, "\n Disconnects:         ");
>  	for (i = 0; i <= ASC_MAX_TID; i++)
>  		seq_printf(m, " %c",
>  			   (ep->disc_enable & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
> -	seq_puts(m, "\n");
>  
> -	seq_puts(m, " Command Queuing:     ");
> +	seq_puts(m, "\n Command Queuing:     ");
>  	for (i = 0; i <= ASC_MAX_TID; i++)
>  		seq_printf(m, " %c",
>  			   (ep->use_cmd_qng & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
> -	seq_puts(m, "\n");
>  
> -	seq_puts(m, " Start Motor:         ");
> +	seq_puts(m, "\n Start Motor:         ");
>  	for (i = 0; i <= ASC_MAX_TID; i++)
>  		seq_printf(m, " %c",
>  			   (ep->start_motor & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
> -	seq_puts(m, "\n");
>  
> -	seq_puts(m, " Synchronous Transfer:");
> +	seq_puts(m, "\n Synchronous Transfer:");
>  	for (i = 0; i <= ASC_MAX_TID; i++)
>  		seq_printf(m, " %c",
>  			   (ep->init_sdtr & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
> @@ -3410,10 +3403,9 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  			   i,
>  			   (v->use_tagged_qng & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
>  	}
> -	seq_puts(m, "\n");
>  
>  	/* Current number of commands waiting for a device. */
> -	seq_puts(m, " Command Queue Pending:");
> +	seq_puts(m, "\n Command Queue Pending:");
>  	for (i = 0; i <= ASC_MAX_TID; i++) {
>  		if ((chip_scsi_id == i) ||
>  		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
> @@ -3421,10 +3413,9 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  		}
>  		seq_printf(m, " %X:%u", i, v->cur_dvc_qng[i]);
>  	}
> -	seq_puts(m, "\n");
>  
>  	/* Current limit on number of commands that can be sent to a device. */
> -	seq_puts(m, " Command Queue Limit:");
> +	seq_puts(m, "\n Command Queue Limit:");
>  	for (i = 0; i <= ASC_MAX_TID; i++) {
>  		if ((chip_scsi_id == i) ||
>  		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
> @@ -3432,10 +3423,9 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  		}
>  		seq_printf(m, " %X:%u", i, v->max_dvc_qng[i]);
>  	}
> -	seq_puts(m, "\n");
>  
>  	/* Indicate whether the device has returned queue full status. */
> -	seq_puts(m, " Command Queue Full:");
> +	seq_puts(m, "\n Command Queue Full:");
>  	for (i = 0; i <= ASC_MAX_TID; i++) {
>  		if ((chip_scsi_id == i) ||
>  		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
> @@ -3447,9 +3437,8 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  		else
>  			seq_printf(m, " %X:N", i);
>  	}
> -	seq_puts(m, "\n");
>  
> -	seq_puts(m, " Synchronous Transfer:");
> +	seq_puts(m, "\n Synchronous Transfer:");
>  	for (i = 0; i <= ASC_MAX_TID; i++) {
>  		if ((chip_scsi_id == i) ||
>  		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
> @@ -3555,9 +3544,8 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  			   i,
>  			   (tagqng_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
>  	}
> -	seq_puts(m, "\n");
>  
> -	seq_puts(m, " Queue Limit:");
> +	seq_puts(m, "\n Queue Limit:");
>  	for (i = 0; i <= ADV_MAX_TID; i++) {
>  		if ((chip_scsi_id == i) ||
>  		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
> @@ -3569,9 +3557,8 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  
>  		seq_printf(m, " %X:%d", i, lrambyte);
>  	}
> -	seq_puts(m, "\n");
>  
> -	seq_puts(m, " Command Pending:");
> +	seq_puts(m, "\n Command Pending:");
>  	for (i = 0; i <= ADV_MAX_TID; i++) {
>  		if ((chip_scsi_id == i) ||
>  		    ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
> diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c
> index 0b02467..0836433 100644
> --- a/drivers/scsi/atp870u.c
> +++ b/drivers/scsi/atp870u.c
> @@ -3101,9 +3101,8 @@ static const char *atp870u_info(struct Scsi_Host *notused)
>  
>  static int atp870u_show_info(struct seq_file *m, struct Scsi_Host *HBAptr)
>  {
> -	seq_puts(m, "ACARD AEC-671X Driver Version: 2.6+ac\n");
> -	seq_puts(m, "\n");
> -	seq_puts(m, "Adapter Configuration:\n");
> +	seq_puts(m, "ACARD AEC-671X Driver Version: 2.6+ac\n\n"
> +		"Adapter Configuration:\n");
>  	seq_printf(m, "               Base IO: %#.4lx\n", HBAptr->io_port);
>  	seq_printf(m, "                   IRQ: %d\n", HBAptr->irq);
>  	return 0;
> diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
> index 3a55ea2..48c79f9 100644
> --- a/drivers/scsi/dc395x.c
> +++ b/drivers/scsi/dc395x.c
> @@ -4623,8 +4623,8 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
>  	unsigned long flags;
>  	int dev;
>  
> -	seq_puts(m, DC395X_BANNER " PCI SCSI Host Adapter\n");
> -	seq_puts(m, " Driver Version " DC395X_VERSION "\n");
> +	seq_puts(m, DC395X_BANNER " PCI SCSI Host Adapter\n"
> +		" Driver Version " DC395X_VERSION "\n");
>  
>  	DC395x_LOCK_IO(acb->scsi_host, flags);
>  
> diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
> index bf883a6..acf558a 100644
> --- a/drivers/scsi/pcmcia/nsp_cs.c
> +++ b/drivers/scsi/pcmcia/nsp_cs.c
> @@ -1375,8 +1375,8 @@ static int nsp_show_info(struct seq_file *m, struct Scsi_Host *host)
>  	hostno = host->host_no;
>  	data = (nsp_hw_data *)host->hostdata;
>  
> -	seq_puts(m, "NinjaSCSI status\n\n");
> -	seq_puts(m, "Driver version:        $Revision: 1.23 $\n");
> +	seq_puts(m, "NinjaSCSI status\n\n"
> +		"Driver version:        $Revision: 1.23 $\n");
>  	seq_printf(m, "SCSI host No.:         %d\n",          hostno);
>  	seq_printf(m, "IRQ:                   %d\n",          host->irq);
>  	seq_printf(m, "IO:                    0x%lx-0x%lx\n", host->io_port, host->io_port + host->n_io_port - 1);
> 

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

* Re: [PATCH v2 6/6] scsi: misc: Print single-character strings with seq_putc
  2014-12-02 23:10   ` [PATCH v2 6/6] scsi: misc: Print single-character strings with seq_putc Rasmus Villemoes
@ 2015-01-30  1:44     ` Finn Thain
  0 siblings, 0 replies; 26+ messages in thread
From: Finn Thain @ 2015-01-30  1:44 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: James E.J. Bottomley, linux-scsi, linux-kernel


Reviewed-by: Finn Thain <fthain@telegraphics.com.au>

For the NCR5380 bits:

Acked-by: Finn Thain <fthain@telegraphics.com.au>


On Wed, 3 Dec 2014, Rasmus Villemoes wrote:

> Using seq_putc to print a single character saves at least a strlen()
> call and a memory access, and may also give a small .text reduction.
> 
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> ---
>  drivers/scsi/NCR5380.c              |  2 +-
>  drivers/scsi/advansys.c             | 34 +++++++++++++++++-----------------
>  drivers/scsi/aic7xxx/aic79xx_proc.c | 10 +++++-----
>  drivers/scsi/aic7xxx/aic7xxx_proc.c | 10 +++++-----
>  drivers/scsi/atari_NCR5380.c        |  2 +-
>  drivers/scsi/dc395x.c               |  4 ++--
>  drivers/scsi/esas2r/esas2r_main.c   |  2 +-
>  drivers/scsi/in2000.c               |  2 +-
>  drivers/scsi/ips.c                  |  2 +-
>  drivers/scsi/nsp32.c                |  2 +-
>  drivers/scsi/pcmcia/nsp_cs.c        |  4 ++--
>  drivers/scsi/qla2xxx/qla_dfs.c      |  2 +-
>  drivers/scsi/scsi_proc.c            | 10 +++++-----
>  drivers/scsi/scsi_trace.c           |  2 +-
>  drivers/scsi/wd33c93.c              |  2 +-
>  15 files changed, 45 insertions(+), 45 deletions(-)
> 
> diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
> index a30af00..8981701 100644
> --- a/drivers/scsi/NCR5380.c
> +++ b/drivers/scsi/NCR5380.c
> @@ -764,7 +764,7 @@ static void lprint_command(unsigned char *command, struct seq_file *m)
>  	lprint_opcode(command[0], m);
>  	for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i)
>  		seq_printf(m, "%02x ", command[i]);
> -	seq_puts(m, "\n");
> +	seq_putc(m, '\n');
>  }
>  
>  static void lprint_opcode(int opcode, struct seq_file *m)
> diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
> index c4d0910..81ffb0f 100644
> --- a/drivers/scsi/advansys.c
> +++ b/drivers/scsi/advansys.c
> @@ -3088,7 +3088,7 @@ static void asc_prt_asc_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
>  	for (i = 0; i <= ASC_MAX_TID; i++)
>  		seq_printf(m, " %c",
>  			   (ep->init_sdtr & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
> -	seq_puts(m, "\n");
> +	seq_putc(m, '\n');
>  
>  #ifdef CONFIG_ISA
>  	if (asc_dvc_varp->bus_type & ASC_IS_ISA) {
> @@ -3203,7 +3203,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
>  	seq_puts(m, " Target ID:           ");
>  	for (i = 0; i <= ADV_MAX_TID; i++)
>  		seq_printf(m, " %X", i);
> -	seq_puts(m, "\n");
> +	seq_putc(m, '\n');
>  
>  	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
>  		word = ep_3550->disc_enable;
> @@ -3216,7 +3216,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
>  	for (i = 0; i <= ADV_MAX_TID; i++)
>  		seq_printf(m, " %c",
>  			   (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
> -	seq_puts(m, "\n");
> +	seq_putc(m, '\n');
>  
>  	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
>  		word = ep_3550->tagqng_able;
> @@ -3229,7 +3229,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
>  	for (i = 0; i <= ADV_MAX_TID; i++)
>  		seq_printf(m, " %c",
>  			   (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
> -	seq_puts(m, "\n");
> +	seq_putc(m, '\n');
>  
>  	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
>  		word = ep_3550->start_motor;
> @@ -3242,7 +3242,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
>  	for (i = 0; i <= ADV_MAX_TID; i++)
>  		seq_printf(m, " %c",
>  			   (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
> -	seq_puts(m, "\n");
> +	seq_putc(m, '\n');
>  
>  	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
>  		seq_puts(m, " Synchronous Transfer:");
> @@ -3250,7 +3250,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
>  			seq_printf(m, " %c",
>  				   (ep_3550->sdtr_able & ADV_TID_TO_TIDMASK(i)) ?
>  				   'Y' : 'N');
> -		seq_puts(m, "\n");
> +		seq_putc(m, '\n');
>  	}
>  
>  	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
> @@ -3259,7 +3259,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
>  			seq_printf(m, " %c",
>  				   (ep_3550->ultra_able & ADV_TID_TO_TIDMASK(i))
>  				   ? 'Y' : 'N');
> -		seq_puts(m, "\n");
> +		seq_putc(m, '\n');
>  	}
>  
>  	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
> @@ -3273,7 +3273,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
>  	for (i = 0; i <= ADV_MAX_TID; i++)
>  		seq_printf(m, " %c",
>  			   (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
> -	seq_puts(m, "\n");
> +	seq_putc(m, '\n');
>  
>  	if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800 ||
>  	    adv_dvc_varp->chip_type == ADV_CHIP_ASC38C1600) {
> @@ -3318,7 +3318,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost
>  				seq_puts(m, "\n  ");
>  			sdtr_speed >>= 4;
>  		}
> -		seq_puts(m, "\n");
> +		seq_putc(m, '\n');
>  	}
>  }
>  
> @@ -3448,7 +3448,7 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  			   i,
>  			   (v->sdtr_done & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
>  	}
> -	seq_puts(m, "\n");
> +	seq_putc(m, '\n');
>  
>  	for (i = 0; i <= ASC_MAX_TID; i++) {
>  		uchar syn_period_ix;
> @@ -3483,7 +3483,7 @@ static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  			seq_puts(m, "*\n");
>  			renegotiate = 1;
>  		} else {
> -			seq_puts(m, "\n");
> +			seq_putc(m, '\n');
>  		}
>  	}
>  
> @@ -3570,7 +3570,7 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  
>  		seq_printf(m, " %X:%d", i, lrambyte);
>  	}
> -	seq_puts(m, "\n");
> +	seq_putc(m, '\n');
>  
>  	AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able);
>  	seq_puts(m, " Wide Enabled:");
> @@ -3584,7 +3584,7 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  			   i,
>  			   (wdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
>  	}
> -	seq_puts(m, "\n");
> +	seq_putc(m, '\n');
>  
>  	AdvReadWordLram(iop_base, ASC_MC_WDTR_DONE, wdtr_done);
>  	seq_puts(m, " Transfer Bit Width:");
> @@ -3603,11 +3603,11 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  
>  		if ((wdtr_able & ADV_TID_TO_TIDMASK(i)) &&
>  		    (wdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) {
> -			seq_puts(m, "*");
> +			seq_putc(m, '*');
>  			renegotiate = 1;
>  		}
>  	}
> -	seq_puts(m, "\n");
> +	seq_putc(m, '\n');
>  
>  	AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able);
>  	seq_puts(m, " Synchronous Enabled:");
> @@ -3621,7 +3621,7 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  			   i,
>  			   (sdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
>  	}
> -	seq_puts(m, "\n");
> +	seq_putc(m, '\n');
>  
>  	AdvReadWordLram(iop_base, ASC_MC_SDTR_DONE, sdtr_done);
>  	for (i = 0; i <= ADV_MAX_TID; i++) {
> @@ -3670,7 +3670,7 @@ static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost)
>  			seq_puts(m, "*\n");
>  			renegotiate = 1;
>  		} else {
> -			seq_puts(m, "\n");
> +			seq_putc(m, '\n');
>  		}
>  	}
>  
> diff --git a/drivers/scsi/aic7xxx/aic79xx_proc.c b/drivers/scsi/aic7xxx/aic79xx_proc.c
> index e095598..add2da5 100644
> --- a/drivers/scsi/aic7xxx/aic79xx_proc.c
> +++ b/drivers/scsi/aic7xxx/aic79xx_proc.c
> @@ -148,9 +148,9 @@ ahd_format_transinfo(struct seq_file *m, struct ahd_transinfo *tinfo)
>  		}
>  		seq_printf(m, "%dbit)", 8 * (0x01 << tinfo->width));
>  	} else if (freq != 0) {
> -		seq_puts(m, ")");
> +		seq_putc(m, ')');
>  	}
> -	seq_puts(m, "\n");
> +	seq_putc(m, '\n');
>  }
>  
>  static void
> @@ -294,14 +294,14 @@ ahd_linux_show_info(struct seq_file *m, struct Scsi_Host *shost)
>  		seq_puts(m, "Serial EEPROM:\n");
>  		for (i = 0; i < sizeof(*ahd->seep_config)/2; i++) {
>  			if (((i % 8) == 0) && (i != 0)) {
> -				seq_puts(m, "\n");
> +				seq_putc(m, '\n');
>  			}
>  			seq_printf(m, "0x%.4x ",
>  				  ((uint16_t*)ahd->seep_config)[i]);
>  		}
> -		seq_puts(m, "\n");
> +		seq_putc(m, '\n');
>  	}
> -	seq_puts(m, "\n");
> +	seq_putc(m, '\n');
>  
>  	if ((ahd->features & AHD_WIDE) == 0)
>  		max_targ = 8;
> diff --git a/drivers/scsi/aic7xxx/aic7xxx_proc.c b/drivers/scsi/aic7xxx/aic7xxx_proc.c
> index 25511ca..1845960 100644
> --- a/drivers/scsi/aic7xxx/aic7xxx_proc.c
> +++ b/drivers/scsi/aic7xxx/aic7xxx_proc.c
> @@ -125,9 +125,9 @@ ahc_format_transinfo(struct seq_file *m, struct ahc_transinfo *tinfo)
>  		}
>  		seq_printf(m, "%dbit)", 8 * (0x01 << tinfo->width));
>  	} else if (freq != 0) {
> -		seq_puts(m, ")");
> +		seq_putc(m, ')');
>  	}
> -	seq_puts(m, "\n");
> +	seq_putc(m, '\n');
>  }
>  
>  static void
> @@ -308,14 +308,14 @@ ahc_linux_show_info(struct seq_file *m, struct Scsi_Host *shost)
>  		seq_puts(m, "Serial EEPROM:\n");
>  		for (i = 0; i < sizeof(*ahc->seep_config)/2; i++) {
>  			if (((i % 8) == 0) && (i != 0)) {
> -				seq_puts(m, "\n");
> +				seq_putc(m, '\n');
>  			}
>  			seq_printf(m, "0x%.4x ",
>  				  ((uint16_t*)ahc->seep_config)[i]);
>  		}
> -		seq_puts(m, "\n");
> +		seq_putc(m, '\n');
>  	}
> -	seq_puts(m, "\n");
> +	seq_putc(m, '\n');
>  
>  	max_targ = 16;
>  	if ((ahc->features & (AHC_WIDE|AHC_TWIN)) == 0)
> diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
> index 04d0c6e..a702554 100644
> --- a/drivers/scsi/atari_NCR5380.c
> +++ b/drivers/scsi/atari_NCR5380.c
> @@ -716,7 +716,7 @@ static void show_Scsi_Cmnd(struct scsi_cmnd *cmd, struct seq_file *m)
>  	seq_printf(m, "%2d (0x%02x)", command[0], command[0]);
>  	for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i)
>  		seq_printf(m, " %02x", command[i]);
> -	seq_puts(m, "\n");
> +	seq_putc(m, '\n');
>  }
>  
>  static int __maybe_unused NCR5380_show_info(struct seq_file *m,
> diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
> index 48c79f9..5ee7f44 100644
> --- a/drivers/scsi/dc395x.c
> +++ b/drivers/scsi/dc395x.c
> @@ -4692,7 +4692,7 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
>  	if (timer_pending(&acb->waiting_timer))
>  		seq_puts(m, "Waiting queue timer running\n");
>  	else
> -		seq_puts(m, "\n");
> +		seq_putc(m, '\n');
>  
>  	list_for_each_entry(dcb, &acb->dcb_list, list) {
>  		struct ScsiReqBlk *srb;
> @@ -4709,7 +4709,7 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host)
>  		list_for_each_entry(srb, &dcb->srb_going_list, list)
>  			seq_printf(m, " %p", srb->cmd);
>  		if (!list_empty(&dcb->srb_waiting_list) || !list_empty(&dcb->srb_going_list))
> -			seq_puts(m, "\n");
> +			seq_putc(m, '\n');
>  	}
>  
>  	if (debug_enabled(DBG_1)) {
> diff --git a/drivers/scsi/esas2r/esas2r_main.c b/drivers/scsi/esas2r/esas2r_main.c
> index 593ff8a..226c280 100644
> --- a/drivers/scsi/esas2r/esas2r_main.c
> +++ b/drivers/scsi/esas2r/esas2r_main.c
> @@ -750,7 +750,7 @@ int esas2r_show_info(struct seq_file *m, struct Scsi_Host *sh)
>  	if (dev_count == 0)
>  		seq_puts(m, "none\n");
>  
> -	seq_puts(m, "\n");
> +	seq_putc(m, '\n');
>  	return 0;
>  
>  }
> diff --git a/drivers/scsi/in2000.c b/drivers/scsi/in2000.c
> index a73395e..3882d9f 100644
> --- a/drivers/scsi/in2000.c
> +++ b/drivers/scsi/in2000.c
> @@ -2273,7 +2273,7 @@ static int in2000_show_info(struct seq_file *m, struct Scsi_Host *instance)
>  	if (hd->proc & PR_TEST) {
>  		;		/* insert your own custom function here */
>  	}
> -	seq_puts(m, "\n");
> +	seq_putc(m, '\n');
>  	spin_unlock_irqrestore(instance->host_lock, flags);
>  #endif				/* PROC_INTERFACE */
>  	return 0;
> diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
> index 615a9a3..7542f11 100644
> --- a/drivers/scsi/ips.c
> +++ b/drivers/scsi/ips.c
> @@ -2137,7 +2137,7 @@ ips_host_info(ips_ha_t *ha, struct seq_file *m)
>  	seq_printf(m, "\tCurrent Active PT Commands        : %d\n",
>  		  ha->num_ioctl);
>  
> -	seq_puts(m, "\n");
> +	seq_putc(m, '\n');
>  
>  	return 0;
>  }
> diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
> index 8f6b1b4..c6077ce 100644
> --- a/drivers/scsi/nsp32.c
> +++ b/drivers/scsi/nsp32.c
> @@ -1509,7 +1509,7 @@ static int nsp32_show_info(struct seq_file *m, struct Scsi_Host *host)
>  				data->target[id].offset
>  				);
>  		}
> -		seq_puts(m, "\n");
> +		seq_putc(m, '\n');
>  	}
>  	return 0;
>  }
> diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
> index acf558a..1b6c883 100644
> --- a/drivers/scsi/pcmcia/nsp_cs.c
> +++ b/drivers/scsi/pcmcia/nsp_cs.c
> @@ -1398,7 +1398,7 @@ static int nsp_show_info(struct seq_file *m, struct Scsi_Host *host)
>  		seq_puts(m, "???");
>  		break;
>  	}
> -	seq_puts(m, "\n");
> +	seq_putc(m, '\n');
>  
>  
>  	spin_lock_irqsave(&(data->Lock), flags);
> @@ -1439,7 +1439,7 @@ static int nsp_show_info(struct seq_file *m, struct Scsi_Host *host)
>  				data->Sync[id].SyncOffset
>  				);
>  		}
> -		seq_puts(m, "\n");
> +		seq_putc(m, '\n');
>  	}
>  	return 0;
>  }
> diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c
> index c837ba3..15cf074 100644
> --- a/drivers/scsi/qla2xxx/qla_dfs.c
> +++ b/drivers/scsi/qla2xxx/qla_dfs.c
> @@ -38,7 +38,7 @@ qla2x00_dfs_fce_show(struct seq_file *s, void *unused)
>  			seq_printf(s, "\n%llx: ",
>  			    (unsigned long long)((cnt * 4) + fce_start));
>  		else
> -			seq_puts(s, " ");
> +			seq_putc(s, ' ');
>  		seq_printf(s, "%08x", *fce++);
>  	}
>  
> diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c
> index 581de8f..251598e 100644
> --- a/drivers/scsi/scsi_proc.c
> +++ b/drivers/scsi/scsi_proc.c
> @@ -191,7 +191,7 @@ static int proc_print_scsidevice(struct device *dev, void *data)
>  		if (sdev->vendor[i] >= 0x20)
>  			seq_putc(s, sdev->vendor[i]);
>  		else
> -			seq_puts(s, " ");
> +			seq_putc(s, ' ');
>  	}
>  
>  	seq_puts(s, " Model: ");
> @@ -199,7 +199,7 @@ static int proc_print_scsidevice(struct device *dev, void *data)
>  		if (sdev->model[i] >= 0x20)
>  			seq_putc(s, sdev->model[i]);
>  		else
> -			seq_puts(s, " ");
> +			seq_putc(s, ' ');
>  	}
>  
>  	seq_puts(s, " Rev: ");
> @@ -207,10 +207,10 @@ static int proc_print_scsidevice(struct device *dev, void *data)
>  		if (sdev->rev[i] >= 0x20)
>  			seq_putc(s, sdev->rev[i]);
>  		else
> -			seq_puts(s, " ");
> +			seq_putc(s, ' ');
>  	}
>  
> -	seq_puts(s, "\n");
> +	seq_putc(s, '\n');
>  
>  	seq_printf(s, "  Type:   %s ", scsi_device_type(sdev->type));
>  	seq_printf(s, "               ANSI  SCSI revision: %02x",
> @@ -218,7 +218,7 @@ static int proc_print_scsidevice(struct device *dev, void *data)
>  	if (sdev->scsi_level == 2)
>  		seq_puts(s, " CCS\n");
>  	else
> -		seq_puts(s, "\n");
> +		seq_putc(s, '\n');
>  
>  out:
>  	return 0;
> diff --git a/drivers/scsi/scsi_trace.c b/drivers/scsi/scsi_trace.c
> index e4e122b..5cc386c 100644
> --- a/drivers/scsi/scsi_trace.c
> +++ b/drivers/scsi/scsi_trace.c
> @@ -249,7 +249,7 @@ scsi_trace_misc(struct trace_seq *p, unsigned char *cdb, int len)
>  {
>  	const char *ret = trace_seq_buffer_ptr(p);
>  
> -	trace_seq_puts(p, "-");
> +	trace_seq_putc(p, '-');
>  	trace_seq_putc(p, 0);
>  
>  	return ret;
> diff --git a/drivers/scsi/wd33c93.c b/drivers/scsi/wd33c93.c
> index 6e041a7..9e09da4 100644
> --- a/drivers/scsi/wd33c93.c
> +++ b/drivers/scsi/wd33c93.c
> @@ -2192,7 +2192,7 @@ wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance)
>  			cmd = (struct scsi_cmnd *) cmd->host_scribble;
>  		}
>  	}
> -	seq_puts(m, "\n");
> +	seq_putc(m, '\n');
>  	spin_unlock_irq(&hd->lock);
>  #endif				/* PROC_INTERFACE */
>  	return 0;
> 

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

end of thread, other threads:[~2015-01-30  1:45 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-29  0:34 [PATCH 0/7] scsi: Some seq_file cleanups/optimizations Rasmus Villemoes
2014-11-29  0:34 ` [PATCH 1/7] scsi: Remove SPRINTF macro Rasmus Villemoes
2014-11-29  0:34 ` [PATCH 2/7] scsi/g_NCR5380: Remove obfuscating macros Rasmus Villemoes
2014-11-29  0:34 ` [PATCH 3/7] scsi/advansys: Replace seq_printf with seq_puts Rasmus Villemoes
2014-11-29  0:34 ` [PATCH 4/7] scsi/aha152x: " Rasmus Villemoes
2014-11-29  0:34 ` [PATCH 5/7] scsi: misc: " Rasmus Villemoes
2014-11-29  0:34 ` [PATCH 6/7] scsi: misc: Merge consecutive seq_puts calls Rasmus Villemoes
2014-11-29  0:34 ` [PATCH 7/7] scsi: misc: Print single-character strings with seq_putc Rasmus Villemoes
2014-11-30  6:40 ` [PATCH 0/7] scsi: Some seq_file cleanups/optimizations Finn Thain
2014-12-02 23:10 ` [PATCH v2 0/6] " Rasmus Villemoes
2014-12-02 23:10   ` [PATCH v2 1/6] scsi: Remove SPRINTF macro Rasmus Villemoes
2015-01-30  1:37     ` Finn Thain
2014-12-02 23:10   ` [PATCH v2 2/6] scsi/advansys: Replace seq_printf with seq_puts Rasmus Villemoes
2015-01-30  1:38     ` Finn Thain
2014-12-02 23:10   ` [PATCH v2 3/6] scsi/aha152x: " Rasmus Villemoes
2015-01-30  1:40     ` Finn Thain
2014-12-02 23:10   ` [PATCH v2 4/6] scsi: misc: " Rasmus Villemoes
2015-01-30  1:41     ` Finn Thain
2014-12-02 23:10   ` [PATCH v2 5/6] scsi: misc: Merge consecutive seq_puts calls Rasmus Villemoes
2015-01-30  1:42     ` Finn Thain
2014-12-02 23:10   ` [PATCH v2 6/6] scsi: misc: Print single-character strings with seq_putc Rasmus Villemoes
2015-01-30  1:44     ` Finn Thain
2015-01-21 12:08   ` [PATCH v2 0/6] scsi: Some seq_file cleanups/optimizations Rasmus Villemoes
2015-01-29  6:56   ` Finn Thain
2015-01-29  9:16     ` Rasmus Villemoes
2015-01-29 14:22       ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).