of_reserved_..._init_by_idx(9)
π of_reserved_..._init_by_idx(9) π
okay so picture this: it's a Kernel API Manual page, section 9 of the manual, and the star of the show is of_reserved_mem_device_init_by_idx. yes bestie, that's the whole name, we're not abbreviating, we're not being shy about it π
β¨ NAME β¨
of_reserved_mem_device_init_by_idx β assign reserved memory region to given device π«Ά
like literally, you hand a device its very own reserved memory region. it's giving "this is mine, don't touch" energy.
πΈ SYNOPSIS πΈ
int of_reserved_mem_device_init_by_idx (struct device *dev , struct
device_node *np , int idx );
three args, one int coming back at you. no cap.
π¦ ARGUMENTS π¦
devβ Pointer to the device to configure π this is the main character, the one getting set up.npβ Pointer to thedevice_nodewith 'reserved-memory' property. it's the node that knows where the goods are.idxβ Index of selected region. yes bestie, there's an index, so there can be multiple regions. slay.
π DESCRIPTION π
so what does this iconic function actually do? it assigns respective DMA-mapping operations based on the reserved memory region specified by the 'memory-region' property in the np node β and it does that for the dev device. that's the whole vibe check β¨
and here's the tea β: when a driver needs to use more than one reserved memory region, it should allocate child devices and initialize regions by name for each of the child device. one region, one child device, initialize-by-name each time. periodt.
hi bestie, it returns an error code or zero on success π so like, always check the return value, fr fr. zero = you ate. error code = not me crying.
π₯ SEE ALSO π₯
the kernel file for this one lives right here:
./drivers/of/of_reserved_mem.c
and ooh, the friend group is large, we love a big squad π:
fdt_scan_reserved_mem_late(9)fdt_fixup_reserved_mem_node(9)fdt_validate_reserved_mem_node(9)__reserved_mem_init_node(9)fdt_init_reserved_mem_node(9)of_reserved_mem_device_init_by_name(9)of_reserved_mem_device_release(9)devm_of_reserved_mem_device_init(9)of_reserved_mem_lookup(9)of_reserved_mem_region_to_resource(9)of_reserved_mem_region_to_resource_byname(9)of_reserved_mem_region_count(9)
and that's the page, bestie π§ this little beauty comes from ./drivers/of, dated October 2026 β so go forth, reserve that memory, initialize that device, and remember: of_reserved_mem_device_release(9) exists because cleanup is self-care ππ
π¦ 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