devm_nvmem_device_get(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… devm_nvmem_device_get β€” a Kernel API Manual moment

okay so bestie, welcome to the Kernel API Manual page for devm_nvmem_device_get ✨ this one is lowkey iconic: it's how you pull an nvmem device out of a given id, and the kernel literally handles the cleanup for you. devm = "devres" = "don't worry about freeing it, the device will do it for you" 🫢


🌸 NAME 🌸

devm_nvmem_device_get β€” get the nvmem device of a device from a given id πŸ’–


✨ SYNOPSIS ✨

struct nvmem_device * devm_nvmem_device_get (struct device *dev , const
char *id );

like, yes, the signature really is wrapped across two lines in the original β€” we don't gatekeep formatting here πŸŽ€


🎯 ARGUMENTS 🎯

  • dev β€” the device that's requesting the nvmem device. it's giving "main character energy" β€” this is the device whose lifetime the whole thing is tied to πŸ’«
  • id β€” the name id for the requested nvmem device. iykyk, you need to know what you're asking for πŸ‘‘

πŸ”₯ RETURN πŸ”₯

ERR_PTR on error, or a valid pointer to a struct nvmem_device on success. periodt. πŸ’…

and here's the slay part: the nvmem_device will be freed automatically once the device is freed. not me having to call a put function?? couldn't be her. the devm machinery ate and left no crumbs πŸ“


πŸ‘€ SEE ALSO πŸ‘€

Kernel file ./drivers/nvmem/core.c β€” literally where the magic lives, go read it 🧚

like, that's the whole nvmem friend group and they're all invited to the group chat πŸ’œ


ngl this page lives in ./drivers/nvmem, and it's dated October 2026 β€” so yeah, she's from the future, we stan a forward-thinking API 🌈⭐

okay bestie that's the whole page, go forth and devm_nvmem_device_get responsibly, mwah πŸ’‹πŸ¦‹

πŸ“¦ where this page comes from