summaryrefslogtreecommitdiff
path: root/kernel/power/snapshot.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2005-11-08 21:34:41 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-09 07:55:52 -0800
commit0fbeb5a45dccd493c35a68a5548e6a9d9882a791 (patch)
tree4cf24e2d08bd39d06cbe372376b4d996df8378f4 /kernel/power/snapshot.c
parented14b52701e6ef5a5aaf7bdb75932d5ea5dd7387 (diff)
downloadlwn-0fbeb5a45dccd493c35a68a5548e6a9d9882a791.tar.gz
lwn-0fbeb5a45dccd493c35a68a5548e6a9d9882a791.zip
[PATCH] swsusp: rework swsusp_suspend
This patch makes only the functions in swsusp.c call functions in snapshot.c and not both ways. It also 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. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Cc: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/power/snapshot.c')
-rw-r--r--kernel/power/snapshot.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index b8a2e9a63206..4a6dbcefd378 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -88,8 +88,7 @@ static int save_highmem_zone(struct zone *zone)
return 0;
}
-
-static int save_highmem(void)
+int save_highmem(void)
{
struct zone *zone;
int res = 0;
@@ -120,11 +119,7 @@ int restore_highmem(void)
}
return 0;
}
-#else
-static int save_highmem(void) { return 0; }
-int restore_highmem(void) { return 0; }
-#endif /* CONFIG_HIGHMEM */
-
+#endif
static int pfn_is_nosave(unsigned long pfn)
{
@@ -416,11 +411,6 @@ asmlinkage int swsusp_save(void)
unsigned int nr_pages;
pr_debug("swsusp: critical section: \n");
- if (save_highmem()) {
- printk(KERN_CRIT "swsusp: Not enough free pages for highmem\n");
- restore_highmem();
- return -ENOMEM;
- }
drain_local_pages();
nr_pages = count_data_pages();
@@ -440,11 +430,6 @@ asmlinkage int swsusp_save(void)
return -ENOMEM;
}
- if (!enough_swap(nr_pages)) {
- printk(KERN_ERR "swsusp: Not enough free swap\n");
- return -ENOSPC;
- }
-
pagedir_nosave = swsusp_alloc(nr_pages);
if (!pagedir_nosave)
return -ENOMEM;