[PATCH 08/12] rtc: ds1343: use sysfs_emit() instead of sprintf()

From: alexandre . belloni

Date: Thu Oct 29 2026 - 09:41:24 EST


From: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>

Use sysfs_emit() instead of sprintf() in sysfs show callbacks
(ds1343_show_glitchfilter and ds1343_show_tricklecharger) 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-ds1343.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-ds1343.c b/drivers/rtc/rtc-ds1343.c
index 22abec4ba656..0ec5eaba6bd4 100644
--- a/drivers/rtc/rtc-ds1343.c
+++ b/drivers/rtc/rtc-ds1343.c
@@ -94,9 +94,9 @@ static ssize_t ds1343_show_glitchfilter(struct device *dev,
glitch_filt_status = !!(data & DS1343_EGFIL);

if (glitch_filt_status)
- return sprintf(buf, "enabled\n");
+ return sysfs_emit(buf, "enabled\n");
else
- return sprintf(buf, "disabled\n");
+ return sysfs_emit(buf, "disabled\n");
}

static ssize_t ds1343_store_glitchfilter(struct device *dev,
@@ -180,7 +180,7 @@ static ssize_t ds1343_show_tricklecharger(struct device *dev,
}
}

- return sprintf(buf, "%s %s\n", diodes, resistors);
+ return sysfs_emit(buf, "%s %s\n", diodes, resistors);
}

static DEVICE_ATTR(trickle_charger, 0444, ds1343_show_tricklecharger, NULL);
--
2.56.0