of_get_next_child(9)
β¨ of_get_next_child (9) β¨
okay bestie, so this is a page out of the Kernel API Manual β literally the device tree iteration lore, and honestly? it's giving "small function, huge responsibilities" π
π NAME π
of_get_next_child β walk through a node's children, one at a time, no cap
π¦ SYNOPSIS π¦
struct device_node * of_get_next_child (const struct device_node *node ,
struct device_node *prev );
like yes, that's the whole signature. <italic>node</italic> first, <italic>prev</italic> second, returns a struct device_node *. slay π
πΈ ARGUMENTS πΈ
nodeβ the parent node. the main character of this whole operation πprevβ the previous child of the parent node, orNULLto get the first one. so basically "where were we?" or "start over pls" π
π RETURN π
you get back a node pointer with its refcount incremented β like the kernel just handed you a +1 and expects you to be responsible about it π so literally call of_node_put on it when you're done, fr fr.
it returns NULL when prev is the last child (you've reached the end bestie, go home π ).
oh and also β it decrements the refcount of prev. not me, quietly doing accounting on your behalf. keep that in mind π
π₯ SEE ALSO π₯
okay this list is long long, so buckle up π«Ά β the kernel file is ./drivers/of/base.c:
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_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_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)
like, the whole friend group showed up. iykyk π
reminder bestie: refcount goes up, refcount must come down. of_node_put is not optional, it's a lifestyle π
and that's the page! brought to you from the source path ./drivers/of, dated October 2026, page of_get_next_child(9) β mwah, go iterate responsibly π§ββοΈβπ
π¦ 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