summaryrefslogtreecommitdiffstats
path: root/drivers/thermal/thermal_core.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-10-11 00:07:11 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-10-23 11:56:27 +0200
commit57f076664c4debb2fff57e42098698f1993826f4 (patch)
tree805eed8f6bedf9d9884f0f5ab5f7245814f39857 /drivers/thermal/thermal_core.c
parentthermal: core: Add and use thermal zone guard (diff)
downloadlinux-57f076664c4debb2fff57e42098698f1993826f4.tar.xz
linux-57f076664c4debb2fff57e42098698f1993826f4.zip
thermal: core: Add and use a reverse thermal zone guard
Add a guard for unlocking a locked thermal zone temporarily and use it in thermal_zone_pm_prepare(). No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://patch.msgid.link/3344086.aeNJFYEL58@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.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index d1038d33f17e..b8cd84a8c86c 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1711,11 +1711,9 @@ static void thermal_zone_pm_prepare(struct thermal_zone_device *tz)
* acquired the lock yet, so release it to let the function run
* and wait util it has done the work.
*/
- mutex_unlock(&tz->lock);
-
- wait_for_completion(&tz->resume);
-
- mutex_lock(&tz->lock);
+ scoped_guard(thermal_zone_reverse, tz) {
+ wait_for_completion(&tz->resume);
+ }
}
tz->state |= TZ_STATE_FLAG_SUSPENDED;