of_get_child_by_name(9)
π NAME π
of_get_child_by_name β bestie, this is the one that finds the child node by name for a given parent β¨
So like, you got a parent node, you got a name, and this function is the matchmaker π«Ά
πΈ SYNOPSIS πΈ
struct device_node * of_get_child_by_name (const struct device_node
*node , const char *name );
okay so the signature is a little long but she's iconic, we forgive her π
π ARGUMENTS π
nodeβ the parent node π the one doing the parenting, the main character of this whole operationnameβ the child name to look for π like, the specific kid we're hunting for
π¦ DESCRIPTION π¦
This function looks for a child node for a given matching name π
That's it, that's the vibe. You hand her a parent, you hand her a name, she goes looking for the child that matches. No cap, that is literally the entire job π
β RETURN β
You get a node pointer back if it's found π and β heads up bestie, this part matters β the refcount is incremented π₯ so you gotta call of_node_put on it when you're done with it. Like, clean up after yourself, be a good citizen π
And if the node is not found? You get NULL back. Nothing. Empty. A whole mood π so please check for it, okay? π
Fr fr, don't forget the of_node_put. The refcount is not a suggestion, it's a commitment π«Ά
πΈ SEE ALSO πΈ
Kernel file ./drivers/of/base.c β and here's the whole friend group, all of them, every single one π
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_available_child_by_name(9)of_find_node_opts_by_path(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)
and that's the page, bestie π§ go forth and find those child nodes π
this lil gem lives over in ./drivers/of, dated October 2026, and it's of_get_child_by_name(9) from the Kernel API Manual β slay, periodt, bye π
π
π¦ 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