]> err.no Git - linux-2.6/commitdiff
[PATCH] swsusp: two simplifications
authorRafael J. Wysocki <rjw@sisk.pl>
Sun, 30 Oct 2005 23:00:01 +0000 (15:00 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 31 Oct 2005 01:37:15 +0000 (17:37 -0800)
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: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
kernel/power/disk.c
kernel/power/swsusp.c

index 44ef5e799df0e05a2d2da64606eb758c469564d7..027322a564f48ac2c79c08ab9240a5db7b42751f 100644 (file)
@@ -92,10 +92,7 @@ static void free_some_memory(void)
        printk("Freeing memory...  ");
        while ((tmp = shrink_all_memory(10000))) {
                pages += tmp;
-               printk("\b%c", p[i]);
-               i++;
-               if (i > 3)
-                       i = 0;
+               printk("\b%c", p[i++ % 4]);
        }
        printk("\bdone (%li pages freed)\n", pages);
 }
@@ -177,13 +174,12 @@ int pm_suspend_disk(void)
                goto Done;
 
        if (in_suspend) {
+               device_resume();
                pr_debug("PM: writing image.\n");
                error = swsusp_write();
                if (!error)
                        power_down(pm_disk_mode);
                else {
-               /* swsusp_write can not fail in device_resume,
-                  no need to do second device_resume */
                        swsusp_free();
                        unprepare_processes();
                        return error;
index ae8425b69b44a9be863e0c45d29231cf5514bcb8..12db1d2ad61f89e5667f21f339b2bd9c3fd3969f 100644 (file)
@@ -562,7 +562,7 @@ int enough_swap(unsigned nr_pages)
 int swsusp_write(void)
 {
        int error;
-       device_resume();
+
        lock_swapdevices();
        error = write_suspend_image();
        /* This will unlock ignored swap devices since writing is finished */