On Tue, Feb 07, 2023 at 06:10:11PM +0100, Niklas Söderlund wrote: > The thermal zone is registered before the device is register and the > thermal coefficients are calculated, providing a window for very > incorrect readings. While I could never actually be in this race window, the patch makes a lot of sense to me. > The reason why the zone was register before the device was fully > initialized was that the presence of the set_trips() callback is used to > determine if the driver supports interrupt or not, as it is not defined > if the device is incapable of interrupts. > > Fix this by using the operations structure in the private data instead > of the zone to determine if interrupts are available or not, and > initialize the device before registering the zone. > > Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@xxxxxxxxxxxx> Reviewed-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx> One minor question: > - if (status) > + if (status && priv->tscs[i]->zone) > thermal_zone_device_update(priv->tscs[i]->zone, > THERMAL_EVENT_UNSPECIFIED); Isn't this a seperate change?
Attachment:
signature.asc
Description: PGP signature