diff options
-rw-r--r-- | kernel/power/disk.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/kernel/power/disk.c b/kernel/power/disk.c index d79feeb45459..f5079231383e 100644 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c | |||
@@ -30,6 +30,22 @@ dev_t swsusp_resume_device; | |||
30 | sector_t swsusp_resume_block; | 30 | sector_t swsusp_resume_block; |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * platform_prepare - prepare the machine for hibernation using the | ||
34 | * platform driver if so configured and return an error code if it fails | ||
35 | */ | ||
36 | |||
37 | static inline int platform_prepare(void) | ||
38 | { | ||
39 | int error = 0; | ||
40 | |||
41 | if (pm_disk_mode == PM_DISK_PLATFORM) { | ||
42 | if (pm_ops && pm_ops->prepare) | ||
43 | error = pm_ops->prepare(PM_SUSPEND_DISK); | ||
44 | } | ||
45 | return error; | ||
46 | } | ||
47 | |||
48 | /** | ||
33 | * power_down - Shut machine down for hibernate. | 49 | * power_down - Shut machine down for hibernate. |
34 | * @mode: Suspend-to-disk mode | 50 | * @mode: Suspend-to-disk mode |
35 | * | 51 | * |
@@ -91,9 +107,15 @@ static int prepare_processes(void) | |||
91 | goto thaw; | 107 | goto thaw; |
92 | } | 108 | } |
93 | 109 | ||
110 | error = platform_prepare(); | ||
111 | if (error) | ||
112 | goto thaw; | ||
113 | |||
94 | /* Free memory before shutting down devices. */ | 114 | /* Free memory before shutting down devices. */ |
95 | if (!(error = swsusp_shrink_memory())) | 115 | if (!(error = swsusp_shrink_memory())) |
96 | return 0; | 116 | return 0; |
117 | |||
118 | platform_finish(); | ||
97 | thaw: | 119 | thaw: |
98 | thaw_processes(); | 120 | thaw_processes(); |
99 | enable_cpus: | 121 | enable_cpus: |