LoongArch: More efficient data output in show_cpuinfo()
Subsystems (2)
cover LoongArch: More efficient data output in show_cpuinfo()
From: Markus Elfring <[email protected]>
Date: Thu, 4 Jun 2026 16:40:05 +0200
A few update suggestions were taken into account
from static source code analysis.
Markus Elfring (3):
Simplify data output
Delete unnecessary braces
Combine two seq_puts() calls
arch/loongarch/kernel/proc.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
Signature · 1 line
2.54.0
PATCH 1/3 LoongArch: Simplify data output in show_cpuinfo()
From: Markus Elfring <[email protected]>
Date: Thu, 4 Jun 2026 16:02:59 +0200
Move the specification for a line break from a seq_puts() call to a seq_printf() call.
The source code was transformed by using the Coccinelle software.
--- arch/loongarch/kernel/proc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/loongarch/kernel/proc.c +1 -2
@@ -94,9 +94,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)seq_puts (m," lbt_arm" );if (cpu_has_lbt_mips)seq_puts (m," lbt_mips" ); -seq_puts (m,"\n" ); -seq_printf (m,"Hardware Watchpoint\t: %s" ,str_yes_no (cpu_has_watch)); +seq_printf (m,"\nHardware Watchpoint\t: %s" ,str_yes_no (cpu_has_watch));if (cpu_has_watch) {seq_printf (m,", iwatch count: %d, dwatch count: %d" , cpu_data[n].watch_ireg_count, cpu_data[n].watch_dreg_count);
Signature · 1 line
2.54.0
PATCH 2/3 LoongArch: Delete unnecessary braces in show_cpuinfo()
In reply to Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Thu, 4 Jun 2026 16:16:43 +0200
Do not use curly brackets at one source code place where a single statement should be sufficient.
--- arch/loongarch/kernel/proc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/loongarch/kernel/proc.c +1 -2
@@ -96,10 +96,9 @@ static int show_cpuinfo(struct seq_file *m, void *v)seq_puts (m," lbt_mips" );seq_printf (m,"\nHardware Watchpoint\t: %s" ,str_yes_no (cpu_has_watch)); -if (cpu_has_watch) { +if (cpu_has_watch)seq_printf (m,", iwatch count: %d, dwatch count: %d" , cpu_data[n].watch_ireg_count, cpu_data[n].watch_dreg_count); - }seq_puts (m,"\n\n" );
Signature · 1 line
2.54.0
PATCH 3/3 LoongArch: Combine two seq_puts() calls in show_cpuinfo()
In reply to Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Thu, 4 Jun 2026 16:33:07 +0200
Put data into a sequence by a single seq_puts() call instead of two.
This issue was detected by using the Coccinelle software.
--- arch/loongarch/kernel/proc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/loongarch/kernel/proc.c +1 -2
@@ -57,9 +57,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)seq_puts (m," loongarch32s" );if (isa &LOONGARCH_CPU_ISA_LA64 )seq_puts (m," loongarch64" ); -seq_puts (m,"\n" ); -seq_puts (m,"Features\t\t:" ); +seq_puts (m,"\nFeatures\t\t:" );if (cpu_has_cpucfg)seq_puts (m," cpucfg" );if (cpu_has_lam)
Signature · 1 line
2.54.0
Huacai Chen
maintainerHi, Markus,
I suggest squash these pieces to a single patch.
Huacai
Quoted 19 lines · Markus Elfring
From: Markus Elfring <[email protected]>
Date: Thu, 4 Jun 2026 16:40:05 +0200A few update suggestions were taken into account
from static source code analysis.Markus Elfring (3):
Simplify data output
Delete unnecessary braces
Combine twoseq_puts()callsarch/loongarch/kernel/proc.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)--
2.54.0