of_nvmem_device_get(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… of_nvmem_device_get(9) β€” Kernel API Manual, bestie edition

okay so real talk: this page lives in the Kernel API Manual, and it's about snagging an nvmem device when all you've got is a device tree node and a name. it's short, it's sweet, it's giving "small function, big responsibility." let's get into it 🫢


✨ NAME ✨

of_nvmem_device_get β€” get the nvmem device from a given id, no cap πŸ’–


🌸 SYNOPSIS 🌸

struct nvmem_device * of_nvmem_device_get (struct device_node *np ,
const char *id );

like, you hand it a node and a name, it hands you back a struct nvmem_device *. simple as that ✨


πŸŽ€ ARGUMENTS πŸŽ€

  • np β€” the device tree node that's using the nvmem device. this is the "where am i" of the situation 🌳
  • id β€” the nvmem name, pulled straight out of the nvmem-names property. iykyk, that property is doing the heavy lifting here πŸ’…

πŸ¦‹ RETURN πŸ¦‹

you get ERR_PTR if it goes sideways 😭, or a valid pointer to a struct nvmem_device if it slays πŸ‘‘.

fr fr, check that pointer before you dereference it. ERR_PTR is not a vibe you want to walk into πŸ™ˆ

πŸ”₯ SEE ALSO πŸ”₯

so many friends in the nvmem cinematic universe, and they're all literally in the kernel file ./drivers/nvmem/core.c β€” go read it, it's iconic ⭐


k bye bestie, go get that device pointer πŸ§šπŸ’œ this one's from the ./drivers/nvmem corner of the tree, dated October 2026, and yeah β€” it's still called of_nvmem_device_get(9), iconic behavior honestly πŸŽ€

πŸ“¦ where this page comes from