summaryrefslogtreecommitdiff
path: root/drivers/thermal/thermal_core.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-10-04 21:26:12 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-10-22 12:07:33 +0200
commit1dae3e70b473adc32f81ca1be926440f9b1de9dc (patch)
tree248870db6d3639ee0c130a3b981ddd1f744799bf /drivers/thermal/thermal_core.c
parentd07700b474d38ea4b1130e37d28379fc202054fa (diff)
thermal: core: Mark thermal zones as exiting before unregistration
In analogy with a previous change in the thermal zone registration code path, to ensure that __thermal_zone_device_update() will return early for thermal zones that are going away, introduce a thermal zone state flag representing the "exit" state and set it while deleting the thermal zone from thermal_tz_list. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://patch.msgid.link/4394176.ejJDZkT8p0@rjwysocki.net Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Diffstat (limited to 'drivers/thermal/thermal_core.c')
-rw-r--r--drivers/thermal/thermal_core.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 5ae20a740a50..841d072bbe93 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1621,7 +1621,10 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
}
mutex_lock(&tz->lock);
+
+ tz->state |= TZ_STATE_FLAG_EXIT;
list_del(&tz->node);
+
mutex_unlock(&tz->lock);
/* Unbind all cdevs associated with 'this' thermal zone */