iio: common: scmi_iio: use sysfs_emit() to instead of scnprintf()
authorye xingchen <ye.xingchen@zte.com.cn>
Thu, 1 Dec 2022 03:56:31 +0000 (11:56 +0800)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 28 Dec 2022 17:19:45 +0000 (17:19 +0000)
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>
drivers/iio/common/scmi_sensors/scmi_iio.c

index d92f7f651f7b3f402f03f3132216ec60ad44c638..0c2caf3570db9729fadfbeb509e0218b7fd45d8d 100644 (file)
@@ -400,12 +400,12 @@ static ssize_t scmi_iio_get_raw_available(struct iio_dev *iio_dev,
                        rem = do_div(resolution,
                                     int_pow(10, abs(exponent))
                                     );
-                       len = scnprintf(buf, PAGE_SIZE,
+                       len = sysfs_emit(buf,
                                        "[%lld %llu.%llu %lld]\n", min_range,
                                        resolution, rem, max_range);
                } else {
                        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);
                }
        }