All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fbdev: gbefb: convert sysfs snprintf to sysfs_emit
@ 2022-10-18  7:51 ` Xuezhi Zhang
  0 siblings, 0 replies; 4+ messages in thread
From: Xuezhi Zhang @ 2022-10-18  7:51 UTC (permalink / raw)
  To: zhangxuezhi1, deller, jiasheng; +Cc: linux-fbdev, dri-devel, linux-kernel

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/gbefb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/gbefb.c b/drivers/video/fbdev/gbefb.c
index 1582c718329c..000b4aa44241 100644
--- a/drivers/video/fbdev/gbefb.c
+++ b/drivers/video/fbdev/gbefb.c
@@ -1060,14 +1060,14 @@ static const struct fb_ops gbefb_ops = {
 
 static ssize_t gbefb_show_memsize(struct device *dev, struct device_attribute *attr, char *buf)
 {
-	return snprintf(buf, PAGE_SIZE, "%u\n", gbe_mem_size);
+	return sysfs_emit(buf, "%u\n", gbe_mem_size);
 }
 
 static DEVICE_ATTR(size, S_IRUGO, gbefb_show_memsize, NULL);
 
 static ssize_t gbefb_show_rev(struct device *device, struct device_attribute *attr, char *buf)
 {
-	return snprintf(buf, PAGE_SIZE, "%d\n", gbe_revision);
+	return sysfs_emit(buf, "%d\n", gbe_revision);
 }
 
 static DEVICE_ATTR(revision, S_IRUGO, gbefb_show_rev, NULL);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] fbdev: gbefb: convert sysfs snprintf to sysfs_emit
@ 2022-10-18  7:51 ` Xuezhi Zhang
  0 siblings, 0 replies; 4+ messages in thread
From: Xuezhi Zhang @ 2022-10-18  7:51 UTC (permalink / raw)
  To: zhangxuezhi1, deller, jiasheng; +Cc: linux-fbdev, linux-kernel, dri-devel

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/gbefb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/gbefb.c b/drivers/video/fbdev/gbefb.c
index 1582c718329c..000b4aa44241 100644
--- a/drivers/video/fbdev/gbefb.c
+++ b/drivers/video/fbdev/gbefb.c
@@ -1060,14 +1060,14 @@ static const struct fb_ops gbefb_ops = {
 
 static ssize_t gbefb_show_memsize(struct device *dev, struct device_attribute *attr, char *buf)
 {
-	return snprintf(buf, PAGE_SIZE, "%u\n", gbe_mem_size);
+	return sysfs_emit(buf, "%u\n", gbe_mem_size);
 }
 
 static DEVICE_ATTR(size, S_IRUGO, gbefb_show_memsize, NULL);
 
 static ssize_t gbefb_show_rev(struct device *device, struct device_attribute *attr, char *buf)
 {
-	return snprintf(buf, PAGE_SIZE, "%d\n", gbe_revision);
+	return sysfs_emit(buf, "%d\n", gbe_revision);
 }
 
 static DEVICE_ATTR(revision, S_IRUGO, gbefb_show_rev, NULL);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] fbdev: gbefb: convert sysfs snprintf to sysfs_emit
  2022-10-18  7:51 ` Xuezhi Zhang
@ 2022-10-18  8:29   ` Helge Deller
  -1 siblings, 0 replies; 4+ messages in thread
From: Helge Deller @ 2022-10-18  8:29 UTC (permalink / raw)
  To: Xuezhi Zhang, zhangxuezhi1, jiasheng; +Cc: linux-fbdev, linux-kernel, dri-devel

On 10/18/22 09:51, 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/gbefb.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/video/fbdev/gbefb.c b/drivers/video/fbdev/gbefb.c
> index 1582c718329c..000b4aa44241 100644
> --- a/drivers/video/fbdev/gbefb.c
> +++ b/drivers/video/fbdev/gbefb.c
> @@ -1060,14 +1060,14 @@ static const struct fb_ops gbefb_ops = {
>
>   static ssize_t gbefb_show_memsize(struct device *dev, struct device_attribute *attr, char *buf)
>   {
> -	return snprintf(buf, PAGE_SIZE, "%u\n", gbe_mem_size);
> +	return sysfs_emit(buf, "%u\n", gbe_mem_size);
>   }
>
>   static DEVICE_ATTR(size, S_IRUGO, gbefb_show_memsize, NULL);
>
>   static ssize_t gbefb_show_rev(struct device *device, struct device_attribute *attr, char *buf)
>   {
> -	return snprintf(buf, PAGE_SIZE, "%d\n", gbe_revision);
> +	return sysfs_emit(buf, "%d\n", gbe_revision);
>   }
>
>   static DEVICE_ATTR(revision, S_IRUGO, gbefb_show_rev, NULL);


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fbdev: gbefb: convert sysfs snprintf to sysfs_emit
@ 2022-10-18  8:29   ` Helge Deller
  0 siblings, 0 replies; 4+ messages in thread
From: Helge Deller @ 2022-10-18  8:29 UTC (permalink / raw)
  To: Xuezhi Zhang, zhangxuezhi1, jiasheng; +Cc: linux-fbdev, dri-devel, linux-kernel

On 10/18/22 09:51, 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/gbefb.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/video/fbdev/gbefb.c b/drivers/video/fbdev/gbefb.c
> index 1582c718329c..000b4aa44241 100644
> --- a/drivers/video/fbdev/gbefb.c
> +++ b/drivers/video/fbdev/gbefb.c
> @@ -1060,14 +1060,14 @@ static const struct fb_ops gbefb_ops = {
>
>   static ssize_t gbefb_show_memsize(struct device *dev, struct device_attribute *attr, char *buf)
>   {
> -	return snprintf(buf, PAGE_SIZE, "%u\n", gbe_mem_size);
> +	return sysfs_emit(buf, "%u\n", gbe_mem_size);
>   }
>
>   static DEVICE_ATTR(size, S_IRUGO, gbefb_show_memsize, NULL);
>
>   static ssize_t gbefb_show_rev(struct device *device, struct device_attribute *attr, char *buf)
>   {
> -	return snprintf(buf, PAGE_SIZE, "%d\n", gbe_revision);
> +	return sysfs_emit(buf, "%d\n", gbe_revision);
>   }
>
>   static DEVICE_ATTR(revision, S_IRUGO, gbefb_show_rev, NULL);


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-18  8:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-18  7:51 [PATCH] fbdev: gbefb: convert sysfs snprintf to sysfs_emit Xuezhi Zhang
2022-10-18  7:51 ` Xuezhi Zhang
2022-10-18  8:29 ` Helge Deller
2022-10-18  8:29   ` Helge Deller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.