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

iio: common: scmi_iio: use sysfs_emit() to instead of scnprintf()

Replace the open-code with sysfs_emit() to simplify the code.

Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
Link: https://lore.kernel.org/r/202212011156314630626@zte.com.cn
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

ye xingchen and committed by
Jonathan Cameron
f9e51aac 7ae26795

+2 -2
+2 -2
drivers/iio/common/scmi_sensors/scmi_iio.c
··· 400 400 rem = do_div(resolution, 401 401 int_pow(10, abs(exponent)) 402 402 ); 403 - len = scnprintf(buf, PAGE_SIZE, 403 + len = sysfs_emit(buf, 404 404 "[%lld %llu.%llu %lld]\n", min_range, 405 405 resolution, rem, max_range); 406 406 } else { 407 407 resolution = resolution * int_pow(10, exponent); 408 - len = scnprintf(buf, PAGE_SIZE, "[%lld %llu %lld]\n", 408 + len = sysfs_emit(buf, "[%lld %llu %lld]\n", 409 409 min_range, resolution, max_range); 410 410 } 411 411 }