mm/microblaze: use common help functions to free reserved pages
authorJiang Liu <liuj97@gmail.com>
Mon, 29 Apr 2013 22:06:42 +0000 (15:06 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 29 Apr 2013 22:54:30 +0000 (15:54 -0700)
Use common help functions to free reserved pages.

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Michal Simek <monstr@monstr.eu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/microblaze/include/asm/setup.h
arch/microblaze/mm/init.c

index 0e0b0a5ec7568655e35a220635ffd07eac18f65e..f05df5630c842a8033b24125e29b4e6030644fdf 100644 (file)
@@ -46,7 +46,6 @@ void machine_shutdown(void);
 void machine_halt(void);
 void machine_power_off(void);
 
-void free_init_pages(char *what, unsigned long begin, unsigned long end);
 extern void *alloc_maybe_bootmem(size_t size, gfp_t mask);
 extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask);
 
index 8f8b367c079ee6285fbb4b290b30d3263b07e0ef..9be53024a832d3b80e6e62715d9722130de2a67f 100644 (file)
@@ -236,40 +236,16 @@ void __init setup_memory(void)
        paging_init();
 }
 
-void free_init_pages(char *what, unsigned long begin, unsigned long end)
-{
-       unsigned long addr;
-
-       for (addr = begin; addr < end; addr += PAGE_SIZE) {
-               ClearPageReserved(virt_to_page(addr));
-               init_page_count(virt_to_page(addr));
-               free_page(addr);
-               totalram_pages++;
-       }
-       pr_info("Freeing %s: %ldk freed\n", what, (end - begin) >> 10);
-}
-
 #ifdef CONFIG_BLK_DEV_INITRD
 void free_initrd_mem(unsigned long start, unsigned long end)
 {
-       int pages = 0;
-       for (; start < end; start += PAGE_SIZE) {
-               ClearPageReserved(virt_to_page(start));
-               init_page_count(virt_to_page(start));
-               free_page(start);
-               totalram_pages++;
-               pages++;
-       }
-       pr_notice("Freeing initrd memory: %dk freed\n",
-                                       (int)(pages * (PAGE_SIZE / 1024)));
+       free_reserved_area(start, end, 0, "initrd");
 }
 #endif
 
 void free_initmem(void)
 {
-       free_init_pages("unused kernel memory",
-                       (unsigned long)(&__init_begin),
-                       (unsigned long)(&__init_end));
+       free_initmem_default(0);
 }
 
 void __init mem_init(void)