Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH 0/4] MIPS: kernel: proc: More efficient data output in show_cpuinfo()
@ 2026-06-04 17:44 Markus Elfring
  2026-06-04 17:50 ` [PATCH 1/4] MIPS: kernel: proc: Simplify " Markus Elfring
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Markus Elfring @ 2026-06-04 17:44 UTC (permalink / raw)
  To: linux-mips, Thomas Bogendörfer; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 4 Jun 2026 19:33:55 +0200

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

Markus Elfring (4):
  Simplify data output
  Combine two seq_puts() calls
  Use seq_putc() calls
  Delete unnecessary braces

 arch/mips/kernel/proc.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

-- 
2.54.0


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

* [PATCH 1/4] MIPS: kernel: proc: Simplify data output in show_cpuinfo()
  2026-06-04 17:44 [PATCH 0/4] MIPS: kernel: proc: More efficient data output in show_cpuinfo() Markus Elfring
@ 2026-06-04 17:50 ` Markus Elfring
  2026-06-04 17:51 ` [PATCH 2/4] MIPS: kernel: proc: Combine two seq_puts() calls " Markus Elfring
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Markus Elfring @ 2026-06-04 17:50 UTC (permalink / raw)
  To: linux-mips, Thomas Bogendörfer; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 4 Jun 2026 17:24:10 +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.

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

diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
index 8f0a0001540c..fdf659a8bb3d 100644
--- a/arch/mips/kernel/proc.c
+++ b/arch/mips/kernel/proc.c
@@ -274,10 +274,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 		seq_puts(m, " mm_sysad");
 	if (cpu_has_mm_full)
 		seq_puts(m, " mm_full");
-	seq_puts(m, "\n");
 
-	seq_printf(m, "shadow register sets\t: %d\n",
-		      cpu_data[n].srsets);
+	seq_printf(m, "\nshadow register sets\t: %d\n", cpu_data[n].srsets);
 	seq_printf(m, "kscratch registers\t: %d\n",
 		      hweight8(cpu_data[n].kscratch_mask));
 	seq_printf(m, "package\t\t\t: %d\n", cpu_data[n].package);
-- 
2.54.0


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

* [PATCH 2/4] MIPS: kernel: proc: Combine two seq_puts() calls in show_cpuinfo()
  2026-06-04 17:44 [PATCH 0/4] MIPS: kernel: proc: More efficient data output in show_cpuinfo() Markus Elfring
  2026-06-04 17:50 ` [PATCH 1/4] MIPS: kernel: proc: Simplify " Markus Elfring
@ 2026-06-04 17:51 ` Markus Elfring
  2026-06-04 17:54 ` [PATCH 3/4] MIPS: kernel: proc: Use seq_putc() " Markus Elfring
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Markus Elfring @ 2026-06-04 17:51 UTC (permalink / raw)
  To: linux-mips, Thomas Bogendörfer; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 4 Jun 2026 19:10:04 +0200

Put data into a sequence by a single seq_puts() call instead of two.

This issue was detected by using the Coccinelle software.

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

diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
index fdf659a8bb3d..9e8b8f99b606 100644
--- a/arch/mips/kernel/proc.c
+++ b/arch/mips/kernel/proc.c
@@ -109,9 +109,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 		seq_puts(m, " mips64r5");
 	if (cpu_has_mips64r6)
 		seq_puts(m, " mips64r6");
-	seq_puts(m, "\n");
 
-	seq_puts(m, "ASEs implemented\t:");
+	seq_puts(m, "\nASEs implemented\t:");
 	if (cpu_has_mips16)
 		seq_puts(m, " mips16");
 	if (cpu_has_mips16e2)
-- 
2.54.0


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

