Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
84997341
Commit
84997341
authored
Jul 16, 2004
by
Patrick Mochel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Power Mgmt] Remove duplicate relocate_pagedir() from pmdisk.
- Expose and use version in swsusp.
parent
0ce7a587
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
97 deletions
+8
-97
kernel/power/pmdisk.c
kernel/power/pmdisk.c
+1
-90
kernel/power/power.h
kernel/power/power.h
+2
-0
kernel/power/swsusp.c
kernel/power/swsusp.c
+5
-7
No files found.
kernel/power/pmdisk.c
View file @
84997341
...
@@ -732,93 +732,6 @@ int pmdisk_resume(void)
...
@@ -732,93 +732,6 @@ int pmdisk_resume(void)
/* More restore stuff */
/* More restore stuff */
#define does_collide(addr) does_collide_order(pm_pagedir_nosave, addr, 0)
/*
* Returns true if given address/order collides with any orig_address
*/
static
int
__init
does_collide_order
(
suspend_pagedir_t
*
pagedir
,
unsigned
long
addr
,
int
order
)
{
int
i
;
unsigned
long
addre
=
addr
+
(
PAGE_SIZE
<<
order
);
for
(
i
=
0
;
i
<
pmdisk_pages
;
i
++
)
if
((
pagedir
+
i
)
->
orig_address
>=
addr
&&
(
pagedir
+
i
)
->
orig_address
<
addre
)
return
1
;
return
0
;
}
/*
* We check here that pagedir & pages it points to won't collide with pages
* where we're going to restore from the loaded pages later
*/
static
int
__init
check_pagedir
(
void
)
{
int
i
;
for
(
i
=
0
;
i
<
pmdisk_pages
;
i
++
)
{
unsigned
long
addr
;
do
{
addr
=
get_zeroed_page
(
GFP_ATOMIC
);
if
(
!
addr
)
return
-
ENOMEM
;
}
while
(
does_collide
(
addr
));
(
pm_pagedir_nosave
+
i
)
->
address
=
addr
;
}
return
0
;
}
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
*
old_pagedir
=
pm_pagedir_nosave
;
void
**
eaten_memory
=
NULL
;
void
**
c
=
eaten_memory
,
*
m
,
*
f
;
int
err
;
pr_debug
(
"pmdisk: Relocating pagedir
\n
"
);
if
(
!
does_collide_order
(
old_pagedir
,
(
unsigned
long
)
old_pagedir
,
pagedir_order
))
{
pr_debug
(
"pmdisk: Relocation not necessary
\n
"
);
return
0
;
}
err
=
-
ENOMEM
;
while
((
m
=
(
void
*
)
__get_free_pages
(
GFP_ATOMIC
,
pagedir_order
))
!=
NULL
)
{
if
(
!
does_collide_order
(
old_pagedir
,
(
unsigned
long
)
m
,
pagedir_order
))
{
pm_pagedir_nosave
=
memcpy
(
m
,
old_pagedir
,
PAGE_SIZE
<<
pagedir_order
);
err
=
0
;
break
;
}
eaten_memory
=
m
;
printk
(
"."
);
*
eaten_memory
=
c
;
c
=
eaten_memory
;
}
c
=
eaten_memory
;
while
(
c
)
{
printk
(
":"
);
f
=
c
;
c
=
*
c
;
free_pages
((
unsigned
long
)
f
,
pagedir_order
);
}
printk
(
"|
\n
"
);
return
err
;
}
static
struct
block_device
*
resume_bdev
;
static
struct
block_device
*
resume_bdev
;
...
@@ -1041,9 +954,7 @@ static int __init read_suspend_image(void)
...
@@ -1041,9 +954,7 @@ static int __init read_suspend_image(void)
return
error
;
return
error
;
if
((
error
=
read_pagedir
()))
if
((
error
=
read_pagedir
()))
return
error
;
return
error
;
if
((
error
=
relocate_pagedir
()))
if
((
error
=
swsusp_pagedir_relocate
()))
goto
FreePagedir
;
if
((
error
=
check_pagedir
()))
goto
FreePagedir
;
goto
FreePagedir
;
if
((
error
=
read_image_data
()))
if
((
error
=
read_image_data
()))
goto
FreePagedir
;
goto
FreePagedir
;
...
...
kernel/power/power.h
View file @
84997341
...
@@ -19,6 +19,8 @@ static inline int pm_suspend_disk(void)
...
@@ -19,6 +19,8 @@ static inline int pm_suspend_disk(void)
}
}
#endif
#endif
extern
int
swsusp_pagedir_relocate
(
void
);
extern
struct
semaphore
pm_sem
;
extern
struct
semaphore
pm_sem
;
#define power_attr(_name) \
#define power_attr(_name) \
static struct subsys_attribute _name##_attr = { \
static struct subsys_attribute _name##_attr = { \
...
...
kernel/power/swsusp.c
View file @
84997341
...
@@ -874,7 +874,7 @@ int software_suspend(void)
...
@@ -874,7 +874,7 @@ int software_suspend(void)
/*
/*
* Returns true if given address/order collides with any orig_address
* Returns true if given address/order collides with any orig_address
*/
*/
static
int
does_collide_order
(
suspend_pagedir_t
*
pagedir
,
unsigned
long
addr
,
static
int
__init
does_collide_order
(
suspend_pagedir_t
*
pagedir
,
unsigned
long
addr
,
int
order
)
int
order
)
{
{
int
i
;
int
i
;
...
@@ -892,7 +892,7 @@ static int does_collide_order(suspend_pagedir_t *pagedir, unsigned long addr,
...
@@ -892,7 +892,7 @@ static int does_collide_order(suspend_pagedir_t *pagedir, unsigned long addr,
* We check here that pagedir & pages it points to won't collide with pages
* We check here that pagedir & pages it points to won't collide with pages
* where we're going to restore from the loaded pages later
* where we're going to restore from the loaded pages later
*/
*/
static
int
check_pagedir
(
void
)
static
int
__init
check_pagedir
(
void
)
{
{
int
i
;
int
i
;
...
@@ -910,7 +910,7 @@ static int check_pagedir(void)
...
@@ -910,7 +910,7 @@ static int check_pagedir(void)
return
0
;
return
0
;
}
}
static
int
relocate_pagedir
(
void
)
int
__init
swsusp_pagedir_relocate
(
void
)
{
{
/*
/*
* We have to avoid recursion (not to overflow kernel stack),
* We have to avoid recursion (not to overflow kernel stack),
...
@@ -953,7 +953,7 @@ static int relocate_pagedir(void)
...
@@ -953,7 +953,7 @@ static int relocate_pagedir(void)
free_pages
((
unsigned
long
)
f
,
pagedir_order
);
free_pages
((
unsigned
long
)
f
,
pagedir_order
);
}
}
printk
(
"|
\n
"
);
printk
(
"|
\n
"
);
return
ret
;
return
check_pagedir
()
;
}
}
/*
/*
...
@@ -1089,9 +1089,7 @@ static int __init __read_suspend_image(struct block_device *bdev, union diskpage
...
@@ -1089,9 +1089,7 @@ static int __init __read_suspend_image(struct block_device *bdev, union diskpage
}
}
BUG_ON
(
next
.
val
);
BUG_ON
(
next
.
val
);
if
(
relocate_pagedir
())
if
(
swsusp_pagedir_relocate
())
return
-
ENOMEM
;
if
(
check_pagedir
())
return
-
ENOMEM
;
return
-
ENOMEM
;
printk
(
"Reading image data (%d pages): "
,
nr_copy_pages
);
printk
(
"Reading image data (%d pages): "
,
nr_copy_pages
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment