Skip to content

Commit 0feebde

Browse files
ye xingchenalexandrebelloni
authored andcommitted
rtc: ds1307: use sysfs_emit() to instead of scnprintf()
Follow the advice of the Documentation/filesystems/sysfs.rst and show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Signed-off-by: ye xingchen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
1 parent bb0a179 commit 0feebde

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/rtc/rtc-ds1307.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,8 +1219,7 @@ static ssize_t frequency_test_show(struct device *dev,
12191219

12201220
regmap_read(ds1307->regmap, M41TXX_REG_CONTROL, &ctrl_reg);
12211221

1222-
return scnprintf(buf, PAGE_SIZE, (ctrl_reg & M41TXX_BIT_FT) ? "on\n" :
1223-
"off\n");
1222+
return sysfs_emit(buf, (ctrl_reg & M41TXX_BIT_FT) ? "on\n" : "off\n");
12241223
}
12251224

12261225
static DEVICE_ATTR_RW(frequency_test);

0 commit comments

Comments
 (0)