Commit 7932f61ba888a9daa3a82eaf8939902ac82029d3
Committed by
Linus Torvalds
1 parent
32ce012064
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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>
Showing 1 changed file with 3 additions and 24 deletions Side-by-side Diff
arch/openrisc/mm/init.c
... | ... | @@ -43,6 +43,7 @@ |
43 | 43 | #include <asm/kmap_types.h> |
44 | 44 | #include <asm/fixmap.h> |
45 | 45 | #include <asm/tlbflush.h> |
46 | +#include <asm/sections.h> | |
46 | 47 | |
47 | 48 | int mem_init_done; |
48 | 49 | |
... | ... | @@ -201,9 +202,6 @@ |
201 | 202 | |
202 | 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 | 205 | static int __init free_pages_init(void) |
208 | 206 | { |
209 | 207 | int reservedpages, pfn; |
210 | 208 | |
... | ... | @@ -263,31 +261,12 @@ |
263 | 261 | #ifdef CONFIG_BLK_DEV_INITRD |
264 | 262 | void free_initrd_mem(unsigned long start, unsigned long end) |
265 | 263 | { |
266 | - printk(KERN_INFO "Freeing initrd memory: %ldk freed\n", | |
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 | - } | |
264 | + free_reserved_area(start, end, 0, "initrd"); | |
275 | 265 | } |
276 | 266 | #endif |
277 | 267 | |
278 | 268 | void free_initmem(void) |
279 | 269 | { |
280 | - unsigned long addr; | |
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); | |
270 | + free_initmem_default(0); | |
292 | 271 | } |