summaryrefslogtreecommitdiffstats
path: root/drivers/thermal/thermal_core.c
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2022-08-05 17:38:33 +0200
committerDaniel Lezcano <daniel.lezcano@linaro.org>2022-08-17 14:09:39 +0200
commit670a5e356cb6dfc61b87b599eba483af6a3a99ad (patch)
tree5165d8ff45c1107d36c6cdcb5606cdf72aa82e8e /drivers/thermal/thermal_core.c
parent63561fe36b094729d3d4d274bafaa030b39e89f6 (diff)
downloadlinux-stable-670a5e356cb6dfc61b87b599eba483af6a3a99ad.tar.gz
linux-stable-670a5e356cb6dfc61b87b599eba483af6a3a99ad.tar.bz2
linux-stable-670a5e356cb6dfc61b87b599eba483af6a3a99ad.zip
thermal/core: Move the thermal zone lock out of the governors
All the governors throttling ops are taking/releasing the lock at the beginning and the end of the function. We can move the mutex to the throttling call site instead. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20220805153834.2510142-4-daniel.lezcano@linaro.org
Diffstat (limited to 'drivers/thermal/thermal_core.c')
-rw-r--r--drivers/thermal/thermal_core.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 5408e92a1168..fcac28d28739 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -311,8 +311,10 @@ static void monitor_thermal_zone(struct thermal_zone_device *tz)
static void handle_non_critical_trips(struct thermal_zone_device *tz, int trip)
{
+ mutex_lock(&tz->lock);
tz->governor ? tz->governor->throttle(tz, trip) :
def_governor->throttle(tz, trip);
+ mutex_unlock(&tz->lock);
}
void thermal_zone_device_critical(struct thermal_zone_device *tz)