[PATCH 3/3] swsusp: move swap check out of swsusp_suspend

From: Rafael J. Wysocki
Date: Sun Oct 30 2005 - 10:52:56 EST


This patch moves the check for available swap out of swsusp_suspend(),
which is necessary for separating the swap-handling functions in swsusp
from the core code. No functionality changes.

Signed-off-by: Rafael J. Wysocki <rjw@xxxxxxx>

kernel/power/swsusp.c | 13 +++++--------
1 files changed, 5 insertions(+), 8 deletions(-)

Index: linux-2.6.14-rc5-mm1/kernel/power/swsusp.c
===================================================================
--- linux-2.6.14-rc5-mm1.orig/kernel/power/swsusp.c 2005-10-30 12:36:58.000000000 +0100
+++ linux-2.6.14-rc5-mm1/kernel/power/swsusp.c 2005-10-30 12:37:12.000000000 +0100
@@ -567,12 +567,15 @@
{
int error;

+ if ((error = swsusp_swap_check())) {
+ printk(KERN_ERR "swsusp: cannot find swap device, try swapon -a.\n");
+ return error;
+ }
lock_swapdevices();
error = write_suspend_image();
/* This will unlock ignored swap devices since writing is finished */
lock_swapdevices();
return error;
-
}


@@ -595,11 +598,6 @@
goto Enable_irqs;
}

- if ((error = swsusp_swap_check())) {
- printk(KERN_ERR "swsusp: cannot find swap device, try swapon -a.\n");
- goto Power_up;
- }
-
if ((error = save_highmem())) {
printk(KERN_ERR "swsusp: Not enough free pages for highmem\n");
goto Restore_highmem;
@@ -612,7 +610,6 @@
restore_processor_state();
Restore_highmem:
restore_highmem();
-Power_up:
device_power_up();
Enable_irqs:
local_irq_enable();
@@ -781,7 +778,7 @@
* Reset swap signature now.
*/
error = bio_write_page(0, &swsusp_header);
- } else {
+ } else {
return -EINVAL;
}
if (!error)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/