From: Joe Perches <joe@perches.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: vivek yadav <vivekyadav1207731111@gmail.com>,
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: Sat, 06 Sep 2025 00:13:41 -0700 [thread overview]
Message-ID: <99c1c03a9f7fe55b8f73e5574612dc3e1cd1af55.camel@perches.com> (raw)
In-Reply-To: <CAJZ5v0iAfgE4RkVXH7GaG9SqvGa0VfVuFi_cLd0utC8oPY0Fkg@mail.gmail.com>
On Fri, 2025-09-05 at 20:34 +0200, Rafael J. Wysocki wrote:
> On Fri, Sep 5, 2025 at 8:22 PM Joe Perches <joe@perches.com> wrote:
> >
> > 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.
>
> Fine, in new code, use whatever you like, but what really is the
> reason for doing a rename in code that has been almost unchanged since
> 2.6.22?
If a sprintf -> sysfs_emit conversion is done, it's IMO better
style to be consistent with the typical sysfs_emit uses.
next prev parent reply other threads:[~2025-09-06 7: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
2025-09-05 18:34 ` Rafael J. Wysocki
2025-09-06 7:13 ` Joe Perches [this message]
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=99c1c03a9f7fe55b8f73e5574612dc3e1cd1af55.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®