of_property_read_reg(9)
π of_property_read_reg(9) π
okay so bestie, welcome to the Kernel API Manual β section 9, kernel city, population: this function π. We're talking about of_property_read_reg, and yes it's a mouthful, but it's literally just a little lookup gremlin for device-tree "reg" entries. Let's get into it β¨
πΈ NAME πΈ
of_property_read_reg β grab the "reg" entry at the index you want, without translating it. raw dogging the address, no conversion, no glow-up π
π¦ SYNOPSIS π¦
int of_property_read_reg (struct device_node *np , int idx , u64 *addr ,
u64 *size );
like, that's the whole signature, no cap π«Ά
β ARGUMENTS β
npβ the device tree node you're pulling"reg"from. your main character node πidxβ which"reg"entry index you wanna read. pick a number, any number πaddrβ out-param city: the untranslated address gets returned here πsizeβ and here's where the entry size lands, bestie πΈ
π₯ DESCRIPTION π₯
So here's the vibe check: it returns -EINVAL if "reg" is not found π. no reg, no love.
But on success it returns 0, and both addr and size come back all filled in and cute. literally the perfect little two-for-one π
π SEE ALSO π
go touch grass in the kernel file ./drivers/of/address.c and then go say hi to the whole friend group:
of_translate_dma_region(9)of_dma_get_range(9)of_dma_get_max_cpu_address(9)of_dma_is_coherent(9)of_mmio_is_nonposted(9)of_address_to_resource(9)of_iomap(9)
okay that's the whole page, bestie, you ate that π
β¨ this one lives in ./drivers/of and it's serving October 2026 energy β mwah, go read some device trees, ily π«Άππ¦
π¦ 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