diff options
author | Jiang Liu <liuj97@gmail.com> | 2013-04-29 18:06:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-29 18:54:30 -0400 |
commit | 7932f61ba888a9daa3a82eaf8939902ac82029d3 (patch) | |
tree | bbe562cabe5ecf07c42aa4a6407ac5e567fe9f97 /arch/openrisc | |
parent | 32ce012064b3cc89d2081d34a745af598e5e56c5 (diff) |
mm/openrisc: use common help functions to free reserved pages
Use common help functions to free reserved pages.
Also include <asm/sections.h> to avoid local declarations.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Jonas Bonn <jonas@southpole.se>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/openrisc')
-rw-r--r-- | arch/openrisc/mm/init.c | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/arch/openrisc/mm/init.c b/arch/openrisc/mm/init.c index e7fdc50c4bf0..b3cbc6703837 100644 --- a/arch/openrisc/mm/init.c +++ b/arch/openrisc/mm/init.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <asm/kmap_types.h> | 43 | #include <asm/kmap_types.h> |
44 | #include <asm/fixmap.h> | 44 | #include <asm/fixmap.h> |
45 | #include <asm/tlbflush.h> | 45 | #include <asm/tlbflush.h> |
46 | #include <asm/sections.h> | ||
46 | 47 | ||
47 | int mem_init_done; | 48 | int mem_init_done; |
48 | 49 | ||
@@ -201,9 +202,6 @@ void __init paging_init(void) | |||
201 | 202 | ||
202 | /* References to section boundaries */ | 203 | /* References to section boundaries */ |
203 | 204 | ||
204 | extern char _stext, _etext, _edata, __bss_start, _end; | ||
205 | extern char __init_begin, __init_end; | ||
206 | |||
207 | static int __init free_pages_init(void) | 205 | static int __init free_pages_init(void) |
208 | { | 206 | { |
209 | int reservedpages, pfn; | 207 | int reservedpages, pfn; |
@@ -263,30 +261,11 @@ void __init mem_init(void) | |||
263 | #ifdef CONFIG_BLK_DEV_INITRD | 261 | #ifdef CONFIG_BLK_DEV_INITRD |
264 | void free_initrd_mem(unsigned long start, unsigned long end) | 262 | void free_initrd_mem(unsigned long start, unsigned long end) |
265 | { | 263 | { |
266 | printk(KERN_INFO "Freeing initrd memory: %ldk freed\n", | 264 | free_reserved_area(start, end, 0, "initrd"); |
267 | (end - start) >> 10); | ||
268 | |||
269 | for (; start < end; start += PAGE_SIZE) { | ||
270 | ClearPageReserved(virt_to_page(start)); | ||
271 | init_page_count(virt_to_page(start)); | ||
272 | free_page(start); | ||
273 | totalram_pages++; | ||
274 | } | ||
275 | } | 265 | } |
276 | #endif | 266 | #endif |
277 | 267 | ||
278 | void free_initmem(void) | 268 | void free_initmem(void) |
279 | { | 269 | { |
280 | unsigned long addr; | 270 | free_initmem_default(0); |
281 | |||
282 | addr = (unsigned long)(&__init_begin); | ||
283 | for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { | ||
284 | ClearPageReserved(virt_to_page(addr)); | ||
285 | init_page_count(virt_to_page(addr)); | ||
286 | free_page(addr); | ||
287 | totalram_pages++; | ||
288 | } | ||
289 | printk(KERN_INFO "Freeing unused kernel memory: %luk freed\n", | ||
290 | ((unsigned long)&__init_end - | ||
291 | (unsigned long)&__init_begin) >> 10); | ||
292 | } | 271 | } |