[PATCH 3/4] swsusp: two simplifications

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>

Index: linux-2.6.14-rc4-mm1/kernel/power/disk.c
===================================================================
--- linux-2.6.14-rc4-mm1.orig/kernel/power/disk.c	2005-10-17 23:28:33.000000000 +0200
+++ linux-2.6.14-rc4-mm1/kernel/power/disk.c	2005-10-17 23:28:52.000000000 +0200
@@ -92,10 +92,7 @@
 	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 @@
 		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: linux-2.6.14-rc4-mm1/kernel/power/swsusp.c
===================================================================
--- linux-2.6.14-rc4-mm1.orig/kernel/power/swsusp.c	2005-10-17 23:28:47.000000000 +0200
+++ linux-2.6.14-rc4-mm1/kernel/power/swsusp.c	2005-10-17 23:28:52.000000000 +0200
@@ -562,7 +562,7 @@
 int swsusp_write(void)
 {
 	int error;
-	device_resume();
+
 	lock_swapdevices();
 	error = write_suspend_image();
 	/* This will unlock ignored swap devices since writing is finished */

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux