Commit 11700b3c authored by Patrick Mochel's avatar Patrick Mochel Committed by Patrick Mochel

[swsusp] Make sure we call restore_highmem().

- Also, make highmem calls unconditional, with #ifdef inside functions. 
parent 6bea24b9
...@@ -467,22 +467,30 @@ static int save_highmem_zone(struct zone *zone) ...@@ -467,22 +467,30 @@ static int save_highmem_zone(struct zone *zone)
} }
return 0; return 0;
} }
#endif /* CONFIG_HIGHMEM */
static int save_highmem(void) static int save_highmem(void)
{ {
#ifdef CONFIG_HIGHMEM
struct zone *zone; struct zone *zone;
int res = 0; int res = 0;
pr_debug("swsusp: Saving Highmem\n");
for_each_zone(zone) { for_each_zone(zone) {
if (is_highmem(zone)) if (is_highmem(zone))
res = save_highmem_zone(zone); res = save_highmem_zone(zone);
if (res) if (res)
return res; return res;
} }
#endif
return 0; return 0;
} }
static int restore_highmem(void) static int restore_highmem(void)
{ {
#ifdef CONFIG_HIGHMEM
printk("swsusp: Restoring Highmem\n");
while (highmem_copy) { while (highmem_copy) {
struct highmem_page *save = highmem_copy; struct highmem_page *save = highmem_copy;
void *kaddr; void *kaddr;
...@@ -494,9 +502,10 @@ static int restore_highmem(void) ...@@ -494,9 +502,10 @@ static int restore_highmem(void)
free_page((long) save->data); free_page((long) save->data);
kfree(save); kfree(save);
} }
#endif
return 0; return 0;
} }
#endif
static int pfn_is_nosave(unsigned long pfn) static int pfn_is_nosave(unsigned long pfn)
{ {
...@@ -780,15 +789,11 @@ int suspend_prepare_image(void) ...@@ -780,15 +789,11 @@ int suspend_prepare_image(void)
{ {
unsigned int nr_needed_pages = 0; unsigned int nr_needed_pages = 0;
printk( "/critical section: "); pr_debug("swsusp: critical section: \n");
#ifdef CONFIG_HIGHMEM
printk( "handling highmem" );
if (save_highmem()) { if (save_highmem()) {
printk(KERN_CRIT "%sNot enough free pages for highmem\n", name_suspend); printk(KERN_CRIT "%sNot enough free pages for highmem\n", name_suspend);
return -ENOMEM; return -ENOMEM;
} }
printk(", ");
#endif
drain_local_pages(); drain_local_pages();
count_data_pages(); count_data_pages();
...@@ -809,7 +814,7 @@ int suspend_prepare_image(void) ...@@ -809,7 +814,7 @@ int suspend_prepare_image(void)
* touch swap space! Except we must write out our image of course. * touch swap space! Except we must write out our image of course.
*/ */
printk( "critical section/: done (%d pages copied)\n", nr_copy_pages ); printk("swsusp: critical section/: done (%d pages copied)\n", nr_copy_pages );
return 0; return 0;
} }
...@@ -876,6 +881,7 @@ int swsusp_resume(void) ...@@ -876,6 +881,7 @@ int swsusp_resume(void)
save_processor_state(); save_processor_state();
error = swsusp_arch_resume(); error = swsusp_arch_resume();
restore_processor_state(); restore_processor_state();
restore_highmem();
local_irq_enable(); local_irq_enable();
return error; return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment