of_property...le_u16_array(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– of_property...le_u16_array(9) πŸ’–

okay so bestie, welcome to the Kernel API Manual, section 9 β€” this is the page for of_property_read_variable_u16_array, and honestly? it's giving "small function, big responsibility." let's get into it πŸŽ€


✨ NAME ✨

of_property_read_variable_u16_array β€” find and read an array of u16 from a property, with bounds on the minimum and maximum array size.

like, it's a scavenger hunt but for 16-bit numbers, and you get to say how many are allowed to show up πŸ¦‹


🌸 SYNOPSIS 🌸

int of_property_read_variable_u16_array (const struct device_node *np ,
const char *propname , u16 *out_values , size_t sz_min , size_t sz_max
);

she returns an int, she takes five args, she's iconic, periodt ✨


🫢 ARGUMENTS 🫢

  • np β€” device node from which the property value is to be read. this is the main character node you're digging through πŸ”
  • propname β€” name of the property to be searched. the thing you're looking for, iykyk
  • out_values β€” pointer to found values. this is where the good stuff gets written πŸ’…
  • sz_min β€” minimum number of array elements to read. you must have at least this many, no exceptions
  • sz_max β€” maximum number of array elements to read, if zero there is no upper limit on the number of elements in the dts entry but only sz_min will be read. so zero = "no ceiling, but also we're only grabbing sz_min of them," which is lowkey a vibe of its own 😭

πŸ’€ DESCRIPTION πŸ’€

search for a property in a device node and read 16-bit value(s) from it. that's the whole mission, fr fr 🌈

the dts entry of array should be like:

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

the out_values is modified only if a valid u16 value can be decoded. so no half-baked writes, no garbage data sneaking into your buffer β€” she's careful with her output and we respect that πŸ’œ


πŸ”₯ RETURN πŸ”₯

  • the number of elements read on success πŸŽ‰ (yes, it's a count, not a bool, keep up bestie)
  • -EINVAL if the property does not exist
  • -ENODATA if property does not have a value
  • -EOVERFLOW if the property data is smaller than sz_min or longer than sz_max
ngl, -EOVERFLOW is the "too much / not enough" of error codes β€” both directions will get you πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘

kernel file ./drivers/of/property.c, plus literally the entire friend group:

of_property_read_bool(9), of_graph_is_present(9), of_property_count_elems_of_size(9), of_find_property_value_of_size(9), of_property_read_u8_index(9), of_property_read_u16_index(9), of_property_read_u32_index(9), of_property_read_u64_index(9), of_property_read_variable_u8_array(9), of_property_read_variable_u32_array(9), of_property_read_u64(9), of_property_read_variable_u64_array(9), of_property_read_string(9), of_property_match_string(9), of_property_read_string_helper(9), of_graph_parse_endpoint(9), of_graph_get_port_by_id(9), of_graph_get_next_port(9), of_graph_get_next_port_endpoint(9), of_graph_get_next_endpoint(9), of_graph_get_endpoint_by_regs(9), of_graph_get_remote_endpoint(9), of_graph_get_port_parent(9), of_graph_get_remote_port_parent(9), of_graph_get_remote_port(9), of_graph_get_endpoint_count(9), of_graph_get_port_count(9), of_graph_get_remote_node(9), parse_prop_cells(9), parse_suffix_prop_cells(9), struct supplier_bindings(9), of_link_property(9)

like, that's a whole group chat and every single one of them is in the reading list πŸ’…


mwah, that's the whole page 🫢 this beauty lives in ./drivers/of, dated October 2026, and it's part of the Kernel API Manual, section 9 β€” go read it, slay, and don't forget your sz_max 🌸✨

πŸ“¦ where this page comes from