devm_clk_ge...ed_with_rate(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… devm_clk_get_optional_enabled_with_rate(9) πŸ’…

okay so bestie, welcome to the Kernel API Manual ✨ β€” this is the one-stop glow-up page for devm_clk_get_optional_enabled_with_rate, which is literally three clock things wearing a trench coat: devm_clk_get_optional() + clk_set_rate() + clk_prepare_enable(). no cap, it's giving "convenience wrapper, but make it fashion" πŸŽ€


🌸 NAME 🌸

devm_clk_get_optional_enabled_with_rate β€” the combo deal: devm_clk_get_optional() plus clk_set_rate() plus clk_prepare_enable(). three icons, one function 🫢


✨ SYNOPSIS ✨

struct clk * devm_clk_get_optional_enabled_with_rate (struct device *dev
, const char *id , unsigned long rate );

πŸŽ€ ARGUMENTS πŸŽ€

  • dev β€” the device that's acting as the clock "consumer" (yes, the quotes are canon, it's a whole role ok)
  • id β€” the clock consumer ID, aka this clock's little name tag 🏷️
  • rate β€” the new clock rate you're manifesting

πŸ’€ CONTEXT πŸ’€

May sleep. so like... it's allowed to nap 😴 don't call it from somewhere that can't handle sleeping, bestie, that's the whole vibe check.


πŸ”₯ RETURN πŸ”₯

You get back a struct clk that corresponds to the clock producer β€” or a valid IS_ERR condition containing errno 😭 (that's the "something went wrong" energy, check it with IS_ERR before you get attached).

The implementation uses dev and id to determine the clock consumer, and thereby the clock producer. iykyk πŸ”

If no such clk is found, it returns NULL, which serves as a dummy clk β€” like a stand-in extra in the background of your movie 🎬. That's the only difference compared to devm_clk_get_enabled. periodt.


🌈 DESCRIPTION 🌈

The returned clk (if valid) is prepared βœ… and enabled βœ… and rate was set βœ…. all three, done, slay.

The clock will automatically be disabled, unprepared and freed when the device is unbound from the bus. so it cleans up after itself β€” literally the dream 🧚✨ no manual clk_put chore era for you.


πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./include/linux/clk.h πŸ’– and the whole clock friend group:


that's the whole page, bestie πŸ¦‹ this one lives in ./include/linux, it's the October 2026 edition of the Kernel API Manual, and it's filed under devm_clk_get_optional_enabled_with_rate(9) β€” go be iconic with your clocks πŸ’œβ­

πŸ“¦ where this page comes from