Re: [PATCH v10 loongarch-next 3/3] LoongArch: Replace seq_printf with seq_puts for simple strings

From: Joe Perches

Date: Sat Jan 10 2026 - 13:04:54 EST


On Sat, 2026-01-10 at 21:11 +0800, George Guo wrote:
> Fix warnings like: "Prefer seq_puts to seq_printf" by checkpatch.pl.
>
> Replace seq_printf() calls with seq_puts() in show_cpuinfo()
> when outputting simple constant strings without format specifiers.
>
> This improves performance slightly as seq_puts() avoids parsing
> the format string.
[]
> diff --git a/arch/loongarch/kernel/proc.c b/arch/loongarch/kernel/proc.c
[]
> @@ -50,33 +50,49 @@ static int show_cpuinfo(struct seq_file *m, void *v)
[]
> - seq_printf(m, "Features\t\t:");
> - if (cpu_has_cpucfg) seq_printf(m, " cpucfg");
> - if (cpu_has_lam) seq_printf(m, " lam");
[etc]
> + seq_puts(m, "Features\t\t:");
> + if (cpu_has_cpucfg)
> + seq_puts(m, " cpucfg");
> + if (cpu_has_lam)
> + seq_puts(m, " lam");

trivia:

Not sure this is better style as it's fairly difficult to read.

Maybe a macro might help, something like:

#define seq_cpu_feature(m, feature) \
if (cpu_has_##feature) seq_puts(m, " " #feature)

seq_cpu_feature(m, cpucfg);
seq_cpu_feature(m, lam);

etc.