of_property_read_reg(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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:


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