summaryrefslogtreecommitdiffstats
path: root/drivers/cpuidle
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2013-10-03 17:56:50 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-10-30 01:21:23 +0100
commit0d09d3125642ac1f02937e577819dbc515291d93 (patch)
treef89ef56df320e0da2757642fc42828adcc24021e /drivers/cpuidle
parentcpuidle: replace multiline statements with single line in cpuidle_idle_call() (diff)
downloadlinux-0d09d3125642ac1f02937e577819dbc515291d93.tar.xz
linux-0d09d3125642ac1f02937e577819dbc515291d93.zip
cpuidle: call cpuidle_get_driver() from after taking cpuidle_driver_lock
There are a few cpuidle_get_driver() calls that aren't made under cpuidle_driver_lock which is incorrect. Fix them by calling cpuidle_get_driver() after taking cpuidle_driver_lock. Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpuidle')
-rw-r--r--drivers/cpuidle/driver.c3
-rw-r--r--drivers/cpuidle/sysfs.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
index a930005d5a3a..2458a741ad45 100644
--- a/drivers/cpuidle/driver.c
+++ b/drivers/cpuidle/driver.c
@@ -338,10 +338,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 8739cc05228c..a0223933536e 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