Revert "cpufreq: Use cpufreq_policy_list for iterating over policies"
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sun, 18 Aug 2013 13:35:59 +0000 (15:35 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sun, 18 Aug 2013 13:35:59 +0000 (15:35 +0200)
Revert commit eb60852 (cpufreq: Use cpufreq_policy_list for iterating
over policies), because it breaks system suspend/resume on multiple
machines.

It either causes resume to block indefinitely or causes the BUG_ON()
in lock_policy_rwsem_##mode() to trigger on sysfs accesses to cpufreq
attributes.

Conflicts:
drivers/cpufreq/cpufreq.c

drivers/cpufreq/cpufreq.c

index 37a687467329fe6b9235c87ec29532ced4c85739..c0ef84d601b7ad99e9d1836718827f6c3f7186ee 100644 (file)
@@ -969,8 +969,8 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif,
        struct cpufreq_policy *policy;
        unsigned long flags;
 #ifdef CONFIG_HOTPLUG_CPU
-       struct cpufreq_policy *tpolicy;
        struct cpufreq_governor *gov;
+       int sibling;
 #endif
 
        if (cpu_is_offline(cpu))
@@ -993,10 +993,11 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif,
 #ifdef CONFIG_HOTPLUG_CPU
        /* Check if this cpu was hot-unplugged earlier and has siblings */
        read_lock_irqsave(&cpufreq_driver_lock, flags);
-       list_for_each_entry(tpolicy, &cpufreq_policy_list, policy_list) {
-               if (cpumask_test_cpu(cpu, tpolicy->related_cpus)) {
+       for_each_online_cpu(sibling) {
+               struct cpufreq_policy *cp = per_cpu(cpufreq_cpu_data, sibling);
+               if (cp && cpumask_test_cpu(cpu, cp->related_cpus)) {
                        read_unlock_irqrestore(&cpufreq_driver_lock, flags);
-                       ret = cpufreq_add_policy_cpu(tpolicy, cpu, dev, frozen);
+                       ret = cpufreq_add_policy_cpu(cp, cpu, dev, frozen);
                        up_read(&cpufreq_rwsem);
                        return ret;
                }