of_property_read_string(9)
π of_property_read_string(9) β kernel API manual, but make it make sense π
okay bestie, this is the page for of_property_read_string(9) and honestly it's a whole vibe: it's the little function that goes digging in a device tree node and pulls out a string for you. let's get into it β¨
πΈ NAME πΈ
of_property_read_string β literally just "Find and read a string from a property". that's it, that's the whole job π
π¦ SYNOPSIS π¦
int of_property_read_string (const struct device_node *np , const char
*propname , const char **out_string );
three args, one int back, no drama π
π ARGUMENTS π
npβ the device node you're reading the property value from. your starting point, your main character node πpropnameβ the name of the property you're searching for. the thing you're hunting πout_stringβ a pointer to a null terminated return string. important bit: it only gets modified if the return value is0. so if things go sideways, your pointer stays untouched, no cap π
β DESCRIPTION β
so what it does is: search for a property inside a device tree node, and retrieve a null terminated string value. and here's the tea β it gives you a pointer to the data, not a copy. no duplicating, no malloc-ing, just vibes and a reference π«Ά
β οΈ careful bestie, there's a trap: the empty string""has length of1, which means-ENODATAcannot be interpreted as an empty string. so don't be out here thinking "no data" means "empty string" β it does not, fr fr π
and the out_string pointer is modified only if a valid string can be decoded. so like... it's picky, in a good way π
π₯ RETURN π₯
0β success, we ate, we slayed β¨-EINVALβ the property does not exist π-ENODATAβ the property exists but does not have a value π-EILSEQβ the string is not null-terminated within the length of the property data. messy. not iconic π
π SEE ALSO π
kernel file ./drivers/of/property.c, plus this whole friend group of related functions (yes, all of them, i'm not skipping a single one β we don't do that here π«Ά):
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_u16_array(9)of_property_read_variable_u32_array(9)of_property_read_u64(9)of_property_read_variable_u64_array(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)
and that's the page!! π it's from ./drivers/of, dated October 2026, and it lives in the of_property_read_string(9) era of your life now. go read some strings, bestie, you've got this π§β¨π
π¦ 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