mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] docs: sysfs: Align example callback names with __ATTR_RW
@ 2026-11-09 20:48 Mauro Codella
  0 siblings, 0 replies; only message in thread
From: Mauro Codella @ 2026-11-09 20:48 UTC (permalink / raw)
  To: corbet; +Cc: Mauro Codella, skhan, rdunlap, linux-doc, linux-kernel

The sysfs guide presents __ATTR_RW(foo) as a shorthand for the preceding
DEVICE_ATTR declaration and explicit struct device_attribute initializer.
Both preceding examples use show_foo and store_foo, but __ATTR_RW(_name)
uses token pasting with _name##_show and _name##_store, so __ATTR_RW(foo)
references foo_show and foo_store instead. Switching to the shorthand
without renaming the callbacks would fail to compile.

Rename the callbacks in both preceding examples to foo_show and foo_store
so all three examples agree. No kernel behavior is changed.

Codex identified the mismatch and assisted with the change and commit
message after a request to find a small kernel contribution.

Fixes: 44a47f0e3ec2 ("sysfs.txt: add note on available attribute macros")
Signed-off-by: Mauro Codella <mauro.codella@pm.me>
---
 Documentation/filesystems/sysfs.rst | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/filesystems/sysfs.rst b/Documentation/filesystems/sysfs.rst
index ffcef4d6b..94329668c 100644
--- a/Documentation/filesystems/sysfs.rst
+++ b/Documentation/filesystems/sysfs.rst
@@ -107,7 +107,7 @@ It also defines this helper for defining device attributes::
 
 For example, declaring::
 
-    static DEVICE_ATTR(foo, S_IWUSR | S_IRUGO, show_foo, store_foo);
+    static DEVICE_ATTR(foo, S_IWUSR | S_IRUGO, foo_show, foo_store);
 
 is equivalent to doing::
 
@@ -116,8 +116,8 @@ is equivalent to doing::
 		    .name = "foo",
 		    .mode = S_IWUSR | S_IRUGO,
 	    },
-	    .show = show_foo,
-	    .store = store_foo,
+	    .show = foo_show,
+	    .store = foo_store,
     };
 
 Note as stated in include/linux/sysfs.h "OTHER_WRITABLE?  Generally

base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
-- 
2.56.0



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-09 20:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-09 20:48 [PATCH] docs: sysfs: Align example callback names with __ATTR_RW Mauro Codella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®