diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/power/hibernate.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index 95a2ac40f48c..f9bec56d8825 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c | |||
@@ -327,20 +327,25 @@ static int create_image(int platform_mode) | |||
327 | 327 | ||
328 | int hibernation_snapshot(int platform_mode) | 328 | int hibernation_snapshot(int platform_mode) |
329 | { | 329 | { |
330 | pm_message_t msg = PMSG_RECOVER; | ||
330 | int error; | 331 | int error; |
331 | 332 | ||
332 | error = platform_begin(platform_mode); | 333 | error = platform_begin(platform_mode); |
333 | if (error) | 334 | if (error) |
334 | goto Close; | 335 | goto Close; |
335 | 336 | ||
337 | error = dpm_prepare(PMSG_FREEZE); | ||
338 | if (error) | ||
339 | goto Complete_devices; | ||
340 | |||
336 | /* Preallocate image memory before shutting down devices. */ | 341 | /* Preallocate image memory before shutting down devices. */ |
337 | error = hibernate_preallocate_memory(); | 342 | error = hibernate_preallocate_memory(); |
338 | if (error) | 343 | if (error) |
339 | goto Close; | 344 | goto Complete_devices; |
340 | 345 | ||
341 | suspend_console(); | 346 | suspend_console(); |
342 | pm_restrict_gfp_mask(); | 347 | pm_restrict_gfp_mask(); |
343 | error = dpm_suspend_start(PMSG_FREEZE); | 348 | error = dpm_suspend(PMSG_FREEZE); |
344 | if (error) | 349 | if (error) |
345 | goto Recover_platform; | 350 | goto Recover_platform; |
346 | 351 | ||
@@ -358,13 +363,17 @@ int hibernation_snapshot(int platform_mode) | |||
358 | if (error || !in_suspend) | 363 | if (error || !in_suspend) |
359 | swsusp_free(); | 364 | swsusp_free(); |
360 | 365 | ||
361 | dpm_resume_end(in_suspend ? | 366 | msg = in_suspend ? (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE; |
362 | (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE); | 367 | dpm_resume(msg); |
363 | 368 | ||
364 | if (error || !in_suspend) | 369 | if (error || !in_suspend) |
365 | pm_restore_gfp_mask(); | 370 | pm_restore_gfp_mask(); |
366 | 371 | ||
367 | resume_console(); | 372 | resume_console(); |
373 | |||
374 | Complete_devices: | ||
375 | dpm_complete(msg); | ||
376 | |||
368 | Close: | 377 | Close: |
369 | platform_end(platform_mode); | 378 | platform_end(platform_mode); |
370 | return error; | 379 | return error; |