fbdev: gbefb: Convert sysfs snprintf to sysfs_emit
authorXuezhi Zhang <zhangxuezhi1@coolpad.com>
Tue, 18 Oct 2022 07:51:18 +0000 (15:51 +0800)
committerHelge Deller <deller@gmx.de>
Tue, 18 Oct 2022 08:28:41 +0000 (10:28 +0200)
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>
Signed-off-by: Helge Deller <deller@gmx.de>
drivers/video/fbdev/gbefb.c

index 1582c718329c7f1164540349a0fbf59af255058c..000b4aa442415d53d823ba4ff804347b3152c156 100644 (file)
@@ -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);