Revert "Merge remote branch 'linux-2.6.32.y/master' into develop"
[firefly-linux-kernel-4.4.55.git] / drivers / cpufreq / cpufreq.c
index c7ae0261d46625459b01e131b6136ef9182147b2..ff57c40e9b8b94905ca090e79698390a66ad2583 100644 (file)
@@ -1183,28 +1183,12 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
 
        unlock_policy_rwsem_write(cpu);
 
-       cpufreq_debug_enable_ratelimit();
-
-#ifdef CONFIG_HOTPLUG_CPU
-       /* when the CPU which is the parent of the kobj is hotplugged
-        * offline, check for siblings, and create cpufreq sysfs interface
-        * and symlinks
-        */
-       if (unlikely(cpumask_weight(data->cpus) > 1)) {
-               /* first sibling now owns the new sysfs dir */
-               cpumask_clear_cpu(cpu, data->cpus);
-               cpufreq_add_dev(get_cpu_sysdev(cpumask_first(data->cpus)));
-
-               /* finally remove our own symlink */
-               lock_policy_rwsem_write(cpu);
-               __cpufreq_remove_dev(sys_dev);
-       }
-#endif
-
        free_cpumask_var(data->related_cpus);
        free_cpumask_var(data->cpus);
        kfree(data);
+       per_cpu(cpufreq_cpu_data, cpu) = NULL;
 
+       cpufreq_debug_enable_ratelimit();
        return 0;
 }
 
@@ -1757,8 +1741,17 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data,
                        dprintk("governor switch\n");
 
                        /* end old governor */
-                       if (data->governor)
+                       if (data->governor) {
+                               /*
+                                * Need to release the rwsem around governor
+                                * stop due to lock dependency between
+                                * cancel_delayed_work_sync and the read lock
+                                * taken in the delayed work handler.
+                                */
+                               unlock_policy_rwsem_write(data->cpu);
                                __cpufreq_governor(data, CPUFREQ_GOV_STOP);
+                               lock_policy_rwsem_write(data->cpu);
+                       }
 
                        /* start new governor */
                        data->governor = policy->governor;