[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5770eef8d028b4e1778ccee21433ac753e439223.camel@perches.com>
Date: Sat, 10 Jan 2026 10:04:49 -0800
From: Joe Perches <joe@...ches.com>
To: George Guo <dongtai.guo@...ux.dev>, chenhuacai@...nel.org
Cc: guodongtai@...inos.cn, hengqi.chen@...il.com, kernel@...0n.name,
lianyangyang@...inos.cn, linux-kernel@...r.kernel.org,
loongarch@...ts.linux.dev, r@....cc, xry111@...111.site
Subject: Re: [PATCH v10 loongarch-next 3/3] LoongArch: Replace seq_printf
with seq_puts for simple strings
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.
Powered by blists - more mailing lists