Skip to contentSkip to conversation

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

PATCH Applied [email protected] 3 participants 3 messages Dec 1, 2022 – Dec 5, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

From: ye xingchen <[email protected]>

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

---
 drivers/iio/common/scmi_sensors/scmi_iio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/common/scmi_sensors/scmi_iio.c +2 -2
index d92f7f651f7b..0c2caf3570db 100644
@@ -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);
 		}
 	}
Signature · 1 line
2.25.1
maintainer Applied
#1 lore raw
Quoted 5 lines · On Thu, 1 Dec 2022 11:56:31 +0800 (CST) <[email protected]> wrote:

From: ye xingchen <[email protected]>

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

Applied. Cc'd scmi people as well just in case they are interested.

Quoted 23 lines
---
 drivers/iio/common/scmi_sensors/scmi_iio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/common/scmi_sensors/scmi_iio.c +2 -2
index d92f7f651f7b..0c2caf3570db 100644
@@ -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);
 		}
 	}
#2 lore raw
Quoted 9 lines · Jonathan Cameron
Quoted 5 lines · On Thu, 1 Dec 2022 11:56:31 +0800 (CST) <[email protected]> wrote:

From: ye xingchen <[email protected]>

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

Applied. Cc'd scmi people as well just in case they are interested.

Thanks Ye for the patch and Jonathan for Cc-in and applying.

Signature · 2 lines
Regards,
Sudeep