diff options
Diffstat (limited to 'kernel/power/disk.c')
-rw-r--r-- | kernel/power/disk.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/kernel/power/disk.c b/kernel/power/disk.c index 761956e813f5..027322a564f4 100644 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c | |||
@@ -30,7 +30,6 @@ extern int swsusp_check(void); | |||
30 | extern int swsusp_read(void); | 30 | extern int swsusp_read(void); |
31 | extern void swsusp_close(void); | 31 | extern void swsusp_close(void); |
32 | extern int swsusp_resume(void); | 32 | extern int swsusp_resume(void); |
33 | extern int swsusp_free(void); | ||
34 | 33 | ||
35 | 34 | ||
36 | static int noresume = 0; | 35 | static int noresume = 0; |
@@ -93,10 +92,7 @@ static void free_some_memory(void) | |||
93 | printk("Freeing memory... "); | 92 | printk("Freeing memory... "); |
94 | while ((tmp = shrink_all_memory(10000))) { | 93 | while ((tmp = shrink_all_memory(10000))) { |
95 | pages += tmp; | 94 | pages += tmp; |
96 | printk("\b%c", p[i]); | 95 | printk("\b%c", p[i++ % 4]); |
97 | i++; | ||
98 | if (i > 3) | ||
99 | i = 0; | ||
100 | } | 96 | } |
101 | printk("\bdone (%li pages freed)\n", pages); | 97 | printk("\bdone (%li pages freed)\n", pages); |
102 | } | 98 | } |
@@ -178,13 +174,12 @@ int pm_suspend_disk(void) | |||
178 | goto Done; | 174 | goto Done; |
179 | 175 | ||
180 | if (in_suspend) { | 176 | if (in_suspend) { |
177 | device_resume(); | ||
181 | pr_debug("PM: writing image.\n"); | 178 | pr_debug("PM: writing image.\n"); |
182 | error = swsusp_write(); | 179 | error = swsusp_write(); |
183 | if (!error) | 180 | if (!error) |
184 | power_down(pm_disk_mode); | 181 | power_down(pm_disk_mode); |
185 | else { | 182 | else { |
186 | /* swsusp_write can not fail in device_resume, | ||
187 | no need to do second device_resume */ | ||
188 | swsusp_free(); | 183 | swsusp_free(); |
189 | unprepare_processes(); | 184 | unprepare_processes(); |
190 | return error; | 185 | return error; |
@@ -252,14 +247,17 @@ static int software_resume(void) | |||
252 | 247 | ||
253 | pr_debug("PM: Reading swsusp image.\n"); | 248 | pr_debug("PM: Reading swsusp image.\n"); |
254 | 249 | ||
255 | if ((error = swsusp_read())) | 250 | if ((error = swsusp_read())) { |
256 | goto Cleanup; | 251 | swsusp_free(); |
252 | goto Thaw; | ||
253 | } | ||
257 | 254 | ||
258 | pr_debug("PM: Preparing devices for restore.\n"); | 255 | pr_debug("PM: Preparing devices for restore.\n"); |
259 | 256 | ||
260 | if ((error = device_suspend(PMSG_FREEZE))) { | 257 | if ((error = device_suspend(PMSG_FREEZE))) { |
261 | printk("Some devices failed to suspend\n"); | 258 | printk("Some devices failed to suspend\n"); |
262 | goto Free; | 259 | swsusp_free(); |
260 | goto Thaw; | ||
263 | } | 261 | } |
264 | 262 | ||
265 | mb(); | 263 | mb(); |
@@ -268,9 +266,7 @@ static int software_resume(void) | |||
268 | swsusp_resume(); | 266 | swsusp_resume(); |
269 | pr_debug("PM: Restore failed, recovering.n"); | 267 | pr_debug("PM: Restore failed, recovering.n"); |
270 | device_resume(); | 268 | device_resume(); |
271 | Free: | 269 | Thaw: |
272 | swsusp_free(); | ||
273 | Cleanup: | ||
274 | unprepare_processes(); | 270 | unprepare_processes(); |
275 | Done: | 271 | Done: |
276 | /* For success case, the suspend path will release the lock */ | 272 | /* For success case, the suspend path will release the lock */ |