Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: imu: inv_mpu6050: Replace scnprintf with sysfs_emit

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

Signed-off-by: Chelsy Ratnawat <chelsyratnawat2001@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Link: https://patch.msgid.link/20250701154720.54276-1-chelsyratnawat2001@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Chelsy Ratnawat and committed by
Jonathan Cameron
7bf7b62e 0f7797f6

+2 -3
+2 -3
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
··· 1382 1382 fifo_rate = INV_MPU6050_DIVIDER_TO_FIFO_RATE(st->chip_config.divider); 1383 1383 mutex_unlock(&st->lock); 1384 1384 1385 - return scnprintf(buf, PAGE_SIZE, "%u\n", fifo_rate); 1385 + return sysfs_emit(buf, "%u\n", fifo_rate); 1386 1386 } 1387 1387 1388 1388 /* ··· 1409 1409 case ATTR_ACCL_MATRIX: 1410 1410 m = st->plat_data.orientation; 1411 1411 1412 - return scnprintf(buf, PAGE_SIZE, 1413 - "%d, %d, %d; %d, %d, %d; %d, %d, %d\n", 1412 + return sysfs_emit(buf, "%d, %d, %d; %d, %d, %d; %d, %d, %d\n", 1414 1413 m[0], m[1], m[2], m[3], m[4], m[5], m[6], m[7], m[8]); 1415 1414 default: 1416 1415 return -EINVAL;