提交 1b274294 编写于 作者: V Viresh Kumar 提交者: Rafael J. Wysocki

cpufreq: Use cpufreq_policy_list for iterating over policies

To iterate over all policies we currently iterate over all online
CPUs and then get the policy for each of them which is suboptimal.
Use the newly created cpufreq_policy_list for this purpose instead.
Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
上级 474deff7
...@@ -961,8 +961,8 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, ...@@ -961,8 +961,8 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif,
struct cpufreq_policy *policy; struct cpufreq_policy *policy;
unsigned long flags; unsigned long flags;
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU
struct cpufreq_policy *tpolicy;
struct cpufreq_governor *gov; struct cpufreq_governor *gov;
int sibling;
#endif #endif
if (cpu_is_offline(cpu)) if (cpu_is_offline(cpu))
...@@ -985,11 +985,10 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, ...@@ -985,11 +985,10 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif,
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU
/* Check if this cpu was hot-unplugged earlier and has siblings */ /* Check if this cpu was hot-unplugged earlier and has siblings */
read_lock_irqsave(&cpufreq_driver_lock, flags); read_lock_irqsave(&cpufreq_driver_lock, flags);
for_each_online_cpu(sibling) { list_for_each_entry(tpolicy, &cpufreq_policy_list, policy_list) {
struct cpufreq_policy *cp = per_cpu(cpufreq_cpu_data, sibling); if (cpumask_test_cpu(cpu, tpolicy->related_cpus)) {
if (cp && cpumask_test_cpu(cpu, cp->related_cpus)) {
read_unlock_irqrestore(&cpufreq_driver_lock, flags); read_unlock_irqrestore(&cpufreq_driver_lock, flags);
ret = cpufreq_add_policy_cpu(cp, cpu, dev, frozen); ret = cpufreq_add_policy_cpu(tpolicy, cpu, dev, frozen);
up_read(&cpufreq_rwsem); up_read(&cpufreq_rwsem);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册