aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/user.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2007-07-19 04:47:28 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-19 13:04:42 -0400
commit127067a9c994dff16b280f409cc7b18a54a63719 (patch)
tree47942df4f05b22c1461c7d66f7d21773dd71afd1 /kernel/power/user.c
parenta0349828d6d6f95c445674c2953ee9db75c11f8f (diff)
swsusp: remove incorrect code from user.c
In the face of the recent change of suspend code ordering (cf. http://marc.info/?l=linux-acpi&m=117938245931603&w=2) we should also modify the code ordering in swsusp so that hibernation_ops->prepare() is executed after device_suspend(). However, for this purpose it seems reasonable to eliminate the code duplication between kernel/power/disk.c and kernel/power/user.c first. By eliminating it we can reduce the size of user.c quite substantially and remove the maintenance difficulty with making essentially the same changes in two different places. Moreover, we should also remove the calls to "platform" functions from the restore code path, since it doesn't carry out any power transition of the system, but we generally need to disable the GPEs before the restore if the 'platform' hibernation mode has been used. To do this, we can introduce two new hibernation_ops to be used in the restore code. This patch: Make the code hibernation code in kernel/power/user.c be functionally equivalent to the corresponding code in kernel/power/disk.c , as it should be. The calls to the platform functions removed by this patch are incorrect. They should be replaced with some other "platform" invocations that will be introduced in one of the subsequent patches. 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>
Diffstat (limited to 'kernel/power/user.c')
-rw-r--r--kernel/power/user.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/kernel/power/user.c b/kernel/power/user.c
index d65305b515b1..09468ec61124 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -181,34 +181,25 @@ static inline int snapshot_suspend(int platform_suspend)
181 return error; 181 return error;
182} 182}
183 183
184static inline int snapshot_restore(int platform_suspend) 184static inline int snapshot_restore(void)
185{ 185{
186 int error; 186 int error;
187 187
188 mutex_lock(&pm_mutex); 188 mutex_lock(&pm_mutex);
189 pm_prepare_console(); 189 pm_prepare_console();
190 if (platform_suspend) {
191 error = platform_prepare();
192 if (error)
193 goto Finish;
194 }
195 suspend_console(); 190 suspend_console();
196 error = device_suspend(PMSG_PRETHAW); 191 error = device_suspend(PMSG_PRETHAW);
197 if (error) 192 if (error)
198 goto Resume_devices; 193 goto Finish;
199 194
200 error = disable_nonboot_cpus(); 195 error = disable_nonboot_cpus();
201 if (!error) 196 if (!error)
202 error = swsusp_resume(); 197 error = swsusp_resume();
203 198
204 enable_nonboot_cpus(); 199 enable_nonboot_cpus();
205 Resume_devices: 200 Finish:
206 if (platform_suspend)
207 platform_finish();
208
209 device_resume(); 201 device_resume();
210 resume_console(); 202 resume_console();
211 Finish:
212 pm_restore_console(); 203 pm_restore_console();
213 mutex_unlock(&pm_mutex); 204 mutex_unlock(&pm_mutex);
214 return error; 205 return error;
@@ -274,7 +265,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
274 error = -EPERM; 265 error = -EPERM;
275 break; 266 break;
276 } 267 }
277 error = snapshot_restore(data->platform_suspend); 268 error = snapshot_restore();
278 break; 269 break;
279 270
280 case SNAPSHOT_FREE: 271 case SNAPSHOT_FREE: