aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/disk.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/power/disk.c')
-rw-r--r--kernel/power/disk.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index 8df51c23bba4..403bc3722fee 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -139,14 +139,19 @@ int pm_suspend_disk(void)
139 mdelay(5000); 139 mdelay(5000);
140 goto Thaw; 140 goto Thaw;
141 } 141 }
142 /* Allocate memory management structures */
143 error = create_basic_memory_bitmaps();
144 if (error)
145 goto Thaw;
146
142 /* Free memory before shutting down devices. */ 147 /* Free memory before shutting down devices. */
143 error = swsusp_shrink_memory(); 148 error = swsusp_shrink_memory();
144 if (error) 149 if (error)
145 goto Thaw; 150 goto Finish;
146 151
147 error = platform_prepare(); 152 error = platform_prepare();
148 if (error) 153 if (error)
149 goto Thaw; 154 goto Finish;
150 155
151 suspend_console(); 156 suspend_console();
152 error = device_suspend(PMSG_FREEZE); 157 error = device_suspend(PMSG_FREEZE);
@@ -181,7 +186,7 @@ int pm_suspend_disk(void)
181 power_down(); 186 power_down();
182 else { 187 else {
183 swsusp_free(); 188 swsusp_free();
184 goto Thaw; 189 goto Finish;
185 } 190 }
186 } else { 191 } else {
187 pr_debug("PM: Image restored successfully.\n"); 192 pr_debug("PM: Image restored successfully.\n");
@@ -194,6 +199,8 @@ int pm_suspend_disk(void)
194 platform_finish(); 199 platform_finish();
195 device_resume(); 200 device_resume();
196 resume_console(); 201 resume_console();
202 Finish:
203 free_basic_memory_bitmaps();
197 Thaw: 204 Thaw:
198 unprepare_processes(); 205 unprepare_processes();
199 return error; 206 return error;
@@ -239,13 +246,15 @@ static int software_resume(void)
239 } 246 }
240 247
241 pr_debug("PM: Checking swsusp image.\n"); 248 pr_debug("PM: Checking swsusp image.\n");
242
243 error = swsusp_check(); 249 error = swsusp_check();
244 if (error) 250 if (error)
245 goto Done; 251 goto Unlock;
246 252
247 pr_debug("PM: Preparing processes for restore.\n"); 253 error = create_basic_memory_bitmaps();
254 if (error)
255 goto Unlock;
248 256
257 pr_debug("PM: Preparing processes for restore.\n");
249 error = prepare_processes(); 258 error = prepare_processes();
250 if (error) { 259 if (error) {
251 swsusp_close(); 260 swsusp_close();
@@ -280,7 +289,9 @@ static int software_resume(void)
280 printk(KERN_ERR "PM: Restore failed, recovering.\n"); 289 printk(KERN_ERR "PM: Restore failed, recovering.\n");
281 unprepare_processes(); 290 unprepare_processes();
282 Done: 291 Done:
292 free_basic_memory_bitmaps();
283 /* For success case, the suspend path will release the lock */ 293 /* For success case, the suspend path will release the lock */
294 Unlock:
284 mutex_unlock(&pm_mutex); 295 mutex_unlock(&pm_mutex);
285 pr_debug("PM: Resume from disk failed.\n"); 296 pr_debug("PM: Resume from disk failed.\n");
286 return 0; 297 return 0;