[PATCH 06/12] rtc: abx80x: use sysfs_emit() instead of sprintf()

From: alexandre . belloni

Date: Thu Oct 29 2026 - 09:35:05 EST


From: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>

Use sysfs_emit() instead of sprintf() in sysfs show callbacks
(autocalibration_show and oscillator_show) 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-abx80x.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/rtc/rtc-abx80x.c b/drivers/rtc/rtc-abx80x.c
index 1c69d0e2f940..a0d67818eb58 100644
--- a/drivers/rtc/rtc-abx80x.c
+++ b/drivers/rtc/rtc-abx80x.c
@@ -442,11 +442,11 @@ static ssize_t autocalibration_show(struct device *dev,
autocalibration = abx80x_rtc_get_autocalibration(dev->parent);
if (autocalibration < 0) {
dev_err(dev, "Failed to read RTC autocalibration\n");
- sprintf(buf, "0\n");
+ sysfs_emit(buf, "0\n");
return autocalibration;
}

- return sprintf(buf, "%d\n", autocalibration);
+ return sysfs_emit(buf, "%d\n", autocalibration);
}

static DEVICE_ATTR_RW(autocalibration);
@@ -490,14 +490,14 @@ static ssize_t oscillator_show(struct device *dev,

if (rc_mode < 0) {
dev_err(dev, "Failed to read RTC oscillator selection\n");
- sprintf(buf, "\n");
+ sysfs_emit(buf, "\n");
return rc_mode;
}

if (rc_mode)
- return sprintf(buf, "rc\n");
+ return sysfs_emit(buf, "rc\n");
else
- return sprintf(buf, "xtal\n");
+ return sysfs_emit(buf, "xtal\n");
}

static DEVICE_ATTR_RW(oscillator);
--
2.56.0