* [PATCH 3/4] MIPS: kernel: proc: Use seq_putc() calls in show_cpuinfo()
  2026-06-04 17:44 [PATCH 0/4] MIPS: kernel: proc: More efficient data output in show_cpuinfo() Markus Elfring
  2026-06-04 17:50 ` [PATCH 1/4] MIPS: kernel: proc: Simplify " Markus Elfring
  2026-06-04 17:51 ` [PATCH 2/4] MIPS: kernel: proc: Combine two seq_puts() calls " Markus Elfring
@ 2026-06-04 17:54 ` Markus Elfring
  2026-06-15 10:30   ` Thomas Bogendoerfer
  2026-06-04 17:56 ` [PATCH 4/4] MIPS: kernel: proc: Delete unnecessary braces " Markus Elfring
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Markus Elfring @ 2026-06-04 17:54 UTC (permalink / raw)
  To: linux-mips, Thomas Bogendörfer; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 4 Jun 2026 19:12:11 +0200

Single characters should occasionally be put into a sequence.
Thus use the corresponding function “seq_putc”.

The source code was transformed by using the Coccinelle software.

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

diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
index 9e8b8f99b606..42430c7f0acf 100644
--- a/arch/mips/kernel/proc.c
+++ b/arch/mips/kernel/proc.c
@@ -79,7 +79,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 		for (i = 0; i < cpu_data[n].watch_reg_count; i++)
 			seq_printf(m, "%s0x%04x", i ? ", " : "",
 				cpu_data[n].watch_reg_masks[i]);
-		seq_puts(m, "]");
+		seq_putc(m, ']');
 	}
 
 	seq_puts(m, "\nisa\t\t\t:");
@@ -149,7 +149,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 		seq_puts(m, " loongson-ext");
 	if (cpu_has_loongson_ext2)
 		seq_puts(m, " loongson-ext2");
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 	if (cpu_has_mmips) {
 		seq_printf(m, "micromips kernel\t: %s\n",
@@ -298,7 +298,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 	raw_notifier_call_chain(&proc_cpuinfo_chain, 0,
 				&proc_cpuinfo_notifier_args);
 
-	seq_puts(m, "\n");
+	seq_putc(m, '\n');
 
 	return 0;
 }
-- 
2.54.0


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

* [PATCH 4/4] MIPS: kernel: proc: Delete unnecessary braces in show_cpuinfo()
  2026-06-04 17:44 [PATCH 0/4] MIPS: kernel: proc: More efficient data output in show_cpuinfo() Markus Elfring
                   ` (2 preceding siblings ...)
  2026-06-04 17:54 ` [PATCH 3/4] MIPS: kernel: proc: Use seq_putc() " Markus Elfring
@ 2026-06-04 17:56 ` Markus Elfring
  2026-06-15 10:30   ` Thomas Bogendoerfer
  2026-06-05  2:58 ` [PATCH 0/4] MIPS: kernel: proc: More efficient data output " Huacai Chen
  2026-06-16 10:34 ` [0/4] " Markus Elfring
  5 siblings, 1 reply; 13+ messages in thread
From: Markus Elfring @ 2026-06-04 17:56 UTC (permalink / raw)
  To: linux-mips, Thomas Bogendörfer; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 4 Jun 2026 19:15:15 +0200

Do not use curly brackets at one source code place
where a single statement should be sufficient.

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

diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
index 42430c7f0acf..2c50b0b53be1 100644
--- a/arch/mips/kernel/proc.c
+++ b/arch/mips/kernel/proc.c
@@ -151,10 +151,9 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 		seq_puts(m, " loongson-ext2");
 	seq_putc(m, '\n');
 
-	if (cpu_has_mmips) {
+	if (cpu_has_mmips)
 		seq_printf(m, "micromips kernel\t: %s\n",
 		      str_yes_no(read_c0_config3() & MIPS_CONF3_ISA_OE));
-	}
 
 	seq_puts(m, "Options implemented\t:");
 	if (cpu_has_tlb)
-- 
2.54.0


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

* Re: [PATCH 0/4] MIPS: kernel: proc: More efficient data output in show_cpuinfo()
  2026-06-04 17:44 [PATCH 0/4] MIPS: kernel: proc: More efficient data output in show_cpuinfo() Markus Elfring
                   ` (3 preceding siblings ...)
  2026-06-04 17:56 ` [PATCH 4/4] MIPS: kernel: proc: Delete unnecessary braces " Markus Elfring
@ 2026-06-05  2:58 ` Huacai Chen
  2026-06-16 10:34 ` [0/4] " Markus Elfring
  5 siblings, 0 replies; 13+ messages in thread
From: Huacai Chen @ 2026-06-05  2:58 UTC (permalink / raw)
  To: Markus Elfring; +Cc: linux-mips, Thomas Bogendörfer, LKML, kernel-janitors

Hi, Markus,

I suggest squash these pieces to a single patch.

Huacai

On Fri, Jun 5, 2026 at 1:52 AM Markus Elfring <Markus.Elfring@web.de> wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 4 Jun 2026 19:33:55 +0200
>
> A few update suggestions were taken into account
> from static source code analysis.
>
> Markus Elfring (4):
>   Simplify data output
>   Combine two seq_puts() calls
>   Use seq_putc() calls
>   Delete unnecessary braces
>
>  arch/mips/kernel/proc.c | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)
>
> --
> 2.54.0
>
>

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

* Re: [PATCH 3/4] MIPS: kernel: proc: Use seq_putc() calls in show_cpuinfo()
  2026-06-04 17:54 ` [PATCH 3/4] MIPS: kernel: proc: Use seq_putc() " Markus Elfring
@ 2026-06-15 10:30   ` Thomas Bogendoerfer
  0 siblings, 0 replies; 13+ messages in thread
From: Thomas Bogendoerfer @ 2026-06-15 10:30 UTC (permalink / raw)
  To: Markus Elfring; +Cc: linux-mips, LKML, kernel-janitors

On Thu, Jun 04, 2026 at 07:54:08PM +0200, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 4 Jun 2026 19:12:11 +0200
> 
> Single characters should occasionally be put into a sequence.
> Thus use the corresponding function “seq_putc”.
> 
> The source code was transformed by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  arch/mips/kernel/proc.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
> index 9e8b8f99b606..42430c7f0acf 100644
> --- a/arch/mips/kernel/proc.c
> +++ b/arch/mips/kernel/proc.c
> @@ -79,7 +79,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
>  		for (i = 0; i < cpu_data[n].watch_reg_count; i++)
>  			seq_printf(m, "%s0x%04x", i ? ", " : "",
>  				cpu_data[n].watch_reg_masks[i]);
> -		seq_puts(m, "]");
> +		seq_putc(m, ']');
>  	}
>  
>  	seq_puts(m, "\nisa\t\t\t:");
> @@ -149,7 +149,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
>  		seq_puts(m, " loongson-ext");
>  	if (cpu_has_loongson_ext2)
>  		seq_puts(m, " loongson-ext2");
> -	seq_puts(m, "\n");
> +	seq_putc(m, '\n');
>  
>  	if (cpu_has_mmips) {
>  		seq_printf(m, "micromips kernel\t: %s\n",
> @@ -298,7 +298,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
>  	raw_notifier_call_chain(&proc_cpuinfo_chain, 0,
>  				&proc_cpuinfo_notifier_args);
>  
> -	seq_puts(m, "\n");
> +	seq_putc(m, '\n');
>  
>  	return 0;
>  }
> -- 
> 2.54.0

applied to mips-next

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

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

* Re: [PATCH 4/4] MIPS: kernel: proc: Delete unnecessary braces in show_cpuinfo()
  2026-06-04 17:56 ` [PATCH 4/4] MIPS: kernel: proc: Delete unnecessary braces " Markus Elfring
@ 2026-06-15 10:30   ` Thomas Bogendoerfer
  2026-06-15 10:47     ` Dan Carpenter
  0 siblings, 1 reply; 13+ messages in thread
