diff options
Diffstat (limited to 'kernel/power/disk.c')
-rw-r--r-- | kernel/power/disk.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/kernel/power/disk.c b/kernel/power/disk.c index d416be0efa8a..f011e0870b52 100644 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c | |||
@@ -180,6 +180,17 @@ static void platform_restore_cleanup(int platform_mode) | |||
180 | } | 180 | } |
181 | 181 | ||
182 | /** | 182 | /** |
183 | * platform_recover - recover the platform from a failure to suspend | ||
184 | * devices. | ||
185 | */ | ||
186 | |||
187 | static void platform_recover(int platform_mode) | ||
188 | { | ||
189 | if (platform_mode && hibernation_ops && hibernation_ops->recover) | ||
190 | hibernation_ops->recover(); | ||
191 | } | ||
192 | |||
193 | /** | ||
183 | * create_image - freeze devices that need to be frozen with interrupts | 194 | * create_image - freeze devices that need to be frozen with interrupts |
184 | * off, create the hibernation image and thaw those devices. Control | 195 | * off, create the hibernation image and thaw those devices. Control |
185 | * reappears in this routine after a restore. | 196 | * reappears in this routine after a restore. |
@@ -258,10 +269,10 @@ int hibernation_snapshot(int platform_mode) | |||
258 | suspend_console(); | 269 | suspend_console(); |
259 | error = device_suspend(PMSG_FREEZE); | 270 | error = device_suspend(PMSG_FREEZE); |
260 | if (error) | 271 | if (error) |
261 | goto Resume_console; | 272 | goto Recover_platform; |
262 | 273 | ||
263 | if (hibernation_test(TEST_DEVICES)) | 274 | if (hibernation_test(TEST_DEVICES)) |
264 | goto Resume_devices; | 275 | goto Recover_platform; |
265 | 276 | ||
266 | error = platform_pre_snapshot(platform_mode); | 277 | error = platform_pre_snapshot(platform_mode); |
267 | if (error || hibernation_test(TEST_PLATFORM)) | 278 | if (error || hibernation_test(TEST_PLATFORM)) |
@@ -285,11 +296,14 @@ int hibernation_snapshot(int platform_mode) | |||
285 | Resume_devices: | 296 | Resume_devices: |
286 | device_resume(in_suspend ? | 297 | device_resume(in_suspend ? |
287 | (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE); | 298 | (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE); |
288 | Resume_console: | ||
289 | resume_console(); | 299 | resume_console(); |
290 | Close: | 300 | Close: |
291 | platform_end(platform_mode); | 301 | platform_end(platform_mode); |
292 | return error; | 302 | return error; |
303 | |||
304 | Recover_platform: | ||
305 | platform_recover(platform_mode); | ||
306 | goto Resume_devices; | ||
293 | } | 307 | } |
294 | 308 | ||
295 | /** | 309 | /** |
@@ -398,8 +412,11 @@ int hibernation_platform_enter(void) | |||
398 | 412 | ||
399 | suspend_console(); | 413 | suspend_console(); |
400 | error = device_suspend(PMSG_HIBERNATE); | 414 | error = device_suspend(PMSG_HIBERNATE); |
401 | if (error) | 415 | if (error) { |
402 | goto Resume_console; | 416 | if (hibernation_ops->recover) |
417 | hibernation_ops->recover(); | ||
418 | goto Resume_devices; | ||
419 | } | ||
403 | 420 | ||
404 | error = hibernation_ops->prepare(); | 421 | error = hibernation_ops->prepare(); |
405 | if (error) | 422 | if (error) |
@@ -428,7 +445,6 @@ int hibernation_platform_enter(void) | |||
428 | hibernation_ops->finish(); | 445 | hibernation_ops->finish(); |
429 | Resume_devices: | 446 | Resume_devices: |
430 | device_resume(PMSG_RESTORE); | 447 | device_resume(PMSG_RESTORE); |
431 | Resume_console: | ||
432 | resume_console(); | 448 | resume_console(); |
433 | Close: | 449 | Close: |
434 | hibernation_ops->end(); | 450 | hibernation_ops->end(); |