[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2fb11c0970da307cf8cf4f35d35c49f78f82ee72.camel@perches.com>
Date: Fri, 05 Sep 2025 11:22:44 -0700
From: Joe Perches <joe@...ches.com>
To: vivek yadav <vivekyadav1207731111@...il.com>, "Rafael J. Wysocki"
<rafael@...nel.org>
Cc: 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 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.
$ 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
Powered by blists - more mailing lists