diff options
-rw-r--r-- | drivers/thermal/thermal_core.c | 8 | ||||
-rw-r--r-- | drivers/thermal/thermal_core.h | 3 |
2 files changed, 6 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; diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index 09f796fb1278..dc84862017ea 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -150,6 +150,9 @@ struct thermal_zone_device { DEFINE_GUARD(thermal_zone, struct thermal_zone_device *, mutex_lock(&_T->lock), mutex_unlock(&_T->lock)) +DEFINE_GUARD(thermal_zone_reverse, struct thermal_zone_device *, + mutex_unlock(&_T->lock), mutex_lock(&_T->lock)) + /* Initial thermal zone temperature. */ #define THERMAL_TEMP_INIT INT_MIN |