M32R-setup: Fine-tuning for show_cpuinfo()
cover M32R-setup: Fine-tuning for show_cpuinfo()
From: Markus Elfring <[email protected]>
Date: Sun, 23 Oct 2016 22:15:22 +0200
A few update suggestions were taken into account
from static source code analysis.
Markus Elfring (2):
Use seq_putc()
Replace 16 seq_printf() calls by seq_puts()
arch/m32r/kernel/setup.c | 54 ++++++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 25 deletions(-)
Signature · 1 line
2.10.1
PATCH 1/2 M32R-setup: Use seq_putc() in show_cpuinfo()
From: Markus Elfring <[email protected]>
Date: Sun, 23 Oct 2016 21:50:22 +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/m32r/kernel/setup.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/m32r/kernel/setup.c +1 -3
@@ -351,9 +351,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)PRINT_CLOCK ("CPU" , (int )c->cpu_clock);PRINT_CLOCK ("Bus" , (int )c->bus_clock); - -seq_printf (m,"\n" ); - +seq_putc (m,'\n' );return 0 ; }
Signature · 1 line
2.10.1
PATCH 2/2 M32R-setup: Replace 16 seq_printf() calls by seq_puts() in show_cpuinfo()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Sun, 23 Oct 2016 22:04:34 +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/m32r/kernel/setup.c | 50 +++++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 22 deletions(-)
arch/m32r/kernel/setup.c +28 -22
@@ -302,47 +302,53 @@ static int show_cpuinfo(struct seq_file *m, void *v)seq_printf (m,"processor\t: %ld\n" , cpu);#if defined(CONFIG_CHIP_VDEC2 ) -seq_printf (m,"cpu family\t: VDEC2\n" -"cache size\t: Unknown\n" ); +seq_puts (m, +"cpu family\t: VDEC2\n" +"cache size\t: Unknown\n" );#elif defined(CONFIG_CHIP_M32700 ) -seq_printf (m,"cpu family\t: M32700\n" -"cache size\t: I-8KB/D-8KB\n" ); +seq_puts (m, +"cpu family\t: M32700\n" +"cache size\t: I-8KB/D-8KB\n" );#elif defined(CONFIG_CHIP_M32102 ) -seq_printf (m,"cpu family\t: M32102\n" -"cache size\t: I-8KB\n" ); +seq_puts (m, +"cpu family\t: M32102\n" +"cache size\t: I-8KB\n" );#elif defined(CONFIG_CHIP_OPSP ) -seq_printf (m,"cpu family\t: OPSP\n" -"cache size\t: I-8KB/D-8KB\n" ); +seq_puts (m, +"cpu family\t: OPSP\n" +"cache size\t: I-8KB/D-8KB\n" );#elif defined(CONFIG_CHIP_MP ) -seq_printf (m,"cpu family\t: M32R-MP\n" -"cache size\t: I-xxKB/D-xxKB\n" ); +seq_puts (m, +"cpu family\t: M32R-MP\n" +"cache size\t: I-xxKB/D-xxKB\n" );#elif defined(CONFIG_CHIP_M32104 ) -seq_printf (m,"cpu family\t: M32104\n" -"cache size\t: I-8KB/D-8KB\n" ); +seq_puts (m, +"cpu family\t: M32104\n" +"cache size\t: I-8KB/D-8KB\n" );#else -seq_printf (m,"cpu family\t: Unknown\n" ); +seq_puts (m,"cpu family\t: Unknown\n" );#endif seq_printf (m,"bogomips\t: %lu.%02lu\n" , c->loops_per_jiffy/(500000 /HZ ), (c->loops_per_jiffy/(5000 /HZ )) %100 );#if defined(CONFIG_PLAT_MAPPI ) -seq_printf (m,"Machine\t\t: Mappi Evaluation board\n" ); +seq_puts (m,"Machine\t\t: Mappi Evaluation board\n" );#elif defined(CONFIG_PLAT_MAPPI2 ) -seq_printf (m,"Machine\t\t: Mappi-II Evaluation board\n" ); +seq_puts (m,"Machine\t\t: Mappi-II Evaluation board\n" );#elif defined(CONFIG_PLAT_MAPPI3 ) -seq_printf (m,"Machine\t\t: Mappi-III Evaluation board\n" ); +seq_puts (m,"Machine\t\t: Mappi-III Evaluation board\n" );#elif defined(CONFIG_PLAT_M32700UT ) -seq_printf (m,"Machine\t\t: M32700UT Evaluation board\n" ); +seq_puts (m,"Machine\t\t: M32700UT Evaluation board\n" );#elif defined(CONFIG_PLAT_OPSPUT ) -seq_printf (m,"Machine\t\t: OPSPUT Evaluation board\n" ); +seq_puts (m,"Machine\t\t: OPSPUT Evaluation board\n" );#elif defined(CONFIG_PLAT_USRV ) -seq_printf (m,"Machine\t\t: uServer\n" ); +seq_puts (m,"Machine\t\t: uServer\n" );#elif defined(CONFIG_PLAT_OAKS32R ) -seq_printf (m,"Machine\t\t: OAKS32R\n" ); +seq_puts (m,"Machine\t\t: OAKS32R\n" );#elif defined(CONFIG_PLAT_M32104UT ) -seq_printf (m,"Machine\t\t: M3T-M32104UT uT Engine board\n" ); +seq_puts (m,"Machine\t\t: M3T-M32104UT uT Engine board\n" );#else -seq_printf (m,"Machine\t\t: Unknown\n" ); +seq_puts (m,"Machine\t\t: Unknown\n" );#endif #define PRINT_CLOCK (name, value) \
Signature · 1 line
2.10.1