DEVICE_ATTR_RO_NAMED(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… DEVICE_ATTR_RO_NAMED(9) πŸ’…

okay so this is a page from the Kernel API Manual and it's literally about one little macro that lets you name your sysfs attribute whatever you want instead of being stuck with your function's name. bestie, the freedom. πŸ¦‹


✨ NAME ✨

DEVICE_ATTR_RO_NAMED β€” define a read-only device attribute, but the sysfs name gets to be different from the function name. icon behaviour, honestly πŸ‘‘


🌸 SYNOPSIS 🌸

DEVICE_ATTR_RO_NAMED (_name , _attrname );

πŸŽ€ ARGUMENTS πŸŽ€

  • _name β€” the attribute function preface, i.e. the name of the function doing the work 🫢
  • _attrname β€” the attribute name as it will be exposed in the sysfs. this is the one the world actually sees ✨

πŸ’– DESCRIPTION πŸ’–

so it's giving DEVICE_ATTR_RO energy, right? same read-only vibe. but the glow-up here is that it lets you reuse names under separate paths within the same driver πŸ’… like yes you can have the same attribute name living in two different spots and nothing is fighting. main character macro behaviour, no cap.

ngl it's the "same name, different path" friend. very much iykyk.

🌈 SEE ALSO 🌈

the whole friend group, fr fr β€” plus the kernel file ./include/linux/device.h:


and that's the whole page, bestie, you ate that πŸ“πŸ’œ

this one came out of ./include/linux in October 2026 β€” mwah, sending you off with a kiss and a DEVICE_ATTR_RO_NAMED(9) πŸ’‹

πŸ“¦ where this page comes from