devm_clk_hw_get_clk(9)
π devm_clk_hw_get_clk(9) β from the Kernel API Manual, bestie π
Okay so picture this: you're deep in the kernel, you need a clock, and you do not want to remember to clean it up later. Enter devm_clk_hw_get_clk. This is the resource-managed glow-up of clk_hw_get_clk(), and honestly? It ate. π
β¨ SYNOPSIS β¨
struct clk * devm_clk_hw_get_clk (struct device *dev , struct clk_hw *hw
, const char *con_id );
Yeah it's a whole three-argument situation β she's thorough, we respect it. π
π«Ά ARGUMENTS π«Ά
devβ the device that's registering this clock. Like, the one signing the permission slip πhwβ theclk_hwassociated with the clk being consumed. This is the hardware-side bestie π¦con_idβ the connection ID string on device. Her little name tag at the party π·οΈ
πΈ DESCRIPTION πΈ
So this is the managed version of clk_hw_get_clk. The way that works is: any clocks you get with this function get automatically clk_put on driver detach. No manual cleanup, no leaks, no 3am panic β she handles it herself, main character energy fr fr. π
If you wanna know more about the putting situation, go read clk_put. That's the whole lore. π
π₯ SEE ALSO π₯
Kernel file ./drivers/clk/clk.c, plus a truly iconic guest list of related functions β no cap, it's giving red carpet:
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)dev_or_parent_of_node(9)clk_register(9)clk_hw_register(9)clk_unregister(9)clk_hw_unregister(9)devm_clk_register(9)devm_clk_hw_register(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)
π Quick vibe check: the auto-clk_put-on-detach thing is the WHOLE point of thedevm_prefix here. Don't sleep on it, that's the resource-managed magic and it's literally iconic. β¨
And that's the page, bestie! π This one lives in ./drivers/clk, dated October 2026 β mwah, sending you good vibes and leak-free drivers, devm_clk_hw_get_clk(9) out. π§ππΈ
π¦ 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