docs: filesystems: sysfs: Make text and code for ->show() consistent
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 28 Sep 2022 13:57:41 +0000 (16:57 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 30 Sep 2022 12:53:13 +0000 (14:53 +0200)
The documentation says that ->show() should only use sysfs_emit() or
sysfs_emit_at(), but example keeps outdated code. Update the code to
be consistent.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220928135741.54919-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Documentation/filesystems/sysfs.rst

index 004d490179f32ee5d0fe43183ec50bc4a684a145..8bba676b1365d72ad2af0ee3ed13710e5e92db6c 100644 (file)
@@ -263,7 +263,7 @@ A very simple (and naive) implementation of a device attribute is::
     static ssize_t show_name(struct device *dev, struct device_attribute *attr,
                            char *buf)
     {
-           return scnprintf(buf, PAGE_SIZE, "%s\n", dev->name);
+           return sysfs_emit(buf, "%s\n", dev->name);
     }
 
     static ssize_t store_name(struct device *dev, struct device_attribute *attr,