device_prope...match_string(9)
π device_property_match_string(9) β the Kernel API Manual, bestie edition
okay so picture this: you're deep in the Kernel API Manual, right, and you just need to know if a string is chilling in a property array, and where. That's it. That's the whole gig. And honestly? She ate. β¨
πΈ NAME πΈ
device_property_match_string β find a string in an array and return the index, periodt.
β¨ SYNOPSIS β¨
int device_property_match_string (const struct device *dev , const char *propname , const char *string );
π ARGUMENTS π
devβ the device you're pulling the property off of. like, whose vibe are we checking πpropnameβ the name of the property that's holding the array. this is the shelf we're looking on.stringβ the actual string we're hunting for. the main character we're tryna find π
π¦ DESCRIPTION π¦
so the move is: find a given string in a string array, and if it's found, return the index back. that's literally it. no cap, no extra steps. you hand her a string, she tells you which slot it's living in π«Ά
π RETURN π
- index, starting from
0, if the property was found (success) β slay, she's there π -EINVALif given arguments are not valid β like, the inputs are giving nothing π-ENODATAif the property does not have a value β empty shelf energy π-EPROTOif the property is not an array of strings β wrong genre of array entirely, not her π-ENXIOif no suitable firmware interface is present β no firmware, no service, we can't even start πΈ
bestie pls actually check the return value. a negative number is not an index, it's a mood, and you need to handle it. π₯
π SEE ALSO π
Kernel file ./drivers/base/property.c β and the whole extended fam, iykyk:
device_property_present(9)fwnode_property_present(9)device_property_read_bool(9)fwnode_property_read_bool(9)device_property_read_u8_array(9)device_property_read_u16_array(9)device_property_read_u32_array(9)device_property_read_u64_array(9)device_property_read_string_array(9)device_property_read_string(9)fwnode_property_read_u8_array(9)fwnode_property_read_u16_array(9)fwnode_property_read_u32_array(9)fwnode_property_read_u64_array(9)fwnode_property_read_string_array(9)fwnode_property_read_string(9)fwnode_property_match_string(9)fwnode_property_match_property_string(9)fwnode_property_get_reference_args(9)fwnode_find_reference(9)fwnode_get_name(9)fwnode_get_name_prefix(9)fwnode_name_eq(9)fwnode_get_parent(9)fwnode_get_next_parent(9)fwnode_count_parents(9)fwnode_get_nth_parent(9)fwnode_get_next_child_node(9)fwnode_get_next_available_child_node(9)device_get_next_child_node(9)fwnode_get_named_child_node(9)device_get_named_child_node(9)fwnode_handle_get(9)fwnode_device_is_available(9)fwnode_get_child_node_count(9)fwnode_get_named_child_node_count(9)fwnode_get_phy_mode(9)device_get_phy_mode(9)fwnode_iomap(9)fwnode_irq_get(9)fwnode_irq_get_byname(9)fwnode_graph_get_next_endpoint(9)fwnode_graph_get_port_parent(9)fwnode_graph_get_remote_port_parent(9)fwnode_graph_get_remote_port(9)fwnode_graph_get_remote_endpoint(9)fwnode_graph_get_endpoint_by_id(9)fwnode_graph_get_endpoint_count(9)fwnode_graph_parse_endpoint(9)fwnode_connection_find_match(9)fwnode_connection_find_matches(9)
and that's the whole page, bestie π§π straight from ./drivers/base, dated October 2026, and yeah the title up top still reads device_prope...match_string(9) like it got cut off mid-sentence β iconic honestly. mwah πβ
π¦ 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