aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2007-07-19 04:47:31 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-19 13:04:42 -0400
commit10a1803d667e209914eaada9b95525252f23ec78 (patch)
tree0969e95d7f55d62aa8a5a3a0dd616fe4e151323e
parenta634cc10164d1c229fbeca33923e6a0ed939e894 (diff)
swsusp: fix hibernation code ordering
Change the code ordering so that hibernation_ops->prepare() is called after device_suspend(). This is needed so that we don't violate the ACPI specification, which states that the _PTS and _GTS system-control methods, executed from acpi_sleep_prepare(), ought to be called after devices have been put in low power states. The "Finish" label in hibernation_restore() is moved, because device_suspend() resumes devices if the suspending of them fails and the restore code ordering should reflect the hibernation code ordering. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Pavel Machek <pavel@ucw.cz> Cc: Nigel Cunningham <nigel@nigel.suspend2.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--kernel/power/disk.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index fa3b43b7206d..77ac605bf20a 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -133,15 +133,15 @@ int hibernation_snapshot(int platform_mode)
133 /* Free memory before shutting down devices. */ 133 /* Free memory before shutting down devices. */
134 error = swsusp_shrink_memory(); 134 error = swsusp_shrink_memory();
135 if (error) 135 if (error)
136 goto Finish; 136 return error;
137
138 error = platform_prepare(platform_mode);
139 if (error)
140 goto Finish;
141 137
142 suspend_console(); 138 suspend_console();
143 error = device_suspend(PMSG_FREEZE); 139 error = device_suspend(PMSG_FREEZE);
144 if (error) 140 if (error)
141 goto Resume_console;
142
143 error = platform_prepare(platform_mode);
144 if (error)
145 goto Resume_devices; 145 goto Resume_devices;
146 146
147 error = disable_nonboot_cpus(); 147 error = disable_nonboot_cpus();
@@ -159,8 +159,8 @@ int hibernation_snapshot(int platform_mode)
159 Resume_devices: 159 Resume_devices:
160 platform_finish(platform_mode); 160 platform_finish(platform_mode);
161 device_resume(); 161 device_resume();
162 Resume_console:
162 resume_console(); 163 resume_console();
163 Finish:
164 return error; 164 return error;
165} 165}
166 166
@@ -191,8 +191,8 @@ int hibernation_restore(int platform_mode)
191 enable_nonboot_cpus(); 191 enable_nonboot_cpus();
192 } 192 }
193 platform_restore_cleanup(platform_mode); 193 platform_restore_cleanup(platform_mode);
194 Finish:
195 device_resume(); 194 device_resume();
195 Finish:
196 resume_console(); 196 resume_console();
197 pm_restore_console(); 197 pm_restore_console();
198 return error; 198 return error;