Commit 21efc630 authored by Herbert Xu's avatar Herbert Xu Committed by Linus Torvalds

[PATCH] swsusp: remove copy_pagedir

It can be replaced by a simple memcpy.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 50fbef1d
...@@ -732,19 +732,6 @@ int pmdisk_resume(void) ...@@ -732,19 +732,6 @@ int pmdisk_resume(void)
/* More restore stuff */ /* More restore stuff */
/* FIXME: Why not memcpy(to, from, 1<<pagedir_order*PAGE_SIZE)? */
static void __init copy_pagedir(suspend_pagedir_t *to, suspend_pagedir_t *from)
{
int i;
char *topointer=(char *)to, *frompointer=(char *)from;
for(i=0; i < 1 << pagedir_order; i++) {
copy_page(topointer, frompointer);
topointer += PAGE_SIZE;
frompointer += PAGE_SIZE;
}
}
#define does_collide(addr) does_collide_order(pm_pagedir_nosave, addr, 0) #define does_collide(addr) does_collide_order(pm_pagedir_nosave, addr, 0)
/* /*
...@@ -792,7 +779,7 @@ static int __init relocate_pagedir(void) ...@@ -792,7 +779,7 @@ static int __init relocate_pagedir(void)
* We have to avoid recursion (not to overflow kernel stack), * We have to avoid recursion (not to overflow kernel stack),
* and that's why code looks pretty cryptic * and that's why code looks pretty cryptic
*/ */
suspend_pagedir_t *new_pagedir, *old_pagedir = pm_pagedir_nosave; suspend_pagedir_t *old_pagedir = pm_pagedir_nosave;
void **eaten_memory = NULL; void **eaten_memory = NULL;
void **c = eaten_memory, *m, *f; void **c = eaten_memory, *m, *f;
int err; int err;
...@@ -808,8 +795,9 @@ static int __init relocate_pagedir(void) ...@@ -808,8 +795,9 @@ static int __init relocate_pagedir(void)
while ((m = (void *) __get_free_pages(GFP_ATOMIC, pagedir_order))) { while ((m = (void *) __get_free_pages(GFP_ATOMIC, pagedir_order))) {
if (!does_collide_order(old_pagedir, (unsigned long)m, if (!does_collide_order(old_pagedir, (unsigned long)m,
pagedir_order)) { pagedir_order)) {
pm_pagedir_nosave = new_pagedir = m; pm_pagedir_nosave =
copy_pagedir(new_pagedir, old_pagedir); memcpy(m, old_pagedir,
PAGE_SIZE << pagedir_order);
err = 0; err = 0;
break; break;
} }
......
...@@ -863,19 +863,6 @@ int software_suspend(void) ...@@ -863,19 +863,6 @@ int software_suspend(void)
/* More restore stuff */ /* More restore stuff */
/* FIXME: Why not memcpy(to, from, 1<<pagedir_order*PAGE_SIZE)? */
static void copy_pagedir(suspend_pagedir_t *to, suspend_pagedir_t *from)
{
int i;
char *topointer=(char *)to, *frompointer=(char *)from;
for(i=0; i < 1 << pagedir_order; i++) {
copy_page(topointer, frompointer);
topointer += PAGE_SIZE;
frompointer += PAGE_SIZE;
}
}
#define does_collide(addr) does_collide_order(pagedir_nosave, addr, 0) #define does_collide(addr) does_collide_order(pagedir_nosave, addr, 0)
/* /*
...@@ -923,7 +910,7 @@ static int relocate_pagedir(void) ...@@ -923,7 +910,7 @@ static int relocate_pagedir(void)
* We have to avoid recursion (not to overflow kernel stack), * We have to avoid recursion (not to overflow kernel stack),
* and that's why code looks pretty cryptic * and that's why code looks pretty cryptic
*/ */
suspend_pagedir_t *new_pagedir, *old_pagedir = pagedir_nosave; suspend_pagedir_t *old_pagedir = pagedir_nosave;
void **eaten_memory = NULL; void **eaten_memory = NULL;
void **c = eaten_memory, *m, *f; void **c = eaten_memory, *m, *f;
int ret = 0; int ret = 0;
...@@ -948,8 +935,8 @@ static int relocate_pagedir(void) ...@@ -948,8 +935,8 @@ static int relocate_pagedir(void)
printk("out of memory\n"); printk("out of memory\n");
ret = -ENOMEM; ret = -ENOMEM;
} else { } else {
pagedir_nosave = new_pagedir = m; pagedir_nosave =
copy_pagedir(new_pagedir, old_pagedir); memcpy(m, old_pagedir, PAGE_SIZE << pagedir_order);
} }
c = eaten_memory; c = eaten_memory;
......
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