diff options
Diffstat (limited to 'kernel/power/disk.c')
| -rw-r--r-- | kernel/power/disk.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/kernel/power/disk.c b/kernel/power/disk.c index f77d3819ef57..432ee575c9ee 100644 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c | |||
| @@ -71,6 +71,14 @@ void hibernation_set_ops(struct platform_hibernation_ops *ops) | |||
| 71 | mutex_unlock(&pm_mutex); | 71 | mutex_unlock(&pm_mutex); |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | static bool entering_platform_hibernation; | ||
| 75 | |||
| 76 | bool system_entering_hibernation(void) | ||
| 77 | { | ||
| 78 | return entering_platform_hibernation; | ||
| 79 | } | ||
| 80 | EXPORT_SYMBOL(system_entering_hibernation); | ||
| 81 | |||
| 74 | #ifdef CONFIG_PM_DEBUG | 82 | #ifdef CONFIG_PM_DEBUG |
| 75 | static void hibernation_debug_sleep(void) | 83 | static void hibernation_debug_sleep(void) |
| 76 | { | 84 | { |
| @@ -258,12 +266,12 @@ int hibernation_snapshot(int platform_mode) | |||
| 258 | { | 266 | { |
| 259 | int error; | 267 | int error; |
| 260 | 268 | ||
| 261 | /* Free memory before shutting down devices. */ | 269 | error = platform_begin(platform_mode); |
| 262 | error = swsusp_shrink_memory(); | ||
| 263 | if (error) | 270 | if (error) |
| 264 | return error; | 271 | return error; |
| 265 | 272 | ||
| 266 | error = platform_begin(platform_mode); | 273 | /* Free memory before shutting down devices. */ |
| 274 | error = swsusp_shrink_memory(); | ||
| 267 | if (error) | 275 | if (error) |
| 268 | goto Close; | 276 | goto Close; |
| 269 | 277 | ||
| @@ -411,6 +419,7 @@ int hibernation_platform_enter(void) | |||
| 411 | if (error) | 419 | if (error) |
| 412 | goto Close; | 420 | goto Close; |
| 413 | 421 | ||
| 422 | entering_platform_hibernation = true; | ||
| 414 | suspend_console(); | 423 | suspend_console(); |
| 415 | error = device_suspend(PMSG_HIBERNATE); | 424 | error = device_suspend(PMSG_HIBERNATE); |
| 416 | if (error) { | 425 | if (error) { |
| @@ -445,6 +454,7 @@ int hibernation_platform_enter(void) | |||
| 445 | Finish: | 454 | Finish: |
| 446 | hibernation_ops->finish(); | 455 | hibernation_ops->finish(); |
| 447 | Resume_devices: | 456 | Resume_devices: |
| 457 | entering_platform_hibernation = false; | ||
| 448 | device_resume(PMSG_RESTORE); | 458 | device_resume(PMSG_RESTORE); |
| 449 | resume_console(); | 459 | resume_console(); |
| 450 | Close: | 460 | Close: |
