Re: [PATCH] iio: cros_ec: use sysfs_emit() in show callbacks
From: Jonathan Cameron
Date: Wed Nov 11 2026 - 21:11:09 EST
On Wed, 11 Nov 2026 16:39:37 +0200
Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:
> On Wed, Nov 11, 2026 at 07:26:08AM +0000, Di Wu wrote:
> > Replace sprintf() and snprintf() with sysfs_emit() in the sysfs show
> > and ext_info read callbacks. sysfs_emit() is aware of the sysfs buffer
> > PAGE_SIZE limit and is the preferred helper for show callbacks.
>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
>
> ...
>
> > - return sprintf(buf, "%d.%06u\n",
> > - latency / 1000,
> > - (latency % 1000) * 1000);
> > + return sysfs_emit(buf, "%d.%06u\n",
> > + latency / 1000,
> > + (latency % 1000) * 1000);
>
> As David said, since you touched these lines, make the less amount of them
> while at it.
>
> (But no need to resend, usually Jonathan is kind to tweak this small thing.)
>
Done and applied.