devm_clk_get...nal_prepared(9)
πΈ devm_clk_get_optional_prepared(9) β the Kernel API Manual, bestie edition πΈ
okay so this is a page straight out of the Kernel API Manual, and yes the name is a whole mouthful: devm_clk_get_optional_prepared(9). don't panic, it's actually so chill once you get it π
β¨ NAME β¨
devm_clk_get_optional_prepared β literally just devm_clk_get_optional() + clk_prepare() like it's giving combo meal energy π
π SYNOPSIS π
struct clk * devm_clk_get_optional_prepared (struct device *dev , const
char *id );
π¦ ARGUMENTS π¦
devβ the device that's acting as the clock "consumer" (yes that's the real term, it's giving main character energy π)idβ the clock consumer ID
π CONTEXT π
May sleep. that's it, that's the whole vibe β so don't go calling this from somewhere that can't nap, iykyk π΄π
β RETURN β
you get back a struct clk that corresponds to the clock producer π
OR a valid IS_ERR condition containing errno if things went sideways.
ngl the implementation uses dev and id to determine the clock consumer, and thereby the clock producer. and if no such clk is found? it returns NULL, which serves as a dummy clk π«Ά that's the only difference compared to devm_clk_get_prepared, periodt.
π DESCRIPTION π
the returned clk (if it's valid) is prepared. but drivers must however assume that the clock is not enabled β do not get it twisted π
also the clock will automatically be unprepared and freed when the device is unbound from the bus. it cleans up after itself, we love a self-sufficient icon β¨
π₯ SEE ALSO π₯
Kernel file ./include/linux/clk.h β and bestie, the friend group here is huge, so buckle up:
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_enabled(9)devm_clk_get_optional(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)
π friendly reminder bestie: "prepared" β "enabled". the clock is prepared, but you gotta assume it's not enabled. don't be out here assuming things, it's not cute.
and that's the page!! π this lil beauty lives in ./include/linux, dated October 2026, and it's filed under devm_clk_get...nal_prepared(9) π go forth and prepare your clocks responsibly, ily π«Άβ¨
π¦ 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