Commit 3361b7b1 authored by Viresh Kumar's avatar Viresh Kumar Committed by Rafael J. Wysocki

cpufreq: Don't check cpu_online(policy->cpu)

policy->cpu or cpus in policy->cpus can't be offline anymore. And so we don't
need to check if they are online or not.
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 1dd538f0
...@@ -76,10 +76,6 @@ static int lock_policy_rwsem_##mode \ ...@@ -76,10 +76,6 @@ static int lock_policy_rwsem_##mode \
int policy_cpu = per_cpu(cpufreq_policy_cpu, cpu); \ int policy_cpu = per_cpu(cpufreq_policy_cpu, cpu); \
BUG_ON(policy_cpu == -1); \ BUG_ON(policy_cpu == -1); \
down_##mode(&per_cpu(cpu_policy_rwsem, policy_cpu)); \ down_##mode(&per_cpu(cpu_policy_rwsem, policy_cpu)); \
if (unlikely(!cpu_online(cpu))) { \
up_##mode(&per_cpu(cpu_policy_rwsem, policy_cpu)); \
return -1; \
} \
\ \
return 0; \ return 0; \
} }
...@@ -720,8 +716,6 @@ static int cpufreq_add_dev_symlink(unsigned int cpu, ...@@ -720,8 +716,6 @@ static int cpufreq_add_dev_symlink(unsigned int cpu,
if (j == cpu) if (j == cpu)
continue; continue;
if (!cpu_online(j))
continue;
pr_debug("CPU %u already managed, adding link\n", j); pr_debug("CPU %u already managed, adding link\n", j);
managed_policy = cpufreq_cpu_get(cpu); managed_policy = cpufreq_cpu_get(cpu);
...@@ -778,8 +772,6 @@ static int cpufreq_add_dev_interface(unsigned int cpu, ...@@ -778,8 +772,6 @@ static int cpufreq_add_dev_interface(unsigned int cpu,
spin_lock_irqsave(&cpufreq_driver_lock, flags); spin_lock_irqsave(&cpufreq_driver_lock, flags);
for_each_cpu(j, policy->cpus) { for_each_cpu(j, policy->cpus) {
if (!cpu_online(j))
continue;
per_cpu(cpufreq_cpu_data, j) = policy; per_cpu(cpufreq_cpu_data, j) = policy;
per_cpu(cpufreq_policy_cpu, j) = policy->cpu; per_cpu(cpufreq_policy_cpu, j) = policy->cpu;
} }
...@@ -1006,11 +998,8 @@ static void update_policy_cpu(struct cpufreq_policy *policy, unsigned int cpu) ...@@ -1006,11 +998,8 @@ static void update_policy_cpu(struct cpufreq_policy *policy, unsigned int cpu)
policy->last_cpu = policy->cpu; policy->last_cpu = policy->cpu;
policy->cpu = cpu; policy->cpu = cpu;
for_each_cpu(j, policy->cpus) { for_each_cpu(j, policy->cpus)
if (!cpu_online(j))
continue;
per_cpu(cpufreq_policy_cpu, j) = cpu; per_cpu(cpufreq_policy_cpu, j) = cpu;
}
#ifdef CONFIG_CPU_FREQ_TABLE #ifdef CONFIG_CPU_FREQ_TABLE
cpufreq_frequency_table_update_policy_cpu(policy); cpufreq_frequency_table_update_policy_cpu(policy);
...@@ -1470,7 +1459,7 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy, ...@@ -1470,7 +1459,7 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
if (target_freq == policy->cur) if (target_freq == policy->cur)
return 0; return 0;
if (cpu_online(policy->cpu) && cpufreq_driver->target) if (cpufreq_driver->target)
retval = cpufreq_driver->target(policy, target_freq, relation); retval = cpufreq_driver->target(policy, target_freq, relation);
return retval; return retval;
...@@ -1508,7 +1497,7 @@ int __cpufreq_driver_getavg(struct cpufreq_policy *policy, unsigned int cpu) ...@@ -1508,7 +1497,7 @@ int __cpufreq_driver_getavg(struct cpufreq_policy *policy, unsigned int cpu)
if (cpufreq_disabled()) if (cpufreq_disabled())
return ret; return ret;
if (!(cpu_online(cpu) && cpufreq_driver->getavg)) if (!cpufreq_driver->getavg)
return 0; return 0;
policy = cpufreq_cpu_get(policy->cpu); policy = cpufreq_cpu_get(policy->cpu);
......
...@@ -225,7 +225,7 @@ int cpufreq_governor_dbs(struct dbs_data *dbs_data, ...@@ -225,7 +225,7 @@ int cpufreq_governor_dbs(struct dbs_data *dbs_data,
switch (event) { switch (event) {
case CPUFREQ_GOV_START: case CPUFREQ_GOV_START:
if ((!cpu_online(cpu)) || (!policy->cur)) if (!policy->cur)
return -EINVAL; return -EINVAL;
mutex_lock(&dbs_data->mutex); mutex_lock(&dbs_data->mutex);
......
...@@ -118,8 +118,6 @@ static int cpufreq_governor_userspace(struct cpufreq_policy *policy, ...@@ -118,8 +118,6 @@ static int cpufreq_governor_userspace(struct cpufreq_policy *policy,
switch (event) { switch (event) {
case CPUFREQ_GOV_START: case CPUFREQ_GOV_START:
if (!cpu_online(cpu))
return -EINVAL;
BUG_ON(!policy->cur); BUG_ON(!policy->cur);
mutex_lock(&userspace_mutex); mutex_lock(&userspace_mutex);
......
...@@ -63,9 +63,6 @@ int cpufreq_frequency_table_verify(struct cpufreq_policy *policy, ...@@ -63,9 +63,6 @@ int cpufreq_frequency_table_verify(struct cpufreq_policy *policy,
pr_debug("request for verification of policy (%u - %u kHz) for cpu %u\n", pr_debug("request for verification of policy (%u - %u kHz) for cpu %u\n",
policy->min, policy->max, policy->cpu); policy->min, policy->max, policy->cpu);
if (!cpu_online(policy->cpu))
return -EINVAL;
cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
policy->cpuinfo.max_freq); policy->cpuinfo.max_freq);
...@@ -121,9 +118,6 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy, ...@@ -121,9 +118,6 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
break; break;
} }
if (!cpu_online(policy->cpu))
return -EINVAL;
for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) { for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) {
unsigned int freq = table[i].frequency; unsigned int freq = table[i].frequency;
if (freq == CPUFREQ_ENTRY_INVALID) if (freq == CPUFREQ_ENTRY_INVALID)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment