Blackfin: Fine-tuning for three function implementations
cover Blackfin: Fine-tuning for three function implementations
From: Markus Elfring <[email protected]>
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(-)
Signature · 1 line
2.10.1
PATCH 1/5 blackfin-cplbinfo: Use seq_puts() in cplbinfo_print_header()
From: Markus Elfring <[email protected]>
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.
--- arch/blackfin/kernel/cplbinfo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/blackfin/kernel/cplbinfo.c +2 -1
@@ -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)
Signature · 1 line
2.10.1
PATCH 2/5 blackfin-irqchip: Combine two seq_printf() calls into one call in arch_show_interrupts()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
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.
--- arch/blackfin/kernel/irqchip.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/blackfin/kernel/irqchip.c +4 -2
@@ -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
Signature · 1 line
2.10.1
PATCH 3/5 blackfin-setup: Use seq_putc() in show_cpuinfo()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
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.
--- arch/blackfin/kernel/setup.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/blackfin/kernel/setup.c +1 -2
@@ -1397,8 +1397,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)#ifdef __ARCH_SYNC_CORE_ICACHEseq_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 ;
Signature · 1 line
2.10.1
PATCH 4/5 blackfin-setup: Replace three seq_printf() calls by seq_puts() in show_cpuinfo()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
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.
--- arch/blackfin/kernel/setup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/blackfin/kernel/setup.c +3 -3
@@ -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",
Signature · 1 line
2.10.1
PATCH 5/5 blackfin-setup: Combine ten seq_printf() calls into three calls in show_cpuinfo()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
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.
--- arch/blackfin/kernel/setup.c | 64 +++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 28 deletions(-)
arch/blackfin/kernel/setup.c +36 -28
@@ -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 ; }
Signature · 1 line
2.10.1