Skip to contentSkip to conversation

rtc: rv3028: use sysfs_emit() instead of sprintf()

PATCH Applied Akshat Rawat 3 participants 3 messages Oct 22 – Oct 29 Real time clock (RTC)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtc: rv3028: use sysfs_emit() instead of sprintf()

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

---
 drivers/rtc/rtc-rv3028.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/rtc/rtc-rv3028.c +3 -3
index d25e33d08..b3a5b1ef3 100644
@@ -147,8 +147,8 @@ static ssize_t timestamp0_show(struct device *dev,
 	if (ret)
 		return ret;
 
-	return sprintf(buf, "%llu\n",
-		       (unsigned long long)rtc_tm_to_time64(&tm));
+	return sysfs_emit(buf, "%llu\n",
+			  (unsigned long long)rtc_tm_to_time64(&tm));
 };
 
 static DEVICE_ATTR_RW(timestamp0);
@@ -164,7 +164,7 @@ static ssize_t timestamp0_count_show(struct device *dev,
 	if (ret)
 		return ret;
 
-	return sprintf(buf, "%u\n", count);
+	return sysfs_emit(buf, "%u\n", count);
 };
 
 static DEVICE_ATTR_RO(timestamp0_count);
Signature · 1 line
2.56.0.windows.2
#1 lore raw
Sashiko has reviewed this patch and found no issues.
Quoted 6 lines

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

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
maintainer Applied
#2 lore raw
In reply to Akshat Rawat
Quoted 4 lines · Akshat Rawat

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

Applied, thanks!

[1/1] rtc: rv3028: use sysfs_emit() instead of sprintf()

      https://git.kernel.org/abelloni/c/55bb5877494d

Best regards,

Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com