aboutsummaryrefslogtreecommitdiff
path: root/drivers/misc/vexpress
diff options
context:
space:
mode:
authorNicolas Pitre <nicolas.pitre@linaro.org>2012-10-28 16:35:36 -0400
committerJon Medhurst <tixy@linaro.org>2013-04-29 09:43:12 +0100
commit29333e85cdf92caaf99e0285e308e1629773d7d4 (patch)
tree061235d2b2682dcb2a71605f2c453cce08b35642 /drivers/misc/vexpress
parent3fb50a7f5e44d850aa6c46b5755bc2b9767184d7 (diff)
downloadvexpress-lsk-29333e85cdf92caaf99e0285e308e1629773d7d4.tar.gz
ARM: spc: initialize completion block after locking the semaphore
Otherwise any concurrent call could reset the completion block while it is being waited for by a previous call. Signed-off-by: Nicolas Pitre <nico@linaro.org>
Diffstat (limited to 'drivers/misc/vexpress')
-rw-r--r--drivers/misc/vexpress/arm-spc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/misc/vexpress/arm-spc.c b/drivers/misc/vexpress/arm-spc.c
index 19d681cd594..31c10126ba0 100644
--- a/drivers/misc/vexpress/arm-spc.c
+++ b/drivers/misc/vexpress/arm-spc.c
@@ -258,8 +258,6 @@ int vexpress_spc_set_performance(int cluster, int perf)
if (IS_ERR_OR_NULL(info))
return -ENXIO;
- init_completion(&info->done);
-
a15_clusid = readl_relaxed(info->baseaddr + A15_CONF) & 0xf;
perf_cfg_reg = cluster != a15_clusid ? PERF_LVL_A7 : PERF_LVL_A15;
perf_stat_reg = cluster != a15_clusid ? PERF_REQ_A7 : PERF_REQ_A15;
@@ -269,6 +267,9 @@ int vexpress_spc_set_performance(int cluster, int perf)
if (down_timeout(&info->lock, usecs_to_jiffies(TIME_OUT_US)))
return -ETIME;
+
+ init_completion(&info->done);
+
writel(perf, info->baseaddr + perf_cfg_reg);
if (!wait_for_completion_interruptible_timeout(&info->done,