From: Soohyun Kim Date: Mon, 2 Apr 2018 11:25:48 +0000 (+0900) Subject: Revert "cpufreq: acme: fix race contidion when set/get freq." X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=394556b2e3a8096b3fd324751f315ee388000fd5;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git Revert "cpufreq: acme: fix race contidion when set/get freq." This reverts commit a67c37d0d34f2232ff796b2466e4429df7f5181c. Change-Id: I9614c5c653436a00584506629e76678cd2f75fae --- diff --git a/drivers/cpufreq/exynos-acme.c b/drivers/cpufreq/exynos-acme.c index 58661b628ca9..a5af5b602c81 100644 --- a/drivers/cpufreq/exynos-acme.c +++ b/drivers/cpufreq/exynos-acme.c @@ -144,9 +144,8 @@ static unsigned int get_freq(struct exynos_cpufreq_domain *domain) { unsigned int freq; - if (domain->need_awake && - check_powerdown_state(cpumask_any(&domain->cpus), POWERMODE_TYPE_CLUSTER)) - return domain->old; + if (domain->need_awake) + disable_power_mode(cpumask_any(&domain->cpus), POWERMODE_TYPE_CLUSTER); freq = (unsigned int)cal_dfs_get_rate(domain->cal_id); if (!freq) { @@ -154,6 +153,9 @@ static unsigned int get_freq(struct exynos_cpufreq_domain *domain) freq = domain->old; } + if (domain->need_awake) + enable_power_mode(cpumask_any(&domain->cpus), POWERMODE_TYPE_CLUSTER); + return freq; } diff --git a/drivers/soc/samsung/exynos-cpupm.c b/drivers/soc/samsung/exynos-cpupm.c index a25bea07a7af..5eb9f67ce4d3 100644 --- a/drivers/soc/samsung/exynos-cpupm.c +++ b/drivers/soc/samsung/exynos-cpupm.c @@ -422,25 +422,6 @@ struct exynos_cpupm { static DEFINE_PER_CPU(struct exynos_cpupm, cpupm); -int check_powerdown_state(int cpu, int type) -{ - struct exynos_cpupm *pm; - struct power_mode *mode; - int pos; - - pm = &per_cpu(cpupm, cpu); - - for_each_mode(mode, pm->modes, pos) { - if (IS_NULL(mode)) - break; - - if (mode->type == type) - return check_state_powerdown(mode); - } - - return 0; -} - /* * State of each cpu is managed by a structure declared by percpu, so there * is no need for protection for synchronization. However, when entering @@ -474,8 +455,6 @@ 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) { @@ -494,14 +473,10 @@ 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) { - spin_unlock(&cpupm_lock); + if (atomic_inc_return(&mode->disable) == 1) awake_cpus(&mode->siblings); - return; - } } } - spin_unlock(&cpupm_lock); } void enable_power_mode(int cpu, int type) @@ -510,7 +485,6 @@ 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) { @@ -520,7 +494,6 @@ 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 */ diff --git a/include/soc/samsung/exynos-cpupm.h b/include/soc/samsung/exynos-cpupm.h index 9610b14face7..0914f0557062 100644 --- a/include/soc/samsung/exynos-cpupm.h +++ b/include/soc/samsung/exynos-cpupm.h @@ -19,7 +19,6 @@ enum { extern void disable_power_mode(int cpu, int type); extern void enable_power_mode(int cpu, int type); -extern int check_powerdown_state(int cpu, int type); #ifdef CONFIG_CPU_IDLE void exynos_update_ip_idle_status(int index, int idle);