Re: [PATCH] iio: imu: inv_mpu6050: Replace scnprintf with sysfs_emit
From: Andy Shevchenko
Date: Tue Jul 01 2025 - 09:55:31 EST
On Tue, Jul 01, 2025 at 04:39:45AM -0700, Chelsy Ratnawat wrote:
> Documentation/filesystems/sysfs.rst mentions that show() should only
> use sysfs_emit() or sysfs_emit_at() when formating the value to be
> returned to user space. So replace scnprintf() with sysfs_emit().
...
> case ATTR_ACCL_MATRIX:
> m = st->plat_data.orientation;
>
> - return scnprintf(buf, PAGE_SIZE,
> + return sysfs_emit(buf,
> "%d, %d, %d; %d, %d, %d; %d, %d, %d\n",
Now this fits one line
return sysfs_emit(buf, "%d, %d, %d; %d, %d, %d; %d, %d, %d\n",
> m[0], m[1], m[2], m[3], m[4], m[5], m[6], m[7], m[8]);
--
With Best Regards,
Andy Shevchenko