Commit 1dae3e70 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

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: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/4394176.ejJDZkT8p0@rjwysocki.net


Reviewed-by: default avatarLukasz Luba <lukasz.luba@arm.com>
parent d07700b4
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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 */
+1 −0
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ struct thermal_governor {
#define	TZ_STATE_FLAG_SUSPENDED	BIT(0)
#define	TZ_STATE_FLAG_RESUMING	BIT(1)
#define	TZ_STATE_FLAG_INIT	BIT(2)
#define	TZ_STATE_FLAG_EXIT	BIT(3)

#define TZ_STATE_READY		0