Skip to content

Commit

Permalink
fbdev: gbefb: Convert sysfs snprintf to sysfs_emit
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Xuezhi Zhang authored and Helge Deller committed Oct 18, 2022
1 parent 9750737 commit 0a974e6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/video/fbdev/gbefb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0a974e6

Please sign in to comment.