mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
rtc: ds1685: use sysfs_emit() instead of sprintf()
Use sysfs_emit() instead of sprintf() in sysfs show callbacks (ds1685_rtc_sysfs_battery_show, ds1685_rtc_sysfs_auxbatt_show and ds1685_rtc_sysfs_serial_show) to conform to the recommended sysfs attribute formatting guidelines in Documentation/filesystems/sysfs.rst. Acked-by: Joshua Kinard <linux@kumba.dev> Link: https://patch.msgid.link/20261029132339.925021-9-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
This commit is contained in:
parent
67b3eadfb8
commit
edd541b0ff
|
|
@ -988,8 +988,8 @@ ds1685_rtc_sysfs_battery_show(struct device *dev,
|
|||
|
||||
ctrld = rtc->read(rtc, RTC_CTRL_D);
|
||||
|
||||
return sprintf(buf, "%s\n",
|
||||
(ctrld & RTC_CTRL_D_VRT) ? "ok" : "not ok or N/A");
|
||||
return sysfs_emit(buf, "%s\n",
|
||||
(ctrld & RTC_CTRL_D_VRT) ? "ok" : "not ok or N/A");
|
||||
}
|
||||
static DEVICE_ATTR(battery, S_IRUGO, ds1685_rtc_sysfs_battery_show, NULL);
|
||||
|
||||
|
|
@ -1010,8 +1010,8 @@ ds1685_rtc_sysfs_auxbatt_show(struct device *dev,
|
|||
ctrl4a = rtc->read(rtc, RTC_EXT_CTRL_4A);
|
||||
ds1685_rtc_switch_to_bank0(rtc);
|
||||
|
||||
return sprintf(buf, "%s\n",
|
||||
(ctrl4a & RTC_CTRL_4A_VRT2) ? "ok" : "not ok or N/A");
|
||||
return sysfs_emit(buf, "%s\n",
|
||||
(ctrl4a & RTC_CTRL_4A_VRT2) ? "ok" : "not ok or N/A");
|
||||
}
|
||||
static DEVICE_ATTR(auxbatt, S_IRUGO, ds1685_rtc_sysfs_auxbatt_show, NULL);
|
||||
|
||||
|
|
@ -1032,7 +1032,7 @@ ds1685_rtc_sysfs_serial_show(struct device *dev,
|
|||
ds1685_rtc_get_ssn(rtc, ssn);
|
||||
ds1685_rtc_switch_to_bank0(rtc);
|
||||
|
||||
return sprintf(buf, "%8phC\n", ssn);
|
||||
return sysfs_emit(buf, "%8phC\n", ssn);
|
||||
}
|
||||
static DEVICE_ATTR(serial, S_IRUGO, ds1685_rtc_sysfs_serial_show, NULL);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user