mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: adi-buildroot-devel@lists.sourceforge.net,
	Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>,
	Steven Miao <realmz6@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 5/5] blackfin-setup: Combine ten seq_printf() calls into three calls in show_cpuinfo()
Date: Wed, 19 Oct 2016 22:50:33 +0200	[thread overview]
Message-ID: <f756e72a-a4f7-4457-27e1-e9df39d64abb@users.sourceforge.net> (raw)
In-Reply-To: <4cd6678e-ebf0-d2f4-0b79-ac33060a6752@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 19 Oct 2016 22:11:32 +0200

Some data were printed into a sequence by ten separate function calls.
Print the same data by three function calls instead.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 arch/blackfin/kernel/setup.c | 64 +++++++++++++++++++++++++-------------------
 1 file changed, 36 insertions(+), 28 deletions(-)

diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index fdd9168..250e645 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -1360,26 +1360,29 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 	if ((cpudata->imemctl & (IMC | ENICPLB)) != (IMC | ENICPLB))
 		icache_size = 0;
 
-	seq_printf(m, "cache size\t: %d KB(L1 icache) "
-		"%d KB(L1 dcache) %d KB(L2 cache)\n",
-		icache_size, dcache_size, 0);
-	seq_printf(m, "%s\n", cache);
-	seq_printf(m, "external memory\t: "
+	seq_printf(m,
+		   "cache size\t: %d KB(L1 icache) %d KB(L1 dcache) %d KB(L2 cache)\n"
+		   "%s\n"
+		   "external memory\t: "
 #if defined(CONFIG_BFIN_EXTMEM_ICACHEABLE)
 		   "cacheable"
 #else
 		   "uncacheable"
 #endif
-		   " in instruction cache\n");
-	seq_printf(m, "external memory\t: "
+		   " in instruction cache\n"
+		   "external memory\t: "
 #if defined(CONFIG_BFIN_EXTMEM_WRITEBACK)
-		      "cacheable (write-back)"
+		   "cacheable (write-back)"
 #elif defined(CONFIG_BFIN_EXTMEM_WRITETHROUGH)
-		      "cacheable (write-through)"
+		   "cacheable (write-through)"
 #else
-		      "uncacheable"
+		   "uncacheable"
 #endif
-		      " in data cache\n");
+		   " in data cache\n",
+		   icache_size,
+		   dcache_size,
+		   0,
+		   cache);
 
 	if (icache_size)
 		seq_printf(m, "icache setup\t: %d Sub-banks/%d Ways, %d Lines/Way\n",
@@ -1403,31 +1406,36 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 		return 0;
 
 	if (L2_LENGTH) {
-		seq_printf(m, "L2 SRAM\t\t: %dKB\n", L2_LENGTH/0x400);
-		seq_printf(m, "L2 SRAM\t\t: "
+		seq_printf(m,
+			   "L2 SRAM\t\t: %dKB\n"
+			   "L2 SRAM\t\t: "
 #if defined(CONFIG_BFIN_L2_ICACHEABLE)
-			      "cacheable"
+			   "cacheable"
 #else
-			      "uncacheable"
+			   "uncacheable"
 #endif
-			      " in instruction cache\n");
-		seq_printf(m, "L2 SRAM\t\t: "
+			   " in instruction cache\n"
+			   "L2 SRAM\t\t: "
 #if defined(CONFIG_BFIN_L2_WRITEBACK)
-			      "cacheable (write-back)"
+			   "cacheable (write-back)"
 #elif defined(CONFIG_BFIN_L2_WRITETHROUGH)
-			      "cacheable (write-through)"
+			   "cacheable (write-through)"
 #else
-			      "uncacheable"
+			   "uncacheable"
 #endif
-			      " in data cache\n");
+			   " in data cache\n",
+			   L2_LENGTH / 0x400);
 	}
-	seq_printf(m, "board name\t: %s\n", bfin_board_name);
-	seq_printf(m, "board memory\t: %ld kB (0x%08lx -> 0x%08lx)\n",
-		physical_mem_end >> 10, 0ul, physical_mem_end);
-	seq_printf(m, "kernel memory\t: %d kB (0x%08lx -> 0x%08lx)\n",
-		((int)memory_end - (int)_rambase) >> 10,
-		_rambase, memory_end);
-
+	seq_printf(m,
+		   "board name\t: %s\n"
+		   "board memory\t: %ld kB (0x%08lx -> 0x%08lx)\n"
+		   "kernel memory\t: %d kB (0x%08lx -> 0x%08lx)\n",
+		   bfin_board_name,
+		   physical_mem_end >> 10,
+		   0ul,
+		   physical_mem_end,
+		   ((int)memory_end - (int)_rambase) >> 10,
+		   _rambase, memory_end);
 	return 0;
 }
 
-- 
2.10.1

      parent reply	other threads:[~2016-10-19 20:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-19 20:44 [PATCH 0/5] Blackfin: Fine-tuning for three function implementations SF Markus Elfring
2016-10-19 20:46 ` [PATCH 1/5] blackfin-cplbinfo: Use seq_puts() in cplbinfo_print_header() SF Markus Elfring
2016-10-19 20:47 ` [PATCH 2/5] blackfin-irqchip: Combine two seq_printf() calls into one call in arch_show_interrupts() SF Markus Elfring
2016-10-19 20:48 ` [PATCH 3/5] blackfin-setup: Use seq_putc() in show_cpuinfo() SF Markus Elfring
2016-10-19 20:49 ` [PATCH 4/5] blackfin-setup: Replace three seq_printf() calls by seq_puts() " SF Markus Elfring
2016-10-19 20:50 ` SF Markus Elfring [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=f756e72a-a4f7-4457-27e1-e9df39d64abb@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=adi-buildroot-devel@lists.sourceforge.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=realmz6@gmail.com \
    --cc=rickard_strandqvist@spectrumdigital.se \
    /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

Powered by JetHome