thermal/drivers/rcar_gen3_thermal: Fix device initialization
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Wed, 8 Feb 2023 19:03:33 +0000 (20:03 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 15 Feb 2023 16:29:23 +0000 (17:29 +0100)
commit47b2d3d2ed6c5c20f3521d5b615ffc92ed18b974
treebb01f9c3ae12260e4a9a5ce63aef780a115f35b8
parentaef43e04937ea819c6c1b35030b48f06f73488e0
thermal/drivers/rcar_gen3_thermal: Fix device initialization

The thermal zone is registered before the device is register and the
thermal coefficients are calculated, providing a window for very
incorrect readings.

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@ragnatech.se>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20230208190333.3159879-4-niklas.soderlund+renesas@ragnatech.se
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/thermal/rcar_gen3_thermal.c