devm_clk_get_enabled(9)
π devm_clk_get_enabled(9) π
okay so bestie, welcome to the devm_clk_get_enabled(9) page β straight out of the Kernel API Manual, and honestly? it's giving "little function that could." it's a two-for-one deal and we're obsessed. β¨
πΈ NAME πΈ
devm_clk_get_enabled β literally just devm_clk_get() + clk_prepare_enable(). that's it, that's the whole vibe. no cap. π«Ά
π¦ SYNOPSIS π¦
struct clk * devm_clk_get_enabled (struct device *dev , const char *id );
like, look at it. she's beautiful. she takes two args and returns a clock pointer. periodt. π
π ARGUMENTS π
devβ the device that's gonna be the clock "consumer". it's the main character here, fr fr. πidβ the clock consumer ID. yes, that's the literal name of the parameter. iconic. β
β CONTEXT β
May sleep. π΄ that's the whole section. nap-friendly function, so don't go calling her from an atomic context, mkay? (that part's iykyk, the manpage just says May sleep and we respect that.) π
π₯ RETURN π₯
you get back a struct clk corresponding to the clock producer β or a valid IS_ERR condition containing errno. so like, always check her, bestie, don't just rawdog that pointer. π
the implementation uses dev and id to determine the clock consumer, and thereby the clock producer. and here's the cute little trap: (IOW, id may be identical strings, but clk_get may return different clock producers depending on dev.) so don't go thinking same name = same clock, because it does NOT mean that, ngl. π
π DESCRIPTION π
so the returned clk, if valid, is prepared and enabled. yes. both. she does both. multi-tasking queen. π
and here's the part where devm really pops off: the clock will automatically be disabled, unprepared and freed when the device is unbound from the bus. like she cleans up after herself?? no notes. absolute icon. π§
π« SEE ALSO π«
buckle up bestie, this list is LONG and we are NOT skipping a single one of them. the kernel file is ./include/linux/clk.h, and here's the whole friend group:
clk notifier callback types(9), struct clk_notifier(9), struct clk_notifier_data(9), struct clk_bulk_data(9), clk_notifier_register(9), clk_notifier_unregister(9), devm_clk_notifier_register(9), clk_get_accuracy(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_rate_exclusive_get(9), devm_clk_rate_exclusive_get(9), clk_rate_exclusive_put(9), clk_save_context(9), clk_restore_context(9), clk_prepare(9), clk_unprepare(9), clk_is_enabled_when_prepared(9), clk_get(9), clk_bulk_get(9), clk_bulk_get_all(9), clk_bulk_get_optional(9), devm_clk_bulk_get(9), devm_clk_bulk_get_optional(9), devm_clk_bulk_get_enable(9), devm_clk_bulk_get_optional_enable(9), devm_clk_bulk_get_all(9), devm_clk_bulk_get_all_enabled(9), devm_clk_get(9), devm_clk_get_prepared(9), devm_clk_get_optional(9), devm_clk_get_optional_prepared(9), devm_clk_get_optional_enabled(9), devm_clk_get_optional_enabled_with_rate(9), devm_get_clk_from_child(9), clk_enable(9), clk_bulk_enable(9), clk_disable(9), clk_bulk_disable(9), clk_get_rate(9), clk_put(9), clk_bulk_put(9), clk_bulk_put_all(9), devm_clk_put(9), clk_round_rate(9), clk_set_rate(9), clk_set_rate_exclusive(9), clk_has_parent(9), clk_set_rate_range(9), clk_set_min_rate(9), clk_set_max_rate(9), clk_set_parent(9), clk_get_parent(9), clk_get_sys(9), clk_drop_range(9), clk_get_optional(9)
whew. every single one of them, present and accounted for. π β¨
ok and finally the cute sign-off: this page lives under ./include/linux, and it's dated October 2026 β so go forth, grab your clocks, enable them, and let devm handle the cleanup. slay. ππ¦π
π¦ 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