diff options
author | Pavel Machek <pavel@ucw.cz> | 2005-10-30 17:59:59 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-10-30 20:37:14 -0500 |
commit | de491861e1457c31aed6d44d96afb549365ff790 (patch) | |
tree | 9480b80bab7d5f2ef141249b70a6beffde0c7599 | |
parent | 96bc7aec20b50761822f96130127b8e31e168af1 (diff) |
[PATCH] swsusp: cleanups
Reduce number of ifdefs somehow, and fix whitespace a bit. No real code
changes.
Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | kernel/power/snapshot.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index b4a923e59bc5..72787f925630 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c | |||
@@ -33,7 +33,6 @@ | |||
33 | 33 | ||
34 | #include "power.h" | 34 | #include "power.h" |
35 | 35 | ||
36 | |||
37 | #ifdef CONFIG_HIGHMEM | 36 | #ifdef CONFIG_HIGHMEM |
38 | struct highmem_page { | 37 | struct highmem_page { |
39 | char *data; | 38 | char *data; |
@@ -88,12 +87,10 @@ static int save_highmem_zone(struct zone *zone) | |||
88 | } | 87 | } |
89 | return 0; | 88 | return 0; |
90 | } | 89 | } |
91 | #endif /* CONFIG_HIGHMEM */ | ||
92 | 90 | ||
93 | 91 | ||
94 | static int save_highmem(void) | 92 | static int save_highmem(void) |
95 | { | 93 | { |
96 | #ifdef CONFIG_HIGHMEM | ||
97 | struct zone *zone; | 94 | struct zone *zone; |
98 | int res = 0; | 95 | int res = 0; |
99 | 96 | ||
@@ -104,13 +101,11 @@ static int save_highmem(void) | |||
104 | if (res) | 101 | if (res) |
105 | return res; | 102 | return res; |
106 | } | 103 | } |
107 | #endif | ||
108 | return 0; | 104 | return 0; |
109 | } | 105 | } |
110 | 106 | ||
111 | int restore_highmem(void) | 107 | int restore_highmem(void) |
112 | { | 108 | { |
113 | #ifdef CONFIG_HIGHMEM | ||
114 | printk("swsusp: Restoring Highmem\n"); | 109 | printk("swsusp: Restoring Highmem\n"); |
115 | while (highmem_copy) { | 110 | while (highmem_copy) { |
116 | struct highmem_page *save = highmem_copy; | 111 | struct highmem_page *save = highmem_copy; |
@@ -123,9 +118,12 @@ int restore_highmem(void) | |||
123 | free_page((long) save->data); | 118 | free_page((long) save->data); |
124 | kfree(save); | 119 | kfree(save); |
125 | } | 120 | } |
126 | #endif | ||
127 | return 0; | 121 | return 0; |
128 | } | 122 | } |
123 | #else | ||
124 | static int save_highmem(void) { return 0; } | ||
125 | int restore_highmem(void) { return 0; } | ||
126 | #endif /* CONFIG_HIGHMEM */ | ||
129 | 127 | ||
130 | 128 | ||
131 | static int pfn_is_nosave(unsigned long pfn) | 129 | static int pfn_is_nosave(unsigned long pfn) |
@@ -144,10 +142,10 @@ static int pfn_is_nosave(unsigned long pfn) | |||
144 | * isn't part of a free chunk of pages. | 142 | * isn't part of a free chunk of pages. |
145 | */ | 143 | */ |
146 | 144 | ||
147 | static int saveable(struct zone * zone, unsigned long * zone_pfn) | 145 | static int saveable(struct zone *zone, unsigned long *zone_pfn) |
148 | { | 146 | { |
149 | unsigned long pfn = *zone_pfn + zone->zone_start_pfn; | 147 | unsigned long pfn = *zone_pfn + zone->zone_start_pfn; |
150 | struct page * page; | 148 | struct page *page; |
151 | 149 | ||
152 | if (!pfn_valid(pfn)) | 150 | if (!pfn_valid(pfn)) |
153 | return 0; | 151 | return 0; |
@@ -201,7 +199,7 @@ static void copy_data_pages(struct pbe *pblist) | |||
201 | SetPageNosaveFree(virt_to_page(p->address)); | 199 | SetPageNosaveFree(virt_to_page(p->address)); |
202 | for (zone_pfn = 0; zone_pfn < zone->spanned_pages; ++zone_pfn) { | 200 | for (zone_pfn = 0; zone_pfn < zone->spanned_pages; ++zone_pfn) { |
203 | if (saveable(zone, &zone_pfn)) { | 201 | if (saveable(zone, &zone_pfn)) { |
204 | struct page * page; | 202 | struct page *page; |
205 | page = pfn_to_page(zone_pfn + zone->zone_start_pfn); | 203 | page = pfn_to_page(zone_pfn + zone->zone_start_pfn); |
206 | BUG_ON(!pbe); | 204 | BUG_ON(!pbe); |
207 | pbe->orig_address = (unsigned long)page_address(page); | 205 | pbe->orig_address = (unsigned long)page_address(page); |
@@ -295,7 +293,7 @@ static void *alloc_image_page(void) | |||
295 | * On each page we set up a list of struct_pbe elements. | 293 | * On each page we set up a list of struct_pbe elements. |
296 | */ | 294 | */ |
297 | 295 | ||
298 | struct pbe * alloc_pagedir(unsigned nr_pages) | 296 | struct pbe *alloc_pagedir(unsigned nr_pages) |
299 | { | 297 | { |
300 | unsigned num; | 298 | unsigned num; |
301 | struct pbe *pblist, *pbe; | 299 | struct pbe *pblist, *pbe; |
@@ -304,12 +302,12 @@ struct pbe * alloc_pagedir(unsigned nr_pages) | |||
304 | return NULL; | 302 | return NULL; |
305 | 303 | ||
306 | pr_debug("alloc_pagedir(): nr_pages = %d\n", nr_pages); | 304 | pr_debug("alloc_pagedir(): nr_pages = %d\n", nr_pages); |
307 | pblist = (struct pbe *)alloc_image_page(); | 305 | pblist = alloc_image_page(); |
308 | /* FIXME: rewrite this ugly loop */ | 306 | /* FIXME: rewrite this ugly loop */ |
309 | for (pbe = pblist, num = PBES_PER_PAGE; pbe && num < nr_pages; | 307 | for (pbe = pblist, num = PBES_PER_PAGE; pbe && num < nr_pages; |
310 | pbe = pbe->next, num += PBES_PER_PAGE) { | 308 | pbe = pbe->next, num += PBES_PER_PAGE) { |
311 | pbe += PB_PAGE_SKIP; | 309 | pbe += PB_PAGE_SKIP; |
312 | pbe->next = (struct pbe *)alloc_image_page(); | 310 | pbe->next = alloc_image_page(); |
313 | } | 311 | } |
314 | if (!pbe) { /* get_zeroed_page() failed */ | 312 | if (!pbe) { /* get_zeroed_page() failed */ |
315 | free_pagedir(pblist); | 313 | free_pagedir(pblist); |