Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1d1894749cca89f4bb013364524199b3015d7b00
Commit:     1d1894749cca89f4bb013364524199b3015d7b00
Parent:     5610db61cf2945a5e74667e952f2792c96ba53a1
Author:     Mike Frysinger <[EMAIL PROTECTED]>
AuthorDate: Thu Jul 12 12:32:00 2007 +0800
Committer:  Bryan Wu <[EMAIL PROTECTED]>
CommitDate: Thu Jul 12 12:32:00 2007 +0800

    Blackfin arch: combine the common code of free_initrd_mem and free_initmem
    
    Signed-off-by: Mike Frysinger <[EMAIL PROTECTED]>
    Signed-off-by: Bryan Wu <[EMAIL PROTECTED]>
---
 arch/blackfin/mm/init.c |   45 +++++++++++++++++----------------------------
 1 files changed, 17 insertions(+), 28 deletions(-)

diff --git a/arch/blackfin/mm/init.c b/arch/blackfin/mm/init.c
index 2d12449..68459cc 100644
--- a/arch/blackfin/mm/init.c
+++ b/arch/blackfin/mm/init.c
@@ -168,42 +168,31 @@ void __init mem_init(void)
        }
 }
 
-#ifdef CONFIG_BLK_DEV_INITRD
-void __init free_initrd_mem(unsigned long start, unsigned long end)
+static __init void free_init_pages(const char *what, unsigned long begin, 
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);
+       unsigned long addr;
+       /* next to check that the page we free is not a partial page */
+       for (addr = begin; addr + PAGE_SIZE <= end; addr += PAGE_SIZE) {
+               ClearPageReserved(virt_to_page(addr));
+               init_page_count(virt_to_page(addr));
+               free_page(addr);
                totalram_pages++;
-               pages++;
        }
-       printk(KERN_NOTICE "Freeing initrd memory: %dk freed\n", pages);
+       printk(KERN_INFO "Freeing %s: %ldk freed\n", what, (end - begin) >> 10);
+}
+
+#ifdef CONFIG_BLK_DEV_INITRD
+void __init free_initrd_mem(unsigned long start, unsigned long end)
+{
+       free_init_pages("initrd memory", start, end);
 }
 #endif
 
 void __init free_initmem(void)
 {
 #ifdef CONFIG_RAMKERNEL
-       unsigned long addr;
-       /*
-        *      the following code should be cool even if these sections
-        *      are not page aligned.
-        */
-       addr = PAGE_ALIGN((unsigned long)(__init_begin));
-       /* next to check that the page we free is not a partial page */
-       for (; addr + PAGE_SIZE < (unsigned long)(__init_end);
-            addr += PAGE_SIZE) {
-               ClearPageReserved(virt_to_page(addr));
-               init_page_count(virt_to_page(addr));
-               free_page(addr);
-               totalram_pages++;
-       }
-       printk(KERN_NOTICE
-              "Freeing unused kernel memory: %ldk freed (0x%x - 0x%x)\n",
-              (addr - PAGE_ALIGN((long)__init_begin)) >> 10,
-              (int)(PAGE_ALIGN((unsigned long)(__init_begin))),
-              (int)(addr - PAGE_SIZE));
+       free_init_pages("unused kernel memory",
+                       (unsigned long)(&__init_begin),
+                       (unsigned long)(&__init_end));
 #endif
 }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to