[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <52435DF7.8040307@linaro.org>
Date: Thu, 26 Sep 2013 00:04:39 +0200
From: Daniel Lezcano <daniel.lezcano@...aro.org>
To: Viresh Kumar <viresh.kumar@...aro.org>, rjw@...k.pl
CC: linaro-kernel@...ts.linaro.org, patches@...aro.org,
linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 12/21] cpuidle: call cpuidle_get_driver() from after taking
cpuidle_driver_lock
On 09/22/2013 03:21 AM, Viresh Kumar wrote:
> cpuidle_driver_lock is taken correctly at most of the places but at few places
> calls to cpuidle_get_driver() are done from outside of this lock.
>
> Fix them by calling cpuidle_get_driver() after taking cpuidle_driver_lock.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>
Acked-by: Daniel Lezcano <daniel.lezcano@...aro.org>
> ---
> drivers/cpuidle/driver.c | 3 ++-
> drivers/cpuidle/sysfs.c | 3 ++-
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
> index 6279e1c..7b2510a 100644
> --- a/drivers/cpuidle/driver.c
> +++ b/drivers/cpuidle/driver.c
> @@ -340,10 +340,11 @@ struct cpuidle_driver *cpuidle_driver_ref(void)
> */
> void cpuidle_driver_unref(void)
> {
> - struct cpuidle_driver *drv = cpuidle_get_driver();
> + struct cpuidle_driver *drv;
>
> spin_lock(&cpuidle_driver_lock);
>
> + drv = cpuidle_get_driver();
> if (drv && !WARN_ON(drv->refcnt <= 0))
> drv->refcnt--;
>
> diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
> index 8739cc0..a022393 100644
> --- a/drivers/cpuidle/sysfs.c
> +++ b/drivers/cpuidle/sysfs.c
> @@ -52,9 +52,10 @@ static ssize_t show_current_driver(struct device *dev,
> char *buf)
> {
> ssize_t ret;
> - struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver();
> + struct cpuidle_driver *cpuidle_driver;
>
> spin_lock(&cpuidle_driver_lock);
> + cpuidle_driver = cpuidle_get_driver();
> if (cpuidle_driver)
> ret = sprintf(buf, "%s\n", cpuidle_driver->name);
> else
>
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists