Skip to content

Commit

Permalink
Fix ACPI suspend / device suspend ordering problem
Browse files Browse the repository at this point in the history
In commit e3c7db6 we fixed the resume
ordering, so that the ACPI low-level resume code was called before the
actual driver resume was called. However, that broke the nesting logic
of suspend and resume, and we continued to suspend the devices _after_
we the ACPI device suspend code was called.

That resulted in us saving PCI state for devices that had already been
changed by ACPI, and in some cases disabled entirely (causing the PCI
save_state to be all-ones).  Which in turn caused the wrong state to be
written back on resume.

This moves the ACPI device suspend to after the device model per-device
suspend() calls. This fixes the bogus state save.

Thanks to Lukáš Hejtmánek for testing.

Acked-by: Lukas Hejtmanek <xhejtman@ics.muni.cz>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Len Brown <len.brown@intel.com>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Linus Torvalds committed May 16, 2007
1 parent 7b104bc commit 52ade9b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions kernel/power/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,25 +97,26 @@ static int suspend_prepare(suspend_state_t state)
}
}

if (pm_ops->prepare) {
if ((error = pm_ops->prepare(state)))
goto Thaw;
}

suspend_console();
error = device_suspend(PMSG_SUSPEND);
if (error) {
printk(KERN_ERR "Some devices failed to suspend\n");
goto Resume_devices;
goto Resume_console;
}
if (pm_ops->prepare) {
if ((error = pm_ops->prepare(state)))
goto Resume_devices;
}

error = disable_nonboot_cpus();
if (!error)
return 0;

enable_nonboot_cpus();
Resume_devices:
pm_finish(state);
Resume_devices:
device_resume();
Resume_console:
resume_console();
Thaw:
thaw_processes();
Expand Down

0 comments on commit 52ade9b

Please sign in to comment.