From: Soohyun Kim Date: Mon, 2 Apr 2018 23:58:05 +0000 (+0900) Subject: cpufreq: acme: remove race contdition when set/get freq X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5adb75d1cbeec62a0eecd10c695f619b8a42d587;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git cpufreq: acme: remove race contdition when set/get freq Change-Id: I964b18bc4eab0914879c7cf0226ee8bc780dd9de Signed-off-by: Soohyun Kim --- diff --git a/drivers/soc/samsung/exynos-cpupm.c b/drivers/soc/samsung/exynos-cpupm.c index 5eb9f67ce4d3..c72c36f22e42 100644 --- a/drivers/soc/samsung/exynos-cpupm.c +++ b/drivers/soc/samsung/exynos-cpupm.c @@ -455,6 +455,7 @@ void disable_power_mode(int cpu, int type) struct power_mode *mode; int pos; + spin_lock(&cpupm_lock); pm = &per_cpu(cpupm, cpu); for_each_mode(mode, pm->modes, pos) { @@ -473,10 +474,14 @@ void disable_power_mode(int cpu, int type) * The first mode disable request wakes the cpus to * exit power mode */ - if (atomic_inc_return(&mode->disable) == 1) + if (atomic_inc_return(&mode->disable) == 1) { + spin_unlock(&cpupm_lock); awake_cpus(&mode->siblings); + return; + } } } + spin_unlock(&cpupm_lock); } void enable_power_mode(int cpu, int type) @@ -485,6 +490,7 @@ void enable_power_mode(int cpu, int type) struct power_mode *mode; int pos; + spin_lock(&cpupm_lock); pm = &per_cpu(cpupm, cpu); for_each_mode(mode, pm->modes, pos) { @@ -494,6 +500,7 @@ void enable_power_mode(int cpu, int type) if (mode->type == type) atomic_dec(&mode->disable); } + spin_unlock(&cpupm_lock); } /* get sleep length of given cpu from tickless framework */