DEVICE_ATTR_RW_NAMED(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– DEVICE_ATTR_RW_NAMED πŸ’–

okay bestie, so this one lives in the Kernel API Manual and it's genuinely so cute β€” it's the macro that lets you make a read-write device attribute whose sysfs name is not the same as the function name. like, the glow-up where the vibe check name and the government name are two different things πŸ¦‹


✨ NAME ✨

DEVICE_ATTR_RW_NAMED β€” define a read-write device attribute where the sysfs name is lowkey different from the function name. that's the whole thing, no cap πŸ’…


🌸 SYNOPSIS 🌸

DEVICE_ATTR_RW_NAMED (_name , _attrname );

πŸŽ€ ARGUMENTS πŸŽ€

  • _name β€” the attribute function preface, aka the little name-bit that goes on the function side of things 🫢
  • _attrname β€” the attribute name as it wil be exposed in the sysfs. this is the name the world actually sees, so pick a good one ✨

πŸ’œ DESCRIPTION πŸ’œ

so it's literally like DEVICE_ATTR_RW, bestie β€” same energy, same read-write slay β€” except it also lets you reuse names under separate paths in the same driver. iconic behaviour honestly πŸ‘‘

like yes you're reusing the name, but it's fine because the paths are different. it's giving "same name, different context," and it works πŸ”₯


πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file ./include/linux/device.h β€” and then the whole extended friend group, all of them, no one left out of the group chat πŸ’–

go read them all, i'll wait πŸ’€


reminder bestie: this page ships out of ./include/linux, dated October 2026 β€” that's the source and the date, written down so we never forget πŸ—“οΈπŸ’–

and that's the page!! mwah, go name some attributes, you're gonna slay πŸ§šβ€β™€οΈπŸŒˆβ­ πŸŽ€

πŸ“¦ where this page comes from