Commit 0245b3e7 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki Committed by Linus Torvalds

[PATCH] swsusp: two simplifications

The following patch simplifies the progress meter in disk.c:free_some_memory()
and makes disk.c:pm_suspend_disk() call device_resume() explicitly in the
suspend path.
Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
Acked-by: default avatarPavel Machek <pavel@suse.cz>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 2e32a43e
...@@ -92,10 +92,7 @@ static void free_some_memory(void) ...@@ -92,10 +92,7 @@ static void free_some_memory(void)
printk("Freeing memory... "); printk("Freeing memory... ");
while ((tmp = shrink_all_memory(10000))) { while ((tmp = shrink_all_memory(10000))) {
pages += tmp; pages += tmp;
printk("\b%c", p[i]); printk("\b%c", p[i++ % 4]);
i++;
if (i > 3)
i = 0;
} }
printk("\bdone (%li pages freed)\n", pages); printk("\bdone (%li pages freed)\n", pages);
} }
...@@ -177,13 +174,12 @@ int pm_suspend_disk(void) ...@@ -177,13 +174,12 @@ int pm_suspend_disk(void)
goto Done; goto Done;
if (in_suspend) { if (in_suspend) {
device_resume();
pr_debug("PM: writing image.\n"); pr_debug("PM: writing image.\n");
error = swsusp_write(); error = swsusp_write();
if (!error) if (!error)
power_down(pm_disk_mode); power_down(pm_disk_mode);
else { else {
/* swsusp_write can not fail in device_resume,
no need to do second device_resume */
swsusp_free(); swsusp_free();
unprepare_processes(); unprepare_processes();
return error; return error;
......
...@@ -562,7 +562,7 @@ int enough_swap(unsigned nr_pages) ...@@ -562,7 +562,7 @@ int enough_swap(unsigned nr_pages)
int swsusp_write(void) int swsusp_write(void)
{ {
int error; int error;
device_resume();
lock_swapdevices(); lock_swapdevices();
error = write_suspend_image(); error = write_suspend_image();
/* This will unlock ignored swap devices since writing is finished */ /* This will unlock ignored swap devices since writing is finished */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment