thermal_of_zone_register(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… thermal_of_zone_register β€” Kernel API Manual, bestie edition πŸŽ€

okay so picture this: it's giving kernel API manual, it's page thermal_of_zone_register(9), and it's literally about registering a thermal zone with a device node sensor. yes bestie, we're doing device tree stuff today and you're gonna slay it ✨


✨ NAME ✨

thermal_of_zone_register β€” register a thermal zone with a device node sensor πŸŒ‘οΈπŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

struct thermal_zone_device * thermal_of_zone_register (struct
       device_node *sensor , int id , void *data , const struct
       thermal_zone_device_ops *ops );

like, that's the whole call, no cap. four args, one pointer back, periodt πŸ‘‘


🌸 ARGUMENTS 🌸

  • sensor β€” a device_node pointer that corresponds to the sensor in the device tree. this is your main character pointer fr 🌳
  • id β€” an integer that acts as the sensor identifier. yes it's just an int, and yes it matters πŸ’«
  • data β€” private data that gets stored in the thermal zone's dedicated private area. your lil stash of vibes πŸ™ˆ
  • ops β€” a set of thermal sensor ops. the const struct thermal_zone_device_ops * of it all, iykyk 🫢

πŸ’œ DESCRIPTION πŸ’œ

so what does thermal_of_zone_register actually do? it parses a device tree given a device node sensor and an id. it goes looking for the thermal zone associated to the couple sensor/id, then retrieves all the thermal zone properties, and registers a new thermal zone with those properties. that's it, that's the whole glow-up ✨πŸ”₯

lowkey iconic behavior honestly β€” parse, retrieve, register, done πŸ’…


πŸ’€ RETURN πŸ’€

on success you get a valid thermal zone structure pointer. slay. πŸŽ‰

but bestie, sometimes it does not slay, and here's the receipts:

  • EINVAL β€” if the device tree thermal description is malformed 😭 (the DT said what it said and what it said was wrong)
  • ENOMEM β€” if one structure can not be allocated πŸ’€ memory said no
  • Other negative errors are returned by the underlying called functions β€” so like, not this function's fault, it's handing you the error from somewhere deeper down the stack 🌈

πŸ”₯ SEE ALSO πŸ”₯

kernel file ./drivers/thermal/thermal_of.c is the home base, and then the whole friend group:

ngl that's a whole group chat right there πŸ«ΆπŸ’–


πŸ’‘ friendly reminder from your local unix girlie: these are pointers and ids, not vibes β€” don't manifest a malformed device tree and then act surprised when you get EINVAL πŸ™ˆ

alright bestie, that's the page!! source/version vibes live at ./drivers/thermal, dated October 2026, and the whole thing answers to the name thermal_of_zone_register(9). go register something iconic πŸ’…β­πŸŽ€

πŸ“¦ where this page comes from