devm_nvmem_device_get(9)
π 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 π§
nvmem_add_one_cell(9)nvmem_add_cells(9)nvmem_register_notifier(9)nvmem_unregister_notifier(9)nvmem_register(9)nvmem_unregister(9)devm_nvmem_register(9)of_nvmem_device_get(9)nvmem_device_get(9)nvmem_device_find(9)devm_nvmem_device_put(9)nvmem_device_put(9)of_nvmem_cell_get(9)nvmem_cell_get(9)devm_nvmem_cell_get(9)devm_nvmem_cell_put(9)nvmem_cell_put(9)nvmem_cell_read(9)nvmem_cell_write(9)nvmem_cell_read_u8(9)nvmem_cell_read_u16(9)nvmem_cell_read_u32(9)nvmem_cell_read_u64(9)nvmem_cell_read_variable_le_u32(9)nvmem_cell_read_variable_le_u64(9)nvmem_device_cell_read(9)nvmem_device_cell_write(9)nvmem_device_read(9)nvmem_device_write(9)nvmem_add_cell_lookups(9)nvmem_del_cell_lookups(9)nvmem_dev_name(9)nvmem_dev_size(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms