diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-16 18:28:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-16 18:33:19 -0400 |
commit | 52ade9b3b97fd3bea42842a056fe0786c28d0555 (patch) | |
tree | 70ae152f573b5d0f5078e2506830c3b804ab6816 /kernel/power | |
parent | 7b104bcb8e460e45a1aebe3da9b86aacdb4cab12 (diff) |
Fix ACPI suspend / device suspend ordering problem
In commit e3c7db621bed4afb8e231cb005057f2feb5db557 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>
Diffstat (limited to 'kernel/power')
-rw-r--r-- | kernel/power/main.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/kernel/power/main.c b/kernel/power/main.c index 40d56a31245e..b98b80ccf437 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
@@ -97,25 +97,26 @@ static int suspend_prepare(suspend_state_t state) | |||
97 | } | 97 | } |
98 | } | 98 | } |
99 | 99 | ||
100 | if (pm_ops->prepare) { | ||
101 | if ((error = pm_ops->prepare(state))) | ||
102 | goto Thaw; | ||
103 | } | ||
104 | |||
105 | suspend_console(); | 100 | suspend_console(); |
106 | error = device_suspend(PMSG_SUSPEND); | 101 | error = device_suspend(PMSG_SUSPEND); |
107 | if (error) { | 102 | if (error) { |
108 | printk(KERN_ERR "Some devices failed to suspend\n"); | 103 | printk(KERN_ERR "Some devices failed to suspend\n"); |
109 | goto Resume_devices; | 104 | goto Resume_console; |
110 | } | 105 | } |
106 | if (pm_ops->prepare) { | ||
107 | if ((error = pm_ops->prepare(state))) | ||
108 | goto Resume_devices; | ||
109 | } | ||
110 | |||
111 | error = disable_nonboot_cpus(); | 111 | error = disable_nonboot_cpus(); |
112 | if (!error) | 112 | if (!error) |
113 | return 0; | 113 | return 0; |
114 | 114 | ||
115 | enable_nonboot_cpus(); | 115 | enable_nonboot_cpus(); |
116 | Resume_devices: | ||
117 | pm_finish(state); | 116 | pm_finish(state); |
117 | Resume_devices: | ||
118 | device_resume(); | 118 | device_resume(); |
119 | Resume_console: | ||
119 | resume_console(); | 120 | resume_console(); |
120 | Thaw: | 121 | Thaw: |
121 | thaw_processes(); | 122 | thaw_processes(); |