of_property_read_u16_array(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… of_property_read_u16_array(9) πŸ’…

okay so this is a page straight out of the Kernel API Manual, bestie β€” yes the actual kernel API manual, we're in the big leagues now πŸŽ€ β€” and it's all about of_property_read_u16_array, which is the little function that goes "hey, does this device node have that property? cool, gimme the 16-bit numbers in it" ✨


🌸 NAME 🌸

of_property_read_u16_array β€” find and read an array of u16 from a property. that's it, that's the whole vibe 🫢


πŸ¦‹ SYNOPSIS πŸ¦‹

int of_property_read_u16_array (const struct device_node *np , const
char *propname , u16 *out_values , size_t sz );

literally just copy that exactly, no cap πŸ’€


✨ ARGUMENTS ✨

  • np β€” the device node you're reading the property value from. your starting point, your main character 🫢
  • propname β€” the name of the property we're searching for, iykyk πŸ”
  • out_values β€” pointer to the return value. heads up: it only gets modified if the return value is 0, so don't go reading it before you check πŸ‘€
  • sz β€” how many array elements to read. the count, the amount, the numbers, periodt πŸ’…

🧚 DESCRIPTION 🧚

so what it does is: it searches for a property inside a device node and reads 16-bit value(s) out of it. simple, iconic, does exactly what it says 🌈

the dts entry of the array should look like this, exactly:

property = /bits/ 16 <0x5000 0x6000 0x7000>;

and one thing to really internalize: out_values is modified only if a valid u16 value can be decoded πŸ’– like, it's not gonna half-fill your buffer with nonsense and dip β€” no valid decode, no touch. respect.


πŸ”₯ RETURN πŸ”₯

  • 0 on success β€” slay, we ate πŸŽ‰
  • -EINVAL if the property does not exist β€” it's not there, bestie, it's giving nothing 😭
  • -ENODATA if the property does not have a value β€” the property exists but it's empty inside, relatable πŸ’€
  • -EOVERFLOW if the property data isn't large enough β€” not enough bytes to go around, overflow behavior, no cap ⚠️

πŸ‘‘ SEE ALSO πŸ‘‘

kernel file ./include/linux/of.h, plus the whole friend group:


and that's the whole page, bestie πŸ₯° sourced from ./include/linux, dated October 2026, still signed of_property_read_u16_array(9) β€” mwah, go read some device trees, ily πŸ’œπŸ¦‹πŸŽ€

πŸ“¦ where this page comes from