aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/snapshot.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2005-11-09 00:34:41 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-09 10:55:52 -0500
commit0fbeb5a45dccd493c35a68a5548e6a9d9882a791 (patch)
tree4cf24e2d08bd39d06cbe372376b4d996df8378f4 /kernel/power/snapshot.c
parented14b52701e6ef5a5aaf7bdb75932d5ea5dd7387 (diff)
[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 b8a2e9a6320..4a6dbcefd37 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -88,8 +88,7 @@ static int save_highmem_zone(struct zone *zone)
88 return 0; 88 return 0;
89} 89}
90 90
91 91int save_highmem(void)
92static int save_highmem(void)
93{ 92{
94 struct zone *zone; 93 struct zone *zone;
95 int res = 0; 94 int res = 0;
@@ -120,11 +119,7 @@ int restore_highmem(void)
120 } 119 }
121 return 0; 120 return 0;
122} 121}
123#else 122#endif
124static int save_highmem(void) { return 0; }
125int restore_highmem(void) { return 0; }
126#endif /* CONFIG_HIGHMEM */
127
128 123
129static int pfn_is_nosave(unsigned long pfn) 124static int pfn_is_nosave(unsigned long pfn)
130{ 125{
@@ -416,11 +411,6 @@ asmlinkage int swsusp_save(void)
416 unsigned int nr_pages; 411 unsigned int nr_pages;
417 412
418 pr_debug("swsusp: critical section: \n"); 413 pr_debug("swsusp: critical section: \n");
419 if (save_highmem()) {
420 printk(KERN_CRIT "swsusp: Not enough free pages for highmem\n");
421 restore_highmem();
422 return -ENOMEM;
423 }
424 414
425 drain_local_pages(); 415 drain_local_pages();
426 nr_pages = count_data_pages(); 416 nr_pages = count_data_pages();
@@ -440,11 +430,6 @@ asmlinkage int swsusp_save(void)
440 return -ENOMEM; 430 return -ENOMEM;
441 } 431 }
442 432
443 if (!enough_swap(nr_pages)) {
444 printk(KERN_ERR "swsusp: Not enough free swap\n");
445 return -ENOSPC;
446 }
447
448 pagedir_nosave = swsusp_alloc(nr_pages); 433 pagedir_nosave = swsusp_alloc(nr_pages);
449 if (!pagedir_nosave) 434 if (!pagedir_nosave)
450 return -ENOMEM; 435 return -ENOMEM;