Skip to content

Commit 1dae3e7

Browse files
committed
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 <[email protected]> Link: https://patch.msgid.link/[email protected] Reviewed-by: Lukasz Luba <[email protected]>
1 parent d07700b commit 1dae3e7

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

drivers/thermal/thermal_core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,7 +1621,10 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
16211621
}
16221622

16231623
mutex_lock(&tz->lock);
1624+
1625+
tz->state |= TZ_STATE_FLAG_EXIT;
16241626
list_del(&tz->node);
1627+
16251628
mutex_unlock(&tz->lock);
16261629

16271630
/* Unbind all cdevs associated with 'this' thermal zone */

drivers/thermal/thermal_core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ struct thermal_governor {
6565
#define TZ_STATE_FLAG_SUSPENDED BIT(0)
6666
#define TZ_STATE_FLAG_RESUMING BIT(1)
6767
#define TZ_STATE_FLAG_INIT BIT(2)
68+
#define TZ_STATE_FLAG_EXIT BIT(3)
6869

6970
#define TZ_STATE_READY 0
7071

0 commit comments

Comments
 (0)