Skip to contentSkip to conversation

video: fbdev: sm501fb: onvert sysfs snprintf to sysfs_emit

PATCH Applied Xuezhi Zhang 2 participants 2 messages Oct 18, 2022 Framebuffer layer

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 video: fbdev: sm501fb: onvert sysfs snprintf to sysfs_emit

From: Xuezhi Zhang <[email protected]>

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.

---
 drivers/video/fbdev/sm501fb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/sm501fb.c +1 -1
index fce6cfbadfd6..f743bfbde2a6 100644
@@ -1166,7 +1166,7 @@ static ssize_t sm501fb_crtsrc_show(struct device *dev,
 	ctrl = smc501_readl(info->regs + SM501_DC_CRT_CONTROL);
 	ctrl &= SM501_DC_CRT_CONTROL_SEL;
 
-	return snprintf(buf, PAGE_SIZE, "%s\n", ctrl ? "crt" : "panel");
+	return sysfs_emit(buf, "%s\n", ctrl ? "crt" : "panel");
 }
 
 /* sm501fb_crtsrc_show
Signature · 1 line
2.25.1
maintainer Applied
#1 lore raw
Quoted 7 lines · Xuezhi Zhang

From: Xuezhi Zhang <[email protected]>

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.

applied.
Thanks!
Helge

Quoted 17 lines
---
  drivers/video/fbdev/sm501fb.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/sm501fb.c +1 -1
index fce6cfbadfd6..f743bfbde2a6 100644
@@ -1166,7 +1166,7 @@ static ssize_t sm501fb_crtsrc_show(struct device *dev,
  	ctrl = smc501_readl(info->regs + SM501_DC_CRT_CONTROL);
  	ctrl &= SM501_DC_CRT_CONTROL_SEL;
 
-	return snprintf(buf, PAGE_SIZE, "%s\n", ctrl ? "crt" : "panel");
+	return sysfs_emit(buf, "%s\n", ctrl ? "crt" : "panel");
  }
 
  /* sm501fb_crtsrc_show