[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <99c1c03a9f7fe55b8f73e5574612dc3e1cd1af55.camel@perches.com>
Date: Sat, 06 Sep 2025 00:13:41 -0700
From: Joe Perches <joe@...ches.com>
To: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: vivek yadav <vivekyadav1207731111@...il.com>, daniel.lezcano@...aro.org,
linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org
Subject: Re: [PATCH] cpuidle: sysfs: Use sysfs_emit/sysfs_emit_at instead of
sprintf/scnprintf
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@...ches.com> wrote:
> >
> > On Fri, 2025-09-05 at 22:57 +0530, vivek yadav wrote:
> > > On Mon, Aug 25, 2025 at 8:58 PM <vivekyadav1207731111@...il.com> wrote:
> > > > >
> > > > > From: Vivek Yadav <vivekyadav1207731111@...il.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.
Powered by blists - more mailing lists