public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Cc: Michal Simek <monstr@monstr.eu>, Fengguang Wu <fengguang.wu@intel.com>
Subject: [PATCH 11/27 v2] microblaze: mb: Remove use of seq_printf return value
Date: Thu, 26 Feb 2015 04:10:43 -0800	[thread overview]
Message-ID: <1424952643.11070.19.camel@perches.com> (raw)
In-Reply-To: <cover.1424573328.git.joe@perches.com>

The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
     seq_has_overflowed() and make public")

Signed-off-by: Joe Perches <joe@perches.com>
---
V2: Joe can't type.
    Remove errant x char after tab found by kbuild test robot

 arch/microblaze/kernel/cpu/mb.c | 149 ++++++++++++++++++++--------------------
 1 file changed, 73 insertions(+), 76 deletions(-)

diff --git a/arch/microblaze/kernel/cpu/mb.c b/arch/microblaze/kernel/cpu/mb.c
index 7b5dca7..01ae077 100644
--- a/arch/microblaze/kernel/cpu/mb.c
+++ b/arch/microblaze/kernel/cpu/mb.c
@@ -27,7 +27,6 @@
 
 static int show_cpuinfo(struct seq_file *m, void *v)
 {
-	int count = 0;
 	char *fpga_family = "Unknown";
 	char *cpu_ver = "Unknown";
 	int i;
@@ -48,91 +47,89 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 		}
 	}
 
-	count = seq_printf(m,
-			"CPU-Family:	MicroBlaze\n"
-			"FPGA-Arch:	%s\n"
-			"CPU-Ver:	%s, %s endian\n"
-			"CPU-MHz:	%d.%02d\n"
-			"BogoMips:	%lu.%02lu\n",
-			fpga_family,
-			cpu_ver,
-			cpuinfo.endian ? "little" : "big",
-			cpuinfo.cpu_clock_freq /
-			1000000,
-			cpuinfo.cpu_clock_freq %
-			1000000,
-			loops_per_jiffy / (500000 / HZ),
-			(loops_per_jiffy / (5000 / HZ)) % 100);
-
-	count += seq_printf(m,
-		"HW:\n Shift:\t\t%s\n"
-		" MSR:\t\t%s\n"
-		" PCMP:\t\t%s\n"
-		" DIV:\t\t%s\n",
-		(cpuinfo.use_instr & PVR0_USE_BARREL_MASK) ? "yes" : "no",
-		(cpuinfo.use_instr & PVR2_USE_MSR_INSTR) ? "yes" : "no",
-		(cpuinfo.use_instr & PVR2_USE_PCMP_INSTR) ? "yes" : "no",
-		(cpuinfo.use_instr & PVR0_USE_DIV_MASK) ? "yes" : "no");
-
-	count += seq_printf(m,
-			" MMU:\t\t%x\n",
-			cpuinfo.mmu);
-
-	count += seq_printf(m,
-		" MUL:\t\t%s\n"
-		" FPU:\t\t%s\n",
-		(cpuinfo.use_mult & PVR2_USE_MUL64_MASK) ? "v2" :
-			(cpuinfo.use_mult & PVR0_USE_HW_MUL_MASK) ? "v1" : "no",
-		(cpuinfo.use_fpu & PVR2_USE_FPU2_MASK) ? "v2" :
-			(cpuinfo.use_fpu & PVR0_USE_FPU_MASK) ? "v1" : "no");
-
-	count += seq_printf(m,
-		" Exc:\t\t%s%s%s%s%s%s%s%s\n",
-		(cpuinfo.use_exc & PVR2_OPCODE_0x0_ILL_MASK) ? "op0x0 " : "",
-		(cpuinfo.use_exc & PVR2_UNALIGNED_EXC_MASK) ? "unal " : "",
-		(cpuinfo.use_exc & PVR2_ILL_OPCODE_EXC_MASK) ? "ill " : "",
-		(cpuinfo.use_exc & PVR2_IOPB_BUS_EXC_MASK) ? "iopb " : "",
-		(cpuinfo.use_exc & PVR2_DOPB_BUS_EXC_MASK) ? "dopb " : "",
-		(cpuinfo.use_exc & PVR2_DIV_ZERO_EXC_MASK) ? "zero " : "",
-		(cpuinfo.use_exc & PVR2_FPU_EXC_MASK) ? "fpu " : "",
-		(cpuinfo.use_exc & PVR2_USE_FSL_EXC) ? "fsl " : "");
-
-	count += seq_printf(m,
-			"Stream-insns:\t%sprivileged\n",
-			cpuinfo.mmu_privins ? "un" : "");
+	seq_printf(m,
+		   "CPU-Family:	MicroBlaze\n"
+		   "FPGA-Arch:	%s\n"
+		   "CPU-Ver:	%s, %s endian\n"
+		   "CPU-MHz:	%d.%02d\n"
+		   "BogoMips:	%lu.%02lu\n",
+		   fpga_family,
+		   cpu_ver,
+		   cpuinfo.endian ? "little" : "big",
+		   cpuinfo.cpu_clock_freq / 1000000,
+		   cpuinfo.cpu_clock_freq % 1000000,
+		   loops_per_jiffy / (500000 / HZ),
+		   (loops_per_jiffy / (5000 / HZ)) % 100);
+
+	seq_printf(m,
+		   "HW:\n Shift:\t\t%s\n"
+		   " MSR:\t\t%s\n"
+		   " PCMP:\t\t%s\n"
+		   " DIV:\t\t%s\n",
+		   (cpuinfo.use_instr & PVR0_USE_BARREL_MASK) ? "yes" : "no",
+		   (cpuinfo.use_instr & PVR2_USE_MSR_INSTR) ? "yes" : "no",
+		   (cpuinfo.use_instr & PVR2_USE_PCMP_INSTR) ? "yes" : "no",
+		   (cpuinfo.use_instr & PVR0_USE_DIV_MASK) ? "yes" : "no");
+
+	seq_printf(m, " MMU:\t\t%x\n", cpuinfo.mmu);
+
+	seq_printf(m,
+		   " MUL:\t\t%s\n"
+		   " FPU:\t\t%s\n",
+		   (cpuinfo.use_mult & PVR2_USE_MUL64_MASK) ? "v2" :
+		   (cpuinfo.use_mult & PVR0_USE_HW_MUL_MASK) ? "v1" : "no",
+		   (cpuinfo.use_fpu & PVR2_USE_FPU2_MASK) ? "v2" :
+		   (cpuinfo.use_fpu & PVR0_USE_FPU_MASK) ? "v1" : "no");
+
+	seq_printf(m,
+		   " Exc:\t\t%s%s%s%s%s%s%s%s\n",
+		   (cpuinfo.use_exc & PVR2_OPCODE_0x0_ILL_MASK) ? "op0x0 " : "",
+		   (cpuinfo.use_exc & PVR2_UNALIGNED_EXC_MASK) ? "unal " : "",
+		   (cpuinfo.use_exc & PVR2_ILL_OPCODE_EXC_MASK) ? "ill " : "",
+		   (cpuinfo.use_exc & PVR2_IOPB_BUS_EXC_MASK) ? "iopb " : "",
+		   (cpuinfo.use_exc & PVR2_DOPB_BUS_EXC_MASK) ? "dopb " : "",
+		   (cpuinfo.use_exc & PVR2_DIV_ZERO_EXC_MASK) ? "zero " : "",
+		   (cpuinfo.use_exc & PVR2_FPU_EXC_MASK) ? "fpu " : "",
+		   (cpuinfo.use_exc & PVR2_USE_FSL_EXC) ? "fsl " : "");
+
+	seq_printf(m,
+		   "Stream-insns:\t%sprivileged\n",
+		   cpuinfo.mmu_privins ? "un" : "");
 
 	if (cpuinfo.use_icache)
-		count += seq_printf(m,
-				"Icache:\t\t%ukB\tline length:\t%dB\n",
-				cpuinfo.icache_size >> 10,
-				cpuinfo.icache_line_length);
+		seq_printf(m,
+			   "Icache:\t\t%ukB\tline length:\t%dB\n",
+			   cpuinfo.icache_size >> 10,
+			   cpuinfo.icache_line_length);
 	else
-		count += seq_printf(m, "Icache:\t\tno\n");
+		seq_puts(m, "Icache:\t\tno\n");
 
 	if (cpuinfo.use_dcache) {
-		count += seq_printf(m,
-				"Dcache:\t\t%ukB\tline length:\t%dB\n",
-				cpuinfo.dcache_size >> 10,
-				cpuinfo.dcache_line_length);
-		seq_printf(m, "Dcache-Policy:\t");
+		seq_printf(m,
+			   "Dcache:\t\t%ukB\tline length:\t%dB\n",
+			   cpuinfo.dcache_size >> 10,
+			   cpuinfo.dcache_line_length);
+		seq_puts(m, "Dcache-Policy:\t");
 		if (cpuinfo.dcache_wb)
-			count += seq_printf(m, "write-back\n");
+			seq_puts(m, "write-back\n");
 		else
-			count += seq_printf(m, "write-through\n");
-	} else
-		count += seq_printf(m, "Dcache:\t\tno\n");
+			seq_puts(m, "write-through\n");
+	} else {
+		seq_puts(m, "Dcache:\t\tno\n");
+	}
+
+	seq_printf(m,
+		   "HW-Debug:\t%s\n",
+		   cpuinfo.hw_debug ? "yes" : "no");
 
-	count += seq_printf(m,
-			"HW-Debug:\t%s\n",
-			cpuinfo.hw_debug ? "yes" : "no");
+	seq_printf(m,
+		   "PVR-USR1:\t%02x\n"
+		   "PVR-USR2:\t%08x\n",
+		   cpuinfo.pvr_user1,
+		   cpuinfo.pvr_user2);
 
-	count += seq_printf(m,
-			"PVR-USR1:\t%02x\n"
-			"PVR-USR2:\t%08x\n",
-			cpuinfo.pvr_user1,
-			cpuinfo.pvr_user2);
+	seq_printf(m, "Page size:\t%lu\n", PAGE_SIZE);
 
-	count += seq_printf(m, "Page size:\t%lu\n", PAGE_SIZE);
 	return 0;
 }
 



      parent reply	other threads:[~2015-02-26 12:10 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-22  2:53 [PATCH 00/27] Convert seq_<foo> output calls to return void Joe Perches
2015-02-22  2:53 ` [PATCH 01/27] staging: lustre: Convert "return seq_printf(...)" uses Joe Perches
2015-02-22  2:53 ` [PATCH 02/27] staging: lustre: Convert seq_ hash functions to return void Joe Perches
2015-02-22  2:53 ` [PATCH 03/27] staging: lustre: Convert uses of "int rc = seq_printf(...)" Joe Perches
2015-03-02  1:22   ` Greg Kroah-Hartman
2015-03-02  3:58     ` [PATCH 03/27 V2] " Joe Perches
2015-02-22  2:53 ` [PATCH 04/27] staging: lustre: Convert remaining uses of "= seq_printf(...)" Joe Perches
2015-02-22  2:53 ` [PATCH 05/27] x86: mtrr: if: Remove use of seq_printf return value Joe Perches
2015-02-22  2:53 ` [PATCH 06/27] power: wakeup: " Joe Perches
2015-02-22 21:38   ` Pavel Machek
2015-02-22 21:52     ` Joe Perches
2015-02-23 11:54       ` Pavel Machek
2015-02-22  2:53 ` [PATCH 07/27] ipmi: " Joe Perches
2015-02-23 23:50   ` Andrew Morton
2015-02-24  1:23     ` Joe Perches
2015-02-22  2:53 ` [PATCH 08/27] rtc: " Joe Perches
2015-02-22  2:53 ` [PATCH 09/27] ipc: " Joe Perches
2015-02-22  2:53 ` [PATCH 10/27] pxa27x_udc: " Joe Perches
2015-02-22 10:22   ` Robert Jarzmik
2015-02-22  2:53 ` [PATCH 11/27] microblaze: mb: " Joe Perches
2015-02-23 11:39   ` Michal Simek
2015-02-22  2:53 ` [PATCH 12/27] nios2: cpuinfo: " Joe Perches
2015-02-22  2:53 ` [PATCH 13/27] ARM: plat-pxa: " Joe Perches
2015-02-22  2:53 ` [PATCH 14/27] openrisc: " Joe Perches
2015-02-22  2:53 ` [PATCH 15/27] cris: " Joe Perches
2015-02-22  2:53 ` [PATCH 16/27] mfd: ab8500-debugfs: " Joe Perches
2015-03-06 10:54   ` Lee Jones
2015-02-22  2:53 ` [PATCH 17/27] staging: i2o: " Joe Perches
2015-02-22  2:53 ` [PATCH 18/27] staging: rtl8192x: " Joe Perches
2015-02-22  2:53 ` [PATCH 19/27] s390: " Joe Perches
2015-02-22 12:53   ` Sebastian Ott
2015-02-22  2:53 ` [PATCH 20/27] i8k: " Joe Perches
2015-02-22  4:55   ` Guenter Roeck
2015-02-22  2:53 ` [PATCH 21/27] watchdog: bcm281xx: " Joe Perches
2015-02-23 19:29   ` [21/27] " Guenter Roeck
2015-03-27  7:57   ` [PATCH 21/27] " Wim Van Sebroeck
2015-02-22  2:53 ` [PATCH 22/27] proc: " Joe Perches
2015-02-22  2:53 ` [PATCH 23/27] cgroup: " Joe Perches
2015-02-22 13:41   ` Tejun Heo
2015-02-22  2:53 ` [PATCH 24/27] tracing: " Joe Perches
2015-02-22  3:54   ` Steven Rostedt
2015-02-22  4:41     ` Al Viro
2015-02-22 10:39       ` Joe Perches
2015-02-23 17:20         ` Steven Rostedt
2015-02-23 17:36           ` Joe Perches
2015-02-22  2:53 ` [PATCH 25/27] lru_cache: " Joe Perches
2015-02-22  2:53 ` [PATCH 26/27] parisc: " Joe Perches
2015-02-22  2:53 ` [PATCH 27/27] regulator: dbx500: Remove use of seq_puts/seq_printf " Joe Perches
2015-02-23 13:55   ` Mark Brown
2015-02-23 14:52     ` Joe Perches
2015-02-24  8:18       ` Mark Brown
2015-02-22  4:00 ` [PATCH V2 - 15/27] cris: Remove use of seq_printf " Joe Perches
2015-02-23  7:18   ` Jesper Nilsson
2015-02-22  4:02 ` [PATCH V2 - 08/27] rtc: " Joe Perches
2015-02-26 12:10 ` Joe Perches [this message]

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=1424952643.11070.19.camel@perches.com \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=fengguang.wu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=monstr@monstr.eu \
    /path/to/YOUR_REPLY

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

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