Skip to contentSkip to conversation

LoongArch: More efficient data output in show_cpuinfo()

PATCH In review Markus Elfring 2 participants 5 messages Jun 4 – Jun 5

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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
#1 lore raw

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
index d4ce5b585453..cc1b7a96bb0f 100644
@@ -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
#2 lore raw

PATCH 2/3 LoongArch: Delete unnecessary braces in show_cpuinfo()

In reply to Markus Elfring

From: 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
index cc1b7a96bb0f..bc1cd400025c 100644
@@ -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
#3 lore raw

PATCH 3/3 LoongArch: Combine two seq_puts() calls in show_cpuinfo()

In reply to Markus Elfring

From: 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
index bc1cd400025c..36df3c7f6990 100644
@@ -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
maintainer
#4 lore raw
In reply to Markus Elfring

Hi, 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 +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(-)

--
2.54.0