Commit f9e51aac authored by ye xingchen's avatar ye xingchen Committed by Jonathan Cameron

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: default avatarye xingchen <ye.xingchen@zte.com.cn>
Link: https://lore.kernel.org/r/202212011156314630626@zte.com.cnSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 7ae26795
...@@ -400,12 +400,12 @@ static ssize_t scmi_iio_get_raw_available(struct iio_dev *iio_dev, ...@@ -400,12 +400,12 @@ static ssize_t scmi_iio_get_raw_available(struct iio_dev *iio_dev,
rem = do_div(resolution, rem = do_div(resolution,
int_pow(10, abs(exponent)) int_pow(10, abs(exponent))
); );
len = scnprintf(buf, PAGE_SIZE, len = sysfs_emit(buf,
"[%lld %llu.%llu %lld]\n", min_range, "[%lld %llu.%llu %lld]\n", min_range,
resolution, rem, max_range); resolution, rem, max_range);
} else { } else {
resolution = resolution * int_pow(10, exponent); resolution = resolution * int_pow(10, exponent);
len = scnprintf(buf, PAGE_SIZE, "[%lld %llu %lld]\n", len = sysfs_emit(buf, "[%lld %llu %lld]\n",
min_range, resolution, max_range); min_range, resolution, max_range);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment