of_nvmem_device_get(9)
π 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 thenvmem-namesproperty. 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 β
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)nvmem_device_get(9)nvmem_device_find(9)devm_nvmem_device_put(9)nvmem_device_put(9)devm_nvmem_device_get(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)
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
- 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