mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 11:16:11 +00:00
PM: Change suspend code ordering
Change the ordering of the suspend core code so that the platform "prepare" callback is executed and the nonboot CPUs are disabled after calling device drivers' "late suspend" methods. This change will allow us to rework the PCI PM core so that the power state of devices is changed in the "late" phase of suspend (and analogously in the "early" phase of resume), which in turn will allow us to avoid the race condition where a device using shared interrupts is put into a low power state with interrupts enabled and then an interrupt (for another device) comes in and confuses its driver. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
2ed8d2b3a8
commit
900af0d973
1 changed files with 22 additions and 16 deletions
|
@ -297,6 +297,19 @@ static int suspend_enter(suspend_state_t state)
|
|||
goto Done;
|
||||
}
|
||||
|
||||
if (suspend_ops->prepare) {
|
||||
error = suspend_ops->prepare();
|
||||
if (error)
|
||||
goto Power_up_devices;
|
||||
}
|
||||
|
||||
if (suspend_test(TEST_PLATFORM))
|
||||
goto Platfrom_finish;
|
||||
|
||||
error = disable_nonboot_cpus();
|
||||
if (error || suspend_test(TEST_CPUS))
|
||||
goto Enable_cpus;
|
||||
|
||||
arch_suspend_disable_irqs();
|
||||
BUG_ON(!irqs_disabled());
|
||||
|
||||
|
@ -310,6 +323,14 @@ static int suspend_enter(suspend_state_t state)
|
|||
arch_suspend_enable_irqs();
|
||||
BUG_ON(irqs_disabled());
|
||||
|
||||
Enable_cpus:
|
||||
enable_nonboot_cpus();
|
||||
|
||||
Platfrom_finish:
|
||||
if (suspend_ops->finish)
|
||||
suspend_ops->finish();
|
||||
|
||||
Power_up_devices:
|
||||
device_power_up(PMSG_RESUME);
|
||||
|
||||
Done:
|
||||
|
@ -346,23 +367,8 @@ int suspend_devices_and_enter(suspend_state_t state)
|
|||
if (suspend_test(TEST_DEVICES))
|
||||
goto Recover_platform;
|
||||
|
||||
if (suspend_ops->prepare) {
|
||||
error = suspend_ops->prepare();
|
||||
if (error)
|
||||
goto Resume_devices;
|
||||
}
|
||||
suspend_enter(state);
|
||||
|
||||
if (suspend_test(TEST_PLATFORM))
|
||||
goto Finish;
|
||||
|
||||
error = disable_nonboot_cpus();
|
||||
if (!error && !suspend_test(TEST_CPUS))
|
||||
suspend_enter(state);
|
||||
|
||||
enable_nonboot_cpus();
|
||||
Finish:
|
||||
if (suspend_ops->finish)
|
||||
suspend_ops->finish();
|
||||
Resume_devices:
|
||||
suspend_test_start();
|
||||
device_resume(PMSG_RESUME);
|
||||
|
|
Loading…
Reference in a new issue