devm_clk_get_enabled(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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