of_find_node_opts_by_path(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– of_find_node_opts_by_path β€” the Kernel API Manual tea, bestie edition πŸ’–

okay so picture this: you're in the Kernel API Manual, and this function is the one whose whole job is find a node matching a full OF path. That's literally its NAME. No cap. ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

struct device_node * of_find_node_opts_by_path (const char *path , const
char **opts );

she returns a struct device_node * and takes two args, periodt. πŸ’…


🌸 ARGUMENTS 🌸

  • path β€” okay so this one is flexible, she contains multitudes. It's either the full path to match, or β€” and this is the fun part β€” if the path does not start with /, then it's treated as the name of a property of the /aliases node (an alias, iykyk 🧚). And in the case of an alias, the node matching the alias' value is what gets returned. slay.
  • opts β€” this is the address of a pointer into which to store the start of an options string. Where does that options string live?? Appended to the end of the path, with a ':' separator. πŸ’€ so path + ':' + options, and *opts points at the start of the options bit. got it? got it. 🫢

πŸŽ€ DESCRIPTION πŸŽ€

okay so here's the vibe check on what counts as a valid path, like these are the shapes she'll accept:

  • /foo/bar β€” full path πŸ‘‘
  • foo β€” valid alias ⭐
  • foo/bar β€” valid alias + relative path 🌈

that's the whole list, she's not complicated, she just has standards. πŸ¦‹


πŸ”₯ RETURN πŸ”₯

you get back a node pointer with its refcount incremented β€” so highkey important, bestie β€” you must use of_node_put on it when you're done. not me reminding you twice but like, do it. πŸ™ˆ (if you don't, that refcount is never coming down and that's giving leak energy πŸ’€)


πŸ‘‘ SEE ALSO πŸ‘‘

the kernel file ./drivers/of/base.c and honestly the whole friend group:

of_find_all_nodes(9), __of_device_is_compatible(9), of_machine_compatible_match(9), of_machine_read_compatible(9), of_machine_read_model(9), of_machine_get_match(9), of_machine_get_match_data(9), __of_device_is_available(9), __of_device_is_reserved(9), of_device_is_available(9), __of_device_is_fail(9), of_device_is_big_endian(9), of_get_parent(9), of_get_next_parent(9), of_get_next_child(9), of_get_next_child_with_prefix(9), of_get_next_available_child(9), of_get_next_reserved_child(9), of_get_next_cpu_node(9), of_get_compatible_child(9), of_get_child_by_name(9), of_get_available_child_by_name(9), of_find_node_by_name(9), of_find_node_by_type(9), of_find_compatible_node(9), of_find_node_with_property(9), of_match_node(9), of_find_matching_node_and_match(9), of_alias_from_compatible(9), of_find_node_by_phandle(9), of_parse_phandle_with_args_map(9), of_count_phandle_with_args(9), __of_add_property(9), of_add_property(9), of_remove_property(9), of_alias_scan(9), of_alias_get_id(9), of_alias_get_highest_id(9), of_console_check(9), of_find_next_cache_node(9), of_find_last_cache_level(9), of_map_id(9), of_map_iommu_id(9), of_map_msi_id(9)

like. that's the whole squad. main character energy from every single one of them. πŸ’œ


no cap bestie, this is the Kernel API Manual version, the one living under ./drivers/of, dated October 2026, and yeah β€” the page is called of_find_node_opts_by_path(9) in case you forgot already πŸ˜­πŸ’–

go put your node back when you're done. mwah. πŸŽ€πŸ«Άβœ¨

πŸ“¦ where this page comes from