Re: [PATCH] iio: light: tsl2583: migrate to sysfs_emit() and sysfs_emit_at()
From: Andy Shevchenko
Date: Tue Jul 14 2026 - 04:53:56 EST
On Tue, Jul 14, 2026 at 01:08:33AM +0800, OrangeBlack0765@xxxxxxxxxxx wrote:
> Replace sprintf() with sysfs_emit() for single-value sysfs show
> functions, and use sysfs_emit_at() for lux_table_show() which
> concatenates multiple values. This ensures buffer safety and
> follows the modern kernel sysfs API.
...
> for (i = 0; i < ARRAY_SIZE(chip->als_settings.als_device_lux); i++) {
> - offset += sprintf(buf + offset, "%u,%u,%u,",
> + offset += sysfs_emit_at(buf, offset, "%u,%u,%u,",
> chip->als_settings.als_device_lux[i].ratio,
> chip->als_settings.als_device_lux[i].ch0,
> chip->als_settings.als_device_lux[i].ch1);
Now the indentation becomes broken.
> }
--
With Best Regards,
Andy Shevchenko