cpufreq: Get rid of cpufreq_cpu_data_fallback
We can extract the same information from cpufreq_cpu_data as it is also available for inactive policies now. And so don't need cpufreq_cpu_data_fallback anymore. Also add a WARN_ON() for the case where we try to restore from an active policy. Acked-by: Saravana Kannan <skannan@codeaurora.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
988bed09d3
commit
3914d37910
|
@ -101,7 +101,6 @@ static LIST_HEAD(cpufreq_governor_list);
|
||||||
*/
|
*/
|
||||||
static struct cpufreq_driver *cpufreq_driver;
|
static struct cpufreq_driver *cpufreq_driver;
|
||||||
static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data);
|
static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data);
|
||||||
static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data_fallback);
|
|
||||||
static DEFINE_RWLOCK(cpufreq_driver_lock);
|
static DEFINE_RWLOCK(cpufreq_driver_lock);
|
||||||
DEFINE_MUTEX(cpufreq_governor_lock);
|
DEFINE_MUTEX(cpufreq_governor_lock);
|
||||||
|
|
||||||
|
@ -1081,13 +1080,14 @@ static struct cpufreq_policy *cpufreq_policy_restore(unsigned int cpu)
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
read_lock_irqsave(&cpufreq_driver_lock, flags);
|
read_lock_irqsave(&cpufreq_driver_lock, flags);
|
||||||
|
policy = per_cpu(cpufreq_cpu_data, cpu);
|
||||||
policy = per_cpu(cpufreq_cpu_data_fallback, cpu);
|
|
||||||
|
|
||||||
read_unlock_irqrestore(&cpufreq_driver_lock, flags);
|
read_unlock_irqrestore(&cpufreq_driver_lock, flags);
|
||||||
|
|
||||||
if (policy)
|
if (likely(policy)) {
|
||||||
|
/* Policy should be inactive here */
|
||||||
|
WARN_ON(!policy_is_inactive(policy));
|
||||||
policy->governor = NULL;
|
policy->governor = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return policy;
|
return policy;
|
||||||
}
|
}
|
||||||
|
@ -1383,11 +1383,8 @@ err_init_policy_kobj:
|
||||||
if (cpufreq_driver->exit)
|
if (cpufreq_driver->exit)
|
||||||
cpufreq_driver->exit(policy);
|
cpufreq_driver->exit(policy);
|
||||||
err_set_policy_cpu:
|
err_set_policy_cpu:
|
||||||
if (recover_policy) {
|
if (recover_policy)
|
||||||
/* Do not leave stale fallback data behind. */
|
|
||||||
per_cpu(cpufreq_cpu_data_fallback, cpu) = NULL;
|
|
||||||
cpufreq_policy_put_kobj(policy);
|
cpufreq_policy_put_kobj(policy);
|
||||||
}
|
|
||||||
cpufreq_policy_free(policy);
|
cpufreq_policy_free(policy);
|
||||||
|
|
||||||
nomem_out:
|
nomem_out:
|
||||||
|
@ -1401,21 +1398,11 @@ static int __cpufreq_remove_dev_prepare(struct device *dev,
|
||||||
{
|
{
|
||||||
unsigned int cpu = dev->id, cpus;
|
unsigned int cpu = dev->id, cpus;
|
||||||
int ret;
|
int ret;
|
||||||
unsigned long flags;
|
|
||||||
struct cpufreq_policy *policy;
|
struct cpufreq_policy *policy;
|
||||||
|
|
||||||
pr_debug("%s: unregistering CPU %u\n", __func__, cpu);
|
pr_debug("%s: unregistering CPU %u\n", __func__, cpu);
|
||||||
|
|
||||||
write_lock_irqsave(&cpufreq_driver_lock, flags);
|
|
||||||
|
|
||||||
policy = cpufreq_cpu_get_raw(cpu);
|
policy = cpufreq_cpu_get_raw(cpu);
|
||||||
|
|
||||||
/* Save the policy somewhere when doing a light-weight tear-down */
|
|
||||||
if (cpufreq_suspended)
|
|
||||||
per_cpu(cpufreq_cpu_data_fallback, cpu) = policy;
|
|
||||||
|
|
||||||
write_unlock_irqrestore(&cpufreq_driver_lock, flags);
|
|
||||||
|
|
||||||
if (!policy) {
|
if (!policy) {
|
||||||
pr_debug("%s: No cpu_data found\n", __func__);
|
pr_debug("%s: No cpu_data found\n", __func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
Loading…
Reference in New Issue