[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2b841fb2-49b8-480f-896b-0b5a3cc6a1e2@arm.com>
Date: Tue, 22 Oct 2024 22:03:28 +0100
From: Lukasz Luba <lukasz.luba@....com>
To: "Rafael J. Wysocki" <rjw@...ysocki.net>
Cc: LKML <linux-kernel@...r.kernel.org>, Linux PM <linux-pm@...r.kernel.org>,
Daniel Lezcano <daniel.lezcano@...aro.org>, Zhang Rui <rui.zhang@...el.com>,
Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>
Subject: Re: [PATCH v2 02/11] thermal: core: Add and use a reverse thermal
zone guard
On 10/10/24 23:07, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
>
> 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@...el.com>
> ---
>
> This is a new patch
>
> ---
> drivers/thermal/thermal_core.c | 8 +++-----
> drivers/thermal/thermal_core.h | 3 +++
> 2 files changed, 6 insertions(+), 5 deletions(-)
>
> Index: linux-pm/drivers/thermal/thermal_core.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_core.c
> +++ linux-pm/drivers/thermal/thermal_core.c
> @@ -1702,11 +1702,9 @@ static void thermal_zone_pm_prepare(stru
> * 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;
> Index: linux-pm/drivers/thermal/thermal_core.h
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_core.h
> +++ linux-pm/drivers/thermal/thermal_core.h
> @@ -148,6 +148,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
>
>
>
>
Reviewed-by: Lukasz Luba <lukasz.luba@....com>
Powered by blists - more mailing lists