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)
/* 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)
/*
......@@ -792,7 +779,7 @@ static int __init relocate_pagedir(void)
* We have to avoid recursion (not to overflow kernel stack),
* 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 **c = eaten_memory, *m, *f;
int err;
......@@ -808,8 +795,9 @@ static int __init relocate_pagedir(void)
while ((m = (void *) __get_free_pages(GFP_ATOMIC, pagedir_order))) {
if (!does_collide_order(old_pagedir, (unsigned long)m,
pagedir_order)) {
pm_pagedir_nosave = new_pagedir = m;
copy_pagedir(new_pagedir, old_pagedir);
pm_pagedir_nosave =
memcpy(m, old_pagedir,
PAGE_SIZE << pagedir_order);
err = 0;
break;
}
......
......@@ -863,19 +863,6 @@ int software_suspend(void)
/* 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)
/*
......@@ -923,7 +910,7 @@ static int relocate_pagedir(void)
* We have to avoid recursion (not to overflow kernel stack),
* 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 **c = eaten_memory, *m, *f;
int ret = 0;
......@@ -948,8 +935,8 @@ static int relocate_pagedir(void)
printk("out of memory\n");
ret = -ENOMEM;
} else {
pagedir_nosave = new_pagedir = m;
copy_pagedir(new_pagedir, old_pagedir);
pagedir_nosave =
memcpy(m, old_pagedir, PAGE_SIZE << pagedir_order);
}
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