of_property...string_index(9)
π of_property...string_index(9) π
ok so this is a page straight out of the Kernel API Manual β yes bestie, the kernel has a manual, and yes it's giving "ancient scroll but make it devices" π§β¨. We're talking about of_property_read_string_index, and honestly? She's a little niche queen and I'm obsessed. Let's get into it π
β¨ NAME β¨
of_property_read_string_index β find and read a single string out of a property that holds multiple strings. iykyk πΈ
π¦ SYNOPSIS π¦
int of_property_read_string_index (const struct device_node *np ,
const char *propname , int index ,
const char **output );
π ARGUMENTS π
npβ the device node you're reading the property value from. like, the source of truth, the main character πpropnameβ the name of the property you're searching for πindexβ which string you want, out of the whole list of strings. it's an index, it indexes, she indexes πoutputβ a pointer to a null-terminated return string. heads up: this only gets modified if the return value is0. no sneaky writes otherwise, periodt π«Ά
π DESCRIPTION π
So what she does: you search for a property inside a device tree node, and she retrieves a null-terminated string value from the list of strings contained in that property. and bestie, listen β it's a pointer to data, not a copy. no duplicating, we're not doing that here β¨
The out_string pointer is modified only if a valid string can be decoded. like, she's not gonna hand you garbage and call it a day π
fr fr, don't touch that pointer and expect it to be valid unless you got a 0 back. that's the whole vibe check π
π₯ RETURN π₯
0β success, slay, we ate π-EINVALβ the property does not exist π-ENODATAβ the property exists but doesn't have a value π«-EILSEQβ the string is not null-terminated within the length of the property data ππ
π SEE ALSO π
Kernel file ./include/linux/of.h β and here's the whole squad, no cap, every single one of them:
of_node_init(9)of_machine_is_compatible(9)of_parse_phandle(9)of_parse_phandle_with_args(9)of_parse_phandle_with_fixed_args(9)of_parse_phandle_with_optional_args(9)of_phandle_args_equal(9)of_property_count_u8_elems(9)of_property_count_u16_elems(9)of_property_count_u32_elems(9)of_property_count_u64_elems(9)of_property_read_string_array(9)of_property_count_strings(9)of_property_present(9)of_property_read_u8_array(9)of_property_read_u16_array(9)of_property_read_u32_array(9)of_property_read_u64_array(9)struct of_changeset_entry(9)struct of_changeset(9)of_device_is_system_power_controller(9)of_have_populated_dt(9)
ok that's the whole page, and honestly she ate π
this one lives in ./include/linux, dated October 2026, and the page itself is of_property...string_index(9). bye bestie, go read some device trees πΈπ¦π
π¦ 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