public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: George Guo <dongtai.guo@linux.dev>, chenhuacai@kernel.org
Cc: guodongtai@kylinos.cn, hengqi.chen@gmail.com, kernel@xen0n.name,
	 lianyangyang@kylinos.cn, linux-kernel@vger.kernel.org,
	loongarch@lists.linux.dev, 	r@hev.cc, xry111@xry111.site
Subject: Re: [PATCH v10 loongarch-next 3/3] LoongArch: Replace seq_printf with seq_puts for simple strings
Date: Sat, 10 Jan 2026 10:04:49 -0800	[thread overview]
Message-ID: <5770eef8d028b4e1778ccee21433ac753e439223.camel@perches.com> (raw)
In-Reply-To: <20260110131124.99866-4-dongtai.guo@linux.dev>

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.

  reply	other threads:[~2026-01-10 18:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-10 13:11 [PATCH v10 loongarch-next 0/3] LoongArch: Add 128-bit atomic cmpxchg support George Guo
2026-01-10 13:11 ` [PATCH v10 loongarch-next 1/3] LoongArch: Add SCQ support detection George Guo
2026-01-10 13:11 ` [PATCH v10 loongarch-next 2/3] LoongArch: Add 128-bit atomic cmpxchg support George Guo
2026-01-28  4:26   ` Huacai Chen
2026-02-16  7:32   ` Thomas Weißschuh
2026-01-10 13:11 ` [PATCH v10 loongarch-next 3/3] LoongArch: Replace seq_printf with seq_puts for simple strings George Guo
2026-01-10 18:04   ` Joe Perches [this message]
2026-01-11  1:48     ` Huacai Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5770eef8d028b4e1778ccee21433ac753e439223.camel@perches.com \
    --to=joe@perches.com \
    --cc=chenhuacai@kernel.org \
    --cc=dongtai.guo@linux.dev \
    --cc=guodongtai@kylinos.cn \
    --cc=hengqi.chen@gmail.com \
    --cc=kernel@xen0n.name \
    --cc=lianyangyang@kylinos.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=r@hev.cc \
    --cc=xry111@xry111.site \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox