thermal_of_c...ice_register(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– thermal_of_c...ice_register(9) β€” Kernel API Manual πŸ’–

okay bestie, so we're in the Kernel API Manual today and this one is all about the thermal_of_cooling_device_register function. yes it's a mouthful, yes it's iconic, let's get into it 🫢


✨ NAME ✨

thermal_of_cooling_device_register β€” register an OF thermal cooling device. that's the whole vibe. she registers, she cools, she does it with a device tree node. periodt. πŸ’…


🌸 SYNOPSIS 🌸

struct thermal_cooling_device * thermal_of_cooling_device_register
(struct device_node *np , u32 cdev_id , const char *type , void *devdata
, const struct thermal_cooling_device_ops *ops );

look at her. long signature, main character energy, not a single wasted character. πŸ’œ


πŸŽ€ ARGUMENTS πŸŽ€

  • np β€” a pointer to a device tree node. just a lil pointer, no big deal, but she's the one who makes the whole device-tree binding thing happen ✨
  • cdev_id β€” a cooling device id in the cooling controller. it's a u32, it's the id, she's keeping track πŸ¦‹
  • type β€” the thermal cooling device type. const char *, so like… be normal about it please πŸ™ˆ
  • devdata β€” device private data. void *, so it can literally be anything, iykyk πŸ’€
  • ops β€” standard thermal cooling devices callbacks. it's a const struct thermal_cooling_device_ops * and yes you actually need to fill it in 🌈

πŸ”₯ DESCRIPTION πŸ”₯

so here's the tea β˜• β€” this interface function adds a new thermal cooling device (fan/processor/...) to the /sys/class/thermal/ folder as cooling_device[0-*]. yes, that's a glob, she's flexible like that.

the way that it also tries to bind itself to all the thermal zone devices registered at the same time?? obsessed. 😭

and it gives you the opportunity to link the cooling device to a device tree node, so that it can be bound to a thermal zone created out of device tree. that's literally the whole point, no cap. 🌸


πŸ‘‘ RETURN πŸ‘‘

it returns a pointer to the created struct thermal_cooling_device or an ERR_PTR.

bestie please, this part matters: the caller must check the return value with the IS_ERR*() helpers. do NOT skip the vibe check. πŸ’€

🧚 SEE ALSO 🧚

like a whole little friend group of thermal functions, and honestly? they all ate. πŸ”₯


aaaand that's the page!! πŸŽ€ brought to you by ./drivers/thermal, dated October 2026, still titled thermal_of_c...ice_register(9) because the header truncation is part of the aesthetic now. slay, go register your cooling device bestie πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from