mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: vivek yadav <vivekyadav1207731111@gmail.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>
Cc: daniel.lezcano@linaro.org, linux-kernel@vger.kernel.org,
	 linux-pm@vger.kernel.org
Subject: Re: [PATCH] cpuidle: sysfs: Use sysfs_emit/sysfs_emit_at instead of sprintf/scnprintf
Date: Fri, 05 Sep 2025 11:22:44 -0700	[thread overview]
Message-ID: <2fb11c0970da307cf8cf4f35d35c49f78f82ee72.camel@perches.com> (raw)
In-Reply-To: <CABPSWR5cG=xTA72BHayYQTb=24VS3N+=dbsiMcU+gyqTKvNXAQ@mail.gmail.com>

On Fri, 2025-09-05 at 22:57 +0530, vivek yadav wrote:
> On Mon, Aug 25, 2025 at 8:58 PM <vivekyadav1207731111@gmail.com> wrote:
> > > 
> > > From: Vivek Yadav <vivekyadav1207731111@gmail.com>
> > > 
> > > The ->show() callbacks in sysfs should use sysfs_emit() or
> > > sysfs_emit_at() 
[]
> > > diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
[]
> > > @@ -22,21 +22,21 @@ static ssize_t show_available_governors(struct device *dev,
> > >                                         struct device_attribute *attr,
> > >                                         char *buf)
> > >  {
> > > -       ssize_t i = 0;
> > > +       ssize_t len = 0;
> > 
> > The variable rename is not necessary or even useful AFAICS ->
> 
> There is no harm if we leave the variable name as 'i' but it would be better
> if we give it a suitable name like 'offset'. It will definitely improve
> readability.

size and len are most commonly used.
I prefer len.

$ git grep -P -oh '\w+\s+\+=\s*sysfs_emit_at' | \
  sort | uniq -c | sort -rn
    361 size += sysfs_emit_at
    187 len += sysfs_emit_at
    144 n += sysfs_emit_at
     69 count += sysfs_emit_at
     60 rc += sysfs_emit_at
     51 offset += sysfs_emit_at
     43 ret += sysfs_emit_at
     27 rb += sysfs_emit_at
     16 res += sysfs_emit_at
      7 pos += sysfs_emit_at
      7 i += sysfs_emit_at
      5 length += sysfs_emit_at
      4 used += sysfs_emit_at
      4 nchars += sysfs_emit_at
      4 at += sysfs_emit_at
      3 sz += sysfs_emit_at
      3 l += sysfs_emit_at
      3 buf_len += sysfs_emit_at
      2 status += sysfs_emit_at
      2 idx += sysfs_emit_at
      1 n_written += sysfs_emit_at
      1 cnt += sysfs_emit_at

  reply	other threads:[~2025-09-05 18:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-25 18:58 vivekyadav1207731111
2025-09-04 19:35 ` Rafael J. Wysocki
2025-09-05 17:27   ` vivek yadav
2025-09-05 18:22     ` Joe Perches [this message]
2025-09-05 18:34       ` Rafael J. Wysocki
2025-09-06  7:13         ` Joe Perches
2025-09-06 17:22           ` vivek yadav
2025-09-14 15:20             ` vivek yadav
2025-09-15 14:31               ` Rafael J. Wysocki
2025-09-19 16:56                 ` [PATCH v2] " vivekyadav1207731111
2025-09-20 11:07                   ` Rafael J. Wysocki

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=2fb11c0970da307cf8cf4f35d35c49f78f82ee72.camel@perches.com \
    --to=joe@perches.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=vivekyadav1207731111@gmail.com \
    /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

all inboxes | Powered by JetHome®