From: Thomas Bogendoerfer @ 2026-06-15 10:30 UTC (permalink / raw)
  To: Markus Elfring; +Cc: linux-mips, LKML, kernel-janitors

On Thu, Jun 04, 2026 at 07:56:12PM +0200, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 4 Jun 2026 19:15:15 +0200
> 
> Do not use curly brackets at one source code place
> where a single statement should be sufficient.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  arch/mips/kernel/proc.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
> index 42430c7f0acf..2c50b0b53be1 100644
> --- a/arch/mips/kernel/proc.c
> +++ b/arch/mips/kernel/proc.c
> @@ -151,10 +151,9 @@ static int show_cpuinfo(struct seq_file *m, void *v)
>  		seq_puts(m, " loongson-ext2");
>  	seq_putc(m, '\n');
>  
> -	if (cpu_has_mmips) {
> +	if (cpu_has_mmips)
>  		seq_printf(m, "micromips kernel\t: %s\n",
>  		      str_yes_no(read_c0_config3() & MIPS_CONF3_ISA_OE));
> -	}
>  
>  	seq_puts(m, "Options implemented\t:");
>  	if (cpu_has_tlb)
> -- 
> 2.54.0

applied to mips-next

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

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

* Re: [PATCH 4/4] MIPS: kernel: proc: Delete unnecessary braces in show_cpuinfo()
  2026-06-15 10:30   ` Thomas Bogendoerfer
@ 2026-06-15 10:47     ` Dan Carpenter
  2026-06-15 10:53       ` [4/4] " Markus Elfring
  2026-06-15 11:13       ` Markus Elfring
  0 siblings, 2 replies; 13+ messages in thread
From: Dan Carpenter @ 2026-06-15 10:47 UTC (permalink / raw)
  To: Thomas Bogendoerfer; +Cc: Markus Elfring, linux-mips, LKML, kernel-janitors

On Mon, Jun 15, 2026 at 12:30:40PM +0200, Thomas Bogendoerfer wrote:
> On Thu, Jun 04, 2026 at 07:56:12PM +0200, Markus Elfring wrote:
> > From: Markus Elfring <elfring@users.sourceforge.net>
> > Date: Thu, 4 Jun 2026 19:15:15 +0200
> > 
> > Do not use curly brackets at one source code place
> > where a single statement should be sufficient.
> > 
> > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Generally, in most kernel subsystems the rule is that multi-line indents
get curly braces for readability even when they aren't required because
of the syntax.

regards,
dan carpenter


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

* Re: [4/4] MIPS: kernel: proc: Delete unnecessary braces in show_cpuinfo()
  2026-06-15 10:47     ` Dan Carpenter
@ 2026-06-15 10:53       ` Markus Elfring
  2026-06-15 11:13       ` Markus Elfring
  1 sibling, 0 replies; 13+ messages in thread
From: Markus Elfring @ 2026-06-15 10:53 UTC (permalink / raw)
  To: Dan Carpenter, Thomas Bogendörfer, linux-mips; +Cc: LKML, kernel-janitors

>>> Do not use curly brackets at one source code place
>>> where a single statement should be sufficient.
> Generally, in most kernel subsystems the rule is that multi-line indents
> get curly braces for readability even when they aren't required because
> of the syntax.
How do you think about to adjust any process and software documentation accordingly?

Regards,
Markus

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

* Re: [4/4] MIPS: kernel: proc: Delete unnecessary braces in show_cpuinfo()
  2026-06-15 10:47     ` Dan Carpenter
  2026-06-15 10:53       ` [4/4] " Markus Elfring
@ 2026-06-15 11:13       ` Markus Elfring
  1 sibling, 0 replies; 13+ messages in thread
From: Markus Elfring @ 2026-06-15 11:13 UTC (permalink / raw)
  To: Dan Carpenter, Thomas Bogendörfer, linux-mips; +Cc: LKML, kernel-janitors

> Generally, in most kernel subsystems the rule is that multi-line indents
> get curly braces for readability even when they aren't required because
> of the syntax.

By the way:
Would you eventually prefer any other indentation (or formatting) for
the affected statement?

Regards,
Markus

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

* Re: [0/4] MIPS: kernel: proc: More efficient data output in show_cpuinfo()
  2026-06-04 17:44 [PATCH 0/4] MIPS: kernel: proc: More efficient data output in show_cpuinfo() Markus Elfring
                   ` (4 preceding siblings ...)
  2026-06-05  2:58 ` [PATCH 0/4] MIPS: kernel: proc: More efficient data output " Huacai Chen
@ 2026-06-16 10:34 ` Markus Elfring
  2026-06-16 11:00   ` Thomas Bogendoerfer
  5 siblings, 1 reply; 13+ messages in thread
From: Markus Elfring @ 2026-06-16 10:34 UTC (permalink / raw)
  To: linux-mips, Thomas Bogendörfer; +Cc: LKML, kernel-janitors

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

Does the feedback indicate so far that you would like to omit
the patch “MIPS: kernel: proc: Simplify data output in show_cpuinfo()”?
https://lore.kernel.org/linux-mips/5dcb1ae4-dc98-4f12-8ccb-ff47b16a326c@web.de/
https://lkml.org/lkml/2026/6/4/1819

Will another source code adjustment become helpful?

Regards,
Markus

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

* Re: [0/4] MIPS: kernel: proc: More efficient data output in show_cpuinfo()
  2026-06-16 10:34 ` [0/4] " Markus Elfring
@ 2026-06-16 11:00   ` Thomas Bogendoerfer
  0 siblings, 0 replies; 13+ messages in thread
From: Thomas Bogendoerfer @ 2026-06-16 11:00 UTC (permalink / raw)
  To: Markus Elfring; +Cc: linux-mips, LKML, kernel-janitors

On Tue, Jun 16, 2026 at 12:34:18PM +0200, Markus Elfring wrote:
> > A few update suggestions were taken into account
> > from static source code analysis.
> 
> Does the feedback indicate so far that you would like to omit
> the patch “MIPS: kernel: proc: Simplify data output in show_cpuinfo()”?
> https://lore.kernel.org/linux-mips/5dcb1ae4-dc98-4f12-8ccb-ff47b16a326c@web.de/
> https://lkml.org/lkml/2026/6/4/1819

I prefer the way how text is formated over saving a few bytes/cylcles.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

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

end of thread, other threads:[~2026-06-16 11:04 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-04 17:44 [PATCH 0/4] MIPS: kernel: proc: More efficient data output in show_cpuinfo() Markus Elfring
2026-06-04 17:50 ` [PATCH 1/4] MIPS: kernel: proc: Simplify " Markus Elfring
2026-06-04 17:51 ` [PATCH 2/4] MIPS: kernel: proc: Combine two seq_puts() calls " Markus Elfring
2026-06-04 17:54 ` [PATCH 3/4] MIPS: kernel: proc: Use seq_putc() " Markus Elfring
2026-06-15 10:30   ` Thomas Bogendoerfer
2026-06-04 17:56 ` [PATCH 4/4] MIPS: kernel: proc: Delete unnecessary braces " Markus Elfring
2026-06-15 10:30   ` Thomas Bogendoerfer
2026-06-15 10:47     ` Dan Carpenter
2026-06-15 10:53       ` [4/4] " Markus Elfring
2026-06-15 11:13       ` Markus Elfring
2026-06-05  2:58 ` [PATCH 0/4] MIPS: kernel: proc: More efficient data output " Huacai Chen
2026-06-16 10:34 ` [0/4] " Markus Elfring
2026-06-16 11:00   ` Thomas Bogendoerfer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox