mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/5] Blackfin: Fine-tuning for three function implementations
@ 2016-10-19 20:44 SF Markus Elfring
  2016-10-19 20:46 ` [PATCH 1/5] blackfin-cplbinfo: Use seq_puts() in cplbinfo_print_header() SF Markus Elfring
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: SF Markus Elfring @ 2016-10-19 20:44 UTC (permalink / raw)
  To: adi-buildroot-devel, Rickard Strandqvist, Steven Miao
  Cc: LKML, kernel-janitors

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

A few update suggestions were taken into account
from static source code analysis.

Markus Elfring (5):
  cplbinfo: Use seq_puts() in cplbinfo_print_header()
  irqchip: Combine two seq_printf() calls into one call in arch_show_interrupts()
  setup: Use seq_putc() in show_cpuinfo()
  setup: Replace three seq_printf() calls by seq_puts() in show_cpuinfo()
  setup: Combine ten seq_printf() calls into three calls in show_cpuinfo()

 arch/blackfin/kernel/cplbinfo.c |  3 +-
 arch/blackfin/kernel/irqchip.c  |  6 ++--
 arch/blackfin/kernel/setup.c    | 73 ++++++++++++++++++++++-------------------
 3 files changed, 46 insertions(+), 36 deletions(-)

-- 
2.10.1

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

* [PATCH 1/5] blackfin-cplbinfo: Use seq_puts() in cplbinfo_print_header()
  2016-10-19 20:44 [PATCH 0/5] Blackfin: Fine-tuning for three function implementations SF Markus Elfring
@ 2016-10-19 20:46 ` 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
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2016-10-19 20:46 UTC (permalink / raw)
  To: adi-buildroot-devel, Rickard Strandqvist, Steven Miao
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 19 Oct 2016 21:00:10 +0200

A string which did not contain a data format specification should be put
into a sequence. Thus use the corresponding function "seq_puts".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 arch/blackfin/kernel/cplbinfo.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/blackfin/kernel/cplbinfo.c b/arch/blackfin/kernel/cplbinfo.c
index 5b80d59..991d9d3 100644
--- a/arch/blackfin/kernel/cplbinfo.c
+++ b/arch/blackfin/kernel/cplbinfo.c
@@ -36,7 +36,8 @@ struct cplbinfo_data {
 
 static void cplbinfo_print_header(struct seq_file *m)
 {
-	seq_printf(m, "Index\tAddress\t\tData\tSize\tU/RD\tU/WR\tS/WR\tSwitch\n");
+	seq_puts(m,
+		 "Index\tAddress\t\tData\tSize\tU/RD\tU/WR\tS/WR\tSwitch\n");
 }
 
 static int cplbinfo_nomore(struct cplbinfo_data *cdata)
-- 
2.10.1

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

* [PATCH 2/5] blackfin-irqchip: Combine two seq_printf() calls into one call in arch_show_interrupts()
  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 ` SF Markus Elfring
  2016-10-19 20:48 ` [PATCH 3/5] blackfin-setup: Use seq_putc() in show_cpuinfo() SF Markus Elfring
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2016-10-19 20:47 UTC (permalink / raw)
  To: adi-buildroot-devel, Rickard Strandqvist, Steven Miao
  Cc: LKML, kernel-janitors

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

Some data were printed into a sequence by two separate function calls.
Print the same data by a single function call instead.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 arch/blackfin/kernel/irqchip.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/blackfin/kernel/irqchip.c b/arch/blackfin/kernel/irqchip.c
index 052cde5..b59ad4c 100644
--- a/arch/blackfin/kernel/irqchip.c
+++ b/arch/blackfin/kernel/irqchip.c
@@ -41,8 +41,10 @@ int arch_show_interrupts(struct seq_file *p, int prec)
 	seq_printf(p, "%*s: ", prec, "NMI");
 	for_each_online_cpu(j)
 		seq_printf(p, "%10u ", cpu_pda[j].__nmi_count);
-	seq_printf(p, "  CORE  Non Maskable Interrupt\n");
-	seq_printf(p, "%*s: %10u\n", prec, "ERR", atomic_read(&irq_err_count));
+	seq_printf(p,
+		   "  CORE  Non Maskable Interrupt\n"
+		   "%*s: %10u\n",
+		   prec, "ERR", atomic_read(&irq_err_count));
 	return 0;
 }
 #endif
-- 
2.10.1

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

* [PATCH 3/5] blackfin-setup: Use seq_putc() in show_cpuinfo()
  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 ` 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 ` [PATCH 5/5] blackfin-setup: Combine ten seq_printf() calls into three calls " SF Markus Elfring
  4 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2016-10-19 20:48 UTC (permalink / raw)
  To: adi-buildroot-devel, Rickard Strandqvist, Steven Miao
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 19 Oct 2016 21:31:04 +0200

A single character (line break) should be put into a sequence.
Thus use the corresponding function "seq_putc".

This issue was detected by using the Coccinelle software.

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

diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index ad82468..a159008 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -1397,8 +1397,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 #ifdef __ARCH_SYNC_CORE_ICACHE
 	seq_printf(m, "icache flushes\t: %lu\n", icache_invld_count[cpu_num]);
 #endif
-
-	seq_printf(m, "\n");
+	seq_putc(m, '\n');
 
 	if (cpu_num != num_possible_cpus() - 1)
 		return 0;
-- 
2.10.1

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

* [PATCH 4/5] blackfin-setup: Replace three seq_printf() calls by seq_puts() in show_cpuinfo()
  2016-10-19 20:44 [PATCH 0/5] Blackfin: Fine-tuning for three function implementations SF Markus Elfring
                   ` (2 preceding siblings ...)
  2016-10-19 20:48 ` [PATCH 3/5] blackfin-setup: Use seq_putc() in show_cpuinfo() SF Markus Elfring
@ 2016-10-19 20:49 ` SF Markus Elfring
  2016-10-19 20:50 ` [PATCH 5/5] blackfin-setup: Combine ten seq_printf() calls into three calls " SF Markus Elfring
  4 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2016-10-19 20:49 UTC (permalink / raw)
  To: adi-buildroot-devel, Rickard Strandqvist, Steven Miao
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 19 Oct 2016 21:46:16 +0200

Strings which did not contain data format specifications should be put
into a sequence. Thus use the corresponding function "seq_puts".

This issue was detected by using the Coccinelle software.

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

diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index a159008..fdd9168 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -1313,9 +1313,9 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 
 	if (bfin_revid() != bfin_compiled_revid()) {
 		if (bfin_compiled_revid() == -1)
-			seq_printf(m, "(Compiled for Rev none)");
+			seq_puts(m, "(Compiled for Rev none)");
 		else if (bfin_compiled_revid() == 0xffff)
-			seq_printf(m, "(Compiled for Rev any)");
+			seq_puts(m, "(Compiled for Rev any)");
 		else
 			seq_printf(m, "(Compiled for Rev %d)", bfin_compiled_revid());
 	}
@@ -1385,7 +1385,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 		seq_printf(m, "icache setup\t: %d Sub-banks/%d Ways, %d Lines/Way\n",
 			   BFIN_ISUBBANKS, BFIN_IWAYS, BFIN_ILINES);
 	else
-		seq_printf(m, "icache setup\t: off\n");
+		seq_puts(m, "icache setup\t: off\n");
 
 	seq_printf(m,
 		   "dcache setup\t: %d Super-banks/%d Sub-banks/%d Ways, %d Lines/Way\n",
-- 
2.10.1

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

* [PATCH 5/5] blackfin-setup: Combine ten seq_printf() calls into three calls in show_cpuinfo()
  2016-10-19 20:44 [PATCH 0/5] Blackfin: Fine-tuning for three function implementations SF Markus Elfring
                   ` (3 preceding siblings ...)
  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
  4 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2016-10-19 20:50 UTC (permalink / raw)
  To: adi-buildroot-devel, Rickard Strandqvist, Steven Miao
  Cc: LKML, kernel-janitors

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

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

end of thread, other threads:[~2016-10-19 20:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 5/5] blackfin-setup: Combine ten seq_printf() calls into three calls " SF Markus Elfring

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