__cpufreq_cooling_register(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… __cpufreq_cooling_register(9) πŸ’…

okay bestie, so this is a kernel API manual page, and we're gonna get into it β€” no cap, this whole thing lives in the Kernel API Manual and it's literally the blueprint for making a cpufreq cooling device. let's go 🫢


✨ NAME ✨

__cpufreq_cooling_register β€” it's the helper function to create a cpufreq cooling device πŸŽ€ like, that's literally its whole job and it ate

✨ SYNOPSIS ✨

struct thermal_cooling_device * __cpufreq_cooling_register (struct
device_node *np , struct cpufreq_policy *policy , struct em_perf_domain
*em );

that's the signature, don't touch it, she's iconic exactly as she is πŸ’…

✨ ARGUMENTS ✨

  • np β€” a valid struct device_node that points to the cooling device tree node 🌳 like yes bestie we're linking into the DT
  • policy β€” the cpufreq policy. and ngl, normally this should be the same as cpufreq policy->related_cpus β€” like that's the vibe check it needs to pass
  • em β€” the Energy Model of the cpufreq policy ⚑ it's giving power management realness

✨ DESCRIPTION ✨

okay so here's the moment, the main character energy of this whole page: this interface function registers the cpufreq cooling device with the name "cpufreq-s" πŸ’–

and the way this API is so generous β€” it can support multiple instances of cpufreq cooling devices, like she's not gatekeeping, periodt πŸ‘‘

it also gives you the opportunity to link the cooling device with a device tree node, in order to bind it via the thermal DT code πŸ¦‹ so yeah, that's the whole shebang and it's lowkey slay

✨ RETURN ✨

on success you get a valid struct thermal_cooling_device pointer β€” chef's kiss 🀌 and on failure, it returns a corresponding ERR_PTR 😭 so pls check that return value bestie, fr fr

⚠️ heads up: failure is not a vibe, it hands you back an ERR_PTR β€” always check!!

✨ SEE ALSO ✨

okay so this is the little friendship circle, the whole crew 🌈 β€” first up, the kernel file ./drivers/thermal/cpufreq_cooling.c, then all these faves:

like that's the whole group chat, go say hi πŸ’œ


and that's the page!! πŸ¦‹ this whole thing lives in ./drivers/thermal, dated October 2026, and it's part of the Kernel API Manual β€” signed, sealed, delivered, slay βœ¨πŸ’…πŸŽ€

πŸ“¦ where this page comes from