DEVICE_ATTR_RO(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… DEVICE_ATTR_RO(9) πŸ’…

ok so this is a page from the Kernel API Manual (yes, that's the manual name, and yes it's giving very serious business) and it's about one tiny macro that makes your life so much easier, bestie. buckle up πŸŽ€


✨ NAME ✨

DEVICE_ATTR_RO β€” Define a readable device attribute. literally that's it, that's the whole job 🫢


🌸 SYNOPSIS 🌸

DEVICE_ATTR_RO (_name );

that's the whole call. one argument. no drama. icon behavior honestly πŸ‘‘


πŸ¦‹ ARGUMENTS πŸ¦‹

  • _name β€” Attribute name. that's it. that's the parameter. it's the name of your attribute and it absolutely eats πŸ’…

πŸ’– DESCRIPTION πŸ’–

okay so here's the tea: this macro is Like DEVICE_ATTR, but with two little differences that make it supremely chill:

  • _mode is 0444
  • _show is <_name>_show

periodt. read-only, and the show function gets named after whatever you passed in. no cap, you literally don't have to spell anything out yourself β€” the macro handles the naming and the permissions for you, and honestly? obsessed 😭✨

fr fr double-check your <_name>_show function actually exists before you go compiling, iykyk πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘

okay this list is LONG and honestly lowkey iconic, so we're doing zero skipping. every single one, in order, exactly as written, no cap:

Kernel file ./include/linux/device.h

like, that's a whole friend group right there and they all slay in their own way πŸŒˆπŸ’œ


and that's the whole page, bestie!! πŸ§šβ€β™€οΈ this one came from the good people over at ./include/linux, dated October 2026, and the manual itself answers to the name DEVICE_ATTR_RO(9) β€” go read it again if you forgot already, no judgment, it's a lot πŸ˜­πŸ’– πŸŽ€

πŸ“¦ where this page comes from