devm_of_clk_add_hw_provider(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… devm_of_clk_add_hw_provider(9) β€” like, the whole glow-up guide

okay so bestie, we're in the Kernel API Manual (that's the manual name, mwah) and today's main character is devm_of_clk_add_hw_provider(9). Buckle up, it's giving "clock provider registration but make it managed" πŸ’–


✨ NAME ✨

devm_of_clk_add_hw_provider β€” managed clk provider node registration πŸŽ€


🌸 SYNOPSIS 🌸

int devm_of_clk_add_hw_provider (struct device *dev , struct clk_hw
*(*get)(struct of_phandle_args *clkspec, void *data) , void *data );

yes it's a whole mouthful, no I will not be apologising πŸ’€


πŸ¦‹ ARGUMENTS πŸ¦‹

  • dev β€” the Device that's acting as the clock provider. it's the one used for the DT node and for the lifetime, so like... it's kind of the whole personality here 🫢
  • get β€” the callback for decoding clk_hw. your little decoder ring πŸ”₯
  • data β€” context pointer for the get callback. it's giving "bring your own vibes" πŸ™ˆ

πŸ’œ DESCRIPTION πŸ’œ

So what's the tea β˜•: this registers a clock provider for the given device's node.

And here's the plot twist β€” if the device has no DT node, or if the device node is missing its clock provider info (#clock-cells), then the parent device's node gets scanned for that info instead. And if the parent node does have #clock-cells, that's the one used in registration. iconic inheritance behaviour, honestly πŸ‘‘

And the best part? The provider is automatically released at device exit. no manual cleanup, no messy breakup, devm said "i gotchu" ✨


🌈 RETURN 🌈

0 on success, or an errno on failure. simple as that, bestie πŸ’…


πŸŽ€ SEE ALSO πŸŽ€

like a whole friend group, fr fr. the kernel file is ./drivers/clk/clk.c and here's everybody:


ngl that's a long list but every single one of them is a real one, no cap. go read them, i'll wait πŸ’–

and that's the page!! 🧚 from ./drivers/clk, dated October 2026, and the header's name is devm_of_clk_add_hw_provider(9) in case you forgot already 😭 love u, go register some clocks responsibly, periodt πŸ’…πŸ’–

πŸ“¦ where this page comes from