[PATCH 05/12] rtc: x1205: use sysfs_emit() instead of sprintf()

From: alexandre . belloni

Date: Thu Oct 29 2026 - 09:39:50 EST


From: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>

Use sysfs_emit() instead of sprintf() in sysfs show callbacks
(x1205_sysfs_show_atrim and x1205_sysfs_show_dtrim) to conform to the
recommended sysfs attribute formatting guidelines in
Documentation/filesystems/sysfs.rst.

Signed-off-by: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>
---
drivers/rtc/rtc-x1205.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-x1205.c b/drivers/rtc/rtc-x1205.c
index bb1a5c86f621..6ca6ff45945e 100644
--- a/drivers/rtc/rtc-x1205.c
+++ b/drivers/rtc/rtc-x1205.c
@@ -575,7 +575,7 @@ static ssize_t x1205_sysfs_show_atrim(struct device *dev,
if (err)
return err;

- return sprintf(buf, "%d.%02d pF\n", atrim / 1000, atrim % 1000);
+ return sysfs_emit(buf, "%d.%02d pF\n", atrim / 1000, atrim % 1000);
}
static DEVICE_ATTR(atrim, S_IRUGO, x1205_sysfs_show_atrim, NULL);

@@ -588,7 +588,7 @@ static ssize_t x1205_sysfs_show_dtrim(struct device *dev,
if (err)
return err;

- return sprintf(buf, "%d ppm\n", dtrim);
+ return sysfs_emit(buf, "%d ppm\n", dtrim);
}
static DEVICE_ATTR(dtrim, S_IRUGO, x1205_sysfs_show_dtrim, NULL);

--
2.56.0