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: accel: bmc150-accel-core: use sysfs_emit() in show functions

Replace sprintf() with sysfs_emit() in sysfs attribute show
callbacks. sysfs_emit() is the preferred API as it is aware of the
sysfs buffer page size limit.

Signed-off-by: Gabriel Rondon <grondon@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Gabriel Rondon and committed by
Jonathan Cameron
7198b881 8abf158b

+2 -2
+2 -2
drivers/iio/accel/bmc150-accel-core.c
··· 851 851 wm = data->watermark; 852 852 mutex_unlock(&data->mutex); 853 853 854 - return sprintf(buf, "%d\n", wm); 854 + return sysfs_emit(buf, "%d\n", wm); 855 855 } 856 856 857 857 static ssize_t bmc150_accel_get_fifo_state(struct device *dev, ··· 866 866 state = data->fifo_mode; 867 867 mutex_unlock(&data->mutex); 868 868 869 - return sprintf(buf, "%d\n", state); 869 + return sysfs_emit(buf, "%d\n", state); 870 870 } 871 871 872 872 static const struct iio_mount_matrix *