of_property...le_u16_array(9)
π 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, iykykout_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 exceptionssz_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 onlysz_minwill be read. so zero = "no ceiling, but also we're only grabbingsz_minof 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)
-EINVALif the property does not exist-ENODATAif property does not have a value-EOVERFLOWif the property data is smaller thansz_minor longer thansz_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
- 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