diff mbox series

video: fbdev: sm501fb: onvert sysfs snprintf to sysfs_emit

Message ID 20221018062548.642910-1-zhangxuezhi3@gmail.com (mailing list archive)
State Superseded
Headers show
Series video: fbdev: sm501fb: onvert sysfs snprintf to sysfs_emit | expand

Commit Message

Xuezhi Zhang Oct. 18, 2022, 6:25 a.m. UTC
From: Xuezhi Zhang <zhangxuezhi1@coolpad.com>

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: Xuezhi Zhang <zhangxuezhi1@coolpad.com>
---
 drivers/video/fbdev/sm501fb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Helge Deller Oct. 18, 2022, 6:44 a.m. UTC | #1
On 10/18/22 08:25, Xuezhi Zhang wrote:
> From: Xuezhi Zhang <zhangxuezhi1@coolpad.com>
>
> 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: Xuezhi Zhang <zhangxuezhi1@coolpad.com>

applied.
Thanks!
Helge

> ---
>   drivers/video/fbdev/sm501fb.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/video/fbdev/sm501fb.c b/drivers/video/fbdev/sm501fb.c
> index fce6cfbadfd6..f743bfbde2a6 100644
> --- a/drivers/video/fbdev/sm501fb.c
> +++ b/drivers/video/fbdev/sm501fb.c
> @@ -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
diff mbox series

Patch

diff --git a/drivers/video/fbdev/sm501fb.c b/drivers/video/fbdev/sm501fb.c
index fce6cfbadfd6..f743bfbde2a6 100644
--- a/drivers/video/fbdev/sm501fb.c
+++ b/drivers/video/fbdev/sm501fb.c
@@ -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