dev_or_parent_of_node(9)
πΈ dev_or_parent_of_node β Kernel API Manual πΈ
okay so bestie, we're in the kernel API manual today, and this little function is genuinely one of the most "i got you" helpers out there π it's dev_or_parent_of_node(9), and no cap, it does exactly what it says on the tin.
β¨ NAME β¨
dev_or_parent_of_node β grab the device node of @dev, or of @dev's parent π
like. the name is the whole plot. slay.
π¦ SYNOPSIS π¦
struct device_node * dev_or_parent_of_node (struct device *dev );
one function, one argument, returns a struct device_node *. simple. iconic. periodt.
π ARGUMENTS π
devβ the device you want the device node of π that's it, that's the whole arg. just hand over yourdevand let the function cook.
π RETURN π
so here's the vibe check on what you get back, and there are three whole possibilities, so listen up:
- the device node pointer of
devβ best case scenario, it just has one, congrats π - the device node pointer of
dev->parentβ this is the "wait, ifdevdoesn't have a device node" fallback π« it climbs up one level to the parent, ngl that's the whole reason the function exists NULLβ the "neitherdevordev->parenthave a device node" outcome π no node, no parent node, no nothing. check for it, bestie, fr fr.
π SEE ALSO π
okay this part is a lot, but we do not skip, we do not cut, we list every single one. the kernel file in question is ./drivers/clk/clk.c, and here's the whole squad π«Ά
struct clk_core(9)clk_pm_runtime_get_all(9)clk_pm_runtime_put_all(9)clk_core_get(9)clk_determine_rate_noop(9)clk_rate_exclusive_put(9)clk_rate_exclusive_get(9)clk_unprepare(9)clk_prepare(9)clk_disable(9)clk_gate_restore_context(9)clk_save_context(9)clk_restore_context(9)clk_enable(9)clk_is_enabled_when_prepared(9)clk_hw_init_rate_request(9)clk_hw_forward_rate_request(9)__clk_determine_rate(9)clk_hw_round_rate(9)clk_round_rate(9)__clk_notify(9)__clk_recalc_accuracies(9)clk_get_accuracy(9)__clk_recalc_rates(9)clk_get_rate(9)clk_hw_get_parent_index(9)__clk_speculate_rates(9)clk_set_rate(9)clk_set_rate_exclusive(9)clk_set_rate_range(9)clk_set_min_rate(9)clk_set_max_rate(9)clk_get_parent(9)clk_has_parent(9)clk_set_parent(9)clk_set_phase(9)clk_get_phase(9)clk_set_duty_cycle(9)clk_get_scaled_duty_cycle(9)clk_is_match(9)clk_debug_register(9)clk_debug_init(9)__clk_core_init(9)clk_core_link_consumer(9)clk_core_unlink_consumer(9)alloc_clk(9)free_clk(9)clk_hw_create_clk(9)clk_hw_get_clk(9)clk_register(9)clk_hw_register(9)clk_unregister(9)clk_hw_unregister(9)devm_clk_register(9)devm_clk_hw_register(9)devm_clk_hw_get_clk(9)clk_notifier_register(9)clk_notifier_unregister(9)struct of_clk_provider(9)of_clk_add_provider(9)of_clk_add_hw_provider(9)devm_of_clk_add_hw_provider(9)of_clk_del_provider(9)of_parse_clkspec(9)of_clk_get_from_provider(9)of_clk_get_by_name(9)of_clk_get_parent_count(9)of_clk_parent_fill(9)of_clk_detect_critical(9)of_clk_init(9)
and that's the whole page, bestie π
this one lives in ./drivers/clk, dated October 2026, and honestly? short, sweet, does its job. we love a low-maintenance icon πβ¨π
π¦ 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