ACPI / cpuidle: fix deadlock between cpuidle_lock and cpu_hotplug.lock
[firefly-linux-kernel-4.4.55.git] / drivers / acpi / processor_idle.c
index 4056d3175178d040edd14bccc04bac2d2ce5d5e3..a88894190e419eb697a3546170ca0652bb8f8db3 100644 (file)
@@ -1101,9 +1101,9 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)
 
        if (pr->id == 0 && cpuidle_get_driver() == &acpi_idle_driver) {
 
-               cpuidle_pause_and_lock();
                /* Protect against cpu-hotplug */
                get_online_cpus();
+               cpuidle_pause_and_lock();
 
                /* Disable all cpuidle devices */
                for_each_online_cpu(cpu) {
@@ -1130,8 +1130,8 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)
                                cpuidle_enable_device(dev);
                        }
                }
-               put_online_cpus();
                cpuidle_resume_and_unlock();
+               put_online_cpus();
        }
 
        return 0;