of_property_...ble_u8_array(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… of_property_read_variable_u8_array β€” a whole vibe check for your device tree arrays ✨

Okay bestie, so we're deep in the Kernel API Manual today and the function we're stanning is of_property_read_variable_u8_array. It's giving "find and read an array of u8 from a property, with bounds on the minimum and maximum array size" and honestly? Iconic. πŸŽ€

It lives in ./drivers/of (the device tree corner of the kernel, iykyk) and we are going to get through this together, no cap. πŸ¦‹


🌸 SYNOPSIS 🌸

Like, here's the whole signature, copy it exactly bestie:

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

✨ ARGUMENTS ✨

Every single one matters, so let's go through them one by one:

  • np β€” the device node from which the property value is to be read. Like, this is the node you're snooping through. πŸ”
  • propname β€” name of the property to be searched. The thing you're looking for, periodt.
  • out_values β€” pointer to found values. This is where the good stuff lands. πŸ’–
  • sz_min β€” minimum number of array elements to read. The floor, the bare minimum, the "you must have at least this many" energy.
  • sz_max β€” maximum number of array elements to read, and okay this part is important: 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 we're still only grabbing sz_min of them." Don't forget that. πŸ™ˆ

πŸ¦‹ DESCRIPTION πŸ¦‹

So what does it actually do? Search for a property in a device node and read 8-bit value(s) from it. Simple as that. 🧚

The dts entry of the array should be like this, exactly:

property = /bits/ 8 <0x50 0x60 0x70>;

And here's the safety girlboss detail: the out_values is modified only if a valid u8 value can be decoded. So no garbage data sneaking in. We love a careful king. πŸ‘‘


πŸ”₯ RETURN πŸ”₯

What comes back? Depends on how it goes, bestie:

  • The number of elements read on success. Slay. βœ…
  • -EINVAL if the property does not exist. It's just not there, babe. πŸ’€
  • -ENODATA if property does not have a value. Empty. Void. Nothing. 😭
  • -EOVERFLOW if the property data is smaller than sz_min or longer than sz_max. Too little or too much β€” both are a no from this function. 🚫

🌈 SEE ALSO 🌈

Okay this list is long but we do not skip, we respect the lore. Here's everything cross-referenced, character for character:

Kernel file ./drivers/of/property.c and all these besties:

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_u16_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).


πŸ’œ That's the whole page, bestie. Every flag, every error, every reference β€” all present and accounted for. Go read your device trees with confidence. 🌸

This lil manual page is brought to you by ./drivers/of, dated October 2026, and it's literally the of_property_...ble_u8_array(9) glow-up you didn't know you needed. Mwah. πŸ’‹πŸŽ€

πŸ“¦ where this page comes from