diff options
author | Daniel Lezcano <daniel.lezcano@linaro.org> | 2022-08-05 18:38:32 +0300 |
---|---|---|
committer | Daniel Lezcano <daniel.lezcano@linaro.org> | 2022-08-17 15:09:39 +0300 |
commit | 63561fe36b094729d3d4d274bafaa030b39e89f6 (patch) | |
tree | 10de262355684f7379e25ff5d4ddae0dde2e11a2 /drivers/thermal/gov_step_wise.c | |
parent | 15a73839e3ced8d418e6c34548f5e2789f9da619 (diff) | |
download | linux-63561fe36b094729d3d4d274bafaa030b39e89f6.tar.xz |
thermal/governors: Group the thermal zone lock inside the throttle function
The thermal zone lock is taken in the different places in the
throttling path.
At the first glance it does not hurt to move them at the beginning and
the end of the 'throttle' function. That will allow a consolidation of
the lock in the next following changes.
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20220805153834.2510142-3-daniel.lezcano@linaro.org
Diffstat (limited to 'drivers/thermal/gov_step_wise.c')
-rw-r--r-- | drivers/thermal/gov_step_wise.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/thermal/gov_step_wise.c b/drivers/thermal/gov_step_wise.c index 9729b46d0258..597a0ebec7a4 100644 --- a/drivers/thermal/gov_step_wise.c +++ b/drivers/thermal/gov_step_wise.c @@ -117,8 +117,6 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip) dev_dbg(&tz->device, "Trip%d[type=%d,temp=%d]:trend=%d,throttle=%d\n", trip, trip_type, trip_temp, trend, throttle); - mutex_lock(&tz->lock); - list_for_each_entry(instance, &tz->thermal_instances, tz_node) { if (instance->trip != trip) continue; @@ -145,8 +143,6 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip) instance->cdev->updated = false; /* cdev needs update */ mutex_unlock(&instance->cdev->lock); } - - mutex_unlock(&tz->lock); } /** @@ -164,10 +160,10 @@ static int step_wise_throttle(struct thermal_zone_device *tz, int trip) { struct thermal_instance *instance; - thermal_zone_trip_update(tz, trip); - mutex_lock(&tz->lock); + thermal_zone_trip_update(tz, trip); + list_for_each_entry(instance, &tz->thermal_instances, tz_node) thermal_cdev_update(instance->cdev); |