[PATCH 11/12] rtc: ds1307: use sysfs_emit() instead of sprintf()

From: alexandre . belloni

Date: Thu Oct 29 2026 - 09:42:26 EST


From: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>

Use sysfs_emit() instead of sprintf() in the sysfs show callback
(ds3231_hwmon_show_temp) 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-ds1307.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 8627f84232ce..206a79d28568 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -1380,7 +1380,7 @@ static ssize_t ds3231_hwmon_show_temp(struct device *dev,
if (ret)
return ret;

- return sprintf(buf, "%d\n", temp);
+ return sysfs_emit(buf, "%d\n", temp);
}
static SENSOR_DEVICE_ATTR(temp1_input, 0444, ds3231_hwmon_show_temp,
NULL, 0);
--
2.56.0