devm_clk_get_prepared(9)
π devm_clk_get_prepared(9) β the Kernel API Manual, but make it make sense β¨
okay so bestie, you're reading the devm_clk_get_prepared(9) page from the Kernel API Manual and honestly? it's a little baddie. it's literally devm_clk_get() plus clk_prepare() and nothing else, no cap π
πΈ NAME πΈ
devm_clk_get_prepared β it's giving devm_clk_get() + clk_prepare(), together, iconic behavior π
β¨ SYNOPSIS β¨
struct clk * devm_clk_get_prepared (struct device *dev , const char *id );
that's it, that's the whole signature, slay π«Ά
π¦ ARGUMENTS π¦
devβ the device that's acting as the clock "consumer". yes, the clock is being consumed, we stan a hungry device πidβ the clock consumer ID. like the clock's little name tag at the party π
π CONTEXT π
May sleep. MAY SLEEP. not me warning you that this one cannot be called from an atomic context β she needs her beauty rest ππ€
π 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 π
the implementation uses dev and id to figure out the clock consumer, and through that, the clock producer. and this is the part that gets people every time, so listen up:
IOW,idmay be identical strings, butclk_getmay return different clock producers depending ondev.
read that again, fr fr. same string, different device, different producer. it's giving "same outfit, different main character" π
π§ DESCRIPTION π§
the returned clk (if it's valid) is prepared. but drivers must however assume that the clock is not enabled β prepared β enabled, bestie, those are two completely different vibes, don't conflate them β
and here's the free real estate: the clock will automatically be unprepared and freed when the device is unbound from the bus. devm said "I gotchu, go live your life" π
π₯ SEE ALSO π₯
the whole friend group, in order, no one left out π
Kernel file ./include/linux/clk.hclk 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_enabled(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)
okay that's the whole page, you ate that π«Άβ¨
this lil baddie lives over in ./include/linux and the manual's dated October 2026 β so like, future vibes only π see you in the next man page, mwah πππ¦
π¦ 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