Re: [PATCH] iio: cros_ec: use sysfs_emit() in show callbacks

From: Andy Shevchenko

Date: Wed Nov 11 2026 - 09:41:17 EST


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.)

--
With Best Regards,
Andy Shevchenko