]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm: change signature of free_reserved_area() to fix building warnings
authorJiang Liu <liuj97@gmail.com>
Wed, 19 Jun 2013 00:06:16 +0000 (10:06 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 19 Jun 2013 07:13:11 +0000 (17:13 +1000)
Change signature of free_reserved_area() according to Russell King's
suggestion to fix following build warnings:

arch/arm/mm/init.c: In function 'mem_init':
arch/arm/mm/init.c:603:2: warning: passing argument 1 of 'free_reserved_area' makes integer from pointer without a cast [enabled by default]
  free_reserved_area(__va(PHYS_PFN_OFFSET), swapper_pg_dir, 0, NULL);
  ^
In file included from include/linux/mman.h:4:0,
                 from arch/arm/mm/init.c:15:
include/linux/mm.h:1301:22: note: expected 'long unsigned int' but argument is of type 'void *'
 extern unsigned long free_reserved_area(unsigned long start, unsigned long end,

   mm/page_alloc.c: In function 'free_reserved_area':
>> mm/page_alloc.c:5134:3: warning: passing argument 1 of 'virt_to_phys' makes pointer from integer without a cast [enabled by default]
   In file included from arch/mips/include/asm/page.h:49:0,
                    from include/linux/mmzone.h:20,
                    from include/linux/gfp.h:4,
                    from include/linux/mm.h:8,
                    from mm/page_alloc.c:18:
   arch/mips/include/asm/io.h:119:29: note: expected 'const volatile void *' but argument is of type 'long unsigned int'
   mm/page_alloc.c: In function 'free_area_init_nodes':
   mm/page_alloc.c:5030:34: warning: array subscript is below array bounds [-Warray-bounds]

Also address some minor code review comments.

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Reported-by: Arnd Bergmann <arnd@arndb.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: <sworddragon2@aol.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Chris Metcalf <cmetcalf@tilera.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Jianguo Wu <wujianguo@huawei.com>
Cc: Joonsoo Kim <js1304@gmail.com>
Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Michel Lespinasse <walken@google.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Tang Chen <tangchen@cn.fujitsu.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Wen Congyang <wency@cn.fujitsu.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
31 files changed:
arch/alpha/kernel/sys_nautilus.c
arch/alpha/mm/init.c
arch/arc/mm/init.c
arch/arm/mm/init.c
arch/arm64/mm/init.c
arch/avr32/mm/init.c
arch/blackfin/mm/init.c
arch/c6x/mm/init.c
arch/frv/mm/init.c
arch/h8300/mm/init.c
arch/ia64/mm/init.c
arch/m32r/mm/init.c
arch/m68k/mm/init.c
arch/metag/mm/init.c
arch/microblaze/mm/init.c
arch/mips/mm/init.c
arch/mn10300/mm/init.c
arch/openrisc/mm/init.c
arch/parisc/mm/init.c
arch/powerpc/kernel/kvm.c
arch/powerpc/mm/mem.c
arch/s390/mm/init.c
arch/score/mm/init.c
arch/sh/mm/init.c
arch/sparc/mm/init_32.c
arch/sparc/mm/init_64.c
arch/um/kernel/mem.c
arch/unicore32/mm/init.c
arch/xtensa/mm/init.c
include/linux/mm.h
mm/page_alloc.c

index 1d4aabfcf9a160318fd790bd22d98646c270bd74..891bd274ccb5bfdb4af9be61eadcdc8af96b9d93 100644 (file)
@@ -238,8 +238,8 @@ nautilus_init_pci(void)
        if (pci_mem < memtop)
                memtop = pci_mem;
        if (memtop > alpha_mv.min_mem_address) {
-               free_reserved_area((unsigned long)__va(alpha_mv.min_mem_address),
-                                  (unsigned long)__va(memtop), 0, NULL);
+               free_reserved_area(__va(alpha_mv.min_mem_address),
+                                  __va(memtop), 0, NULL);
                printk("nautilus_init_pci: %ldk freed\n",
                        (memtop - alpha_mv.min_mem_address) >> 10);
        }
index 0ba85ee4a466721b1b91a486d04b6752901a38f2..d54848d4e464c864a3e94c77a1a6c1eb8e175aa2 100644 (file)
@@ -326,6 +326,6 @@ free_initmem(void)
 void
 free_initrd_mem(unsigned long start, unsigned long end)
 {
-       free_reserved_area(start, end, 0, "initrd");
+       free_reserved_area((void *)start, (void *)end, 0, "initrd");
 }
 #endif
index 4a177365b2c42a94abe000ec4d9de016e7f48abb..dce02e4716a1bdb87b6a66f2b295c82834db9567 100644 (file)
@@ -152,7 +152,7 @@ void __init_refok free_initmem(void)
 #ifdef CONFIG_BLK_DEV_INITRD
 void __init free_initrd_mem(unsigned long start, unsigned long end)
 {
-       free_reserved_area(start, end, 0, "initrd");
+       free_reserved_area((void *)start, (void *)end, 0, "initrd");
 }
 #endif
 
index 2ffee02d1d5cddd57ee3f0d4cb58862b98f79570..7fae391caf8651f1b72ea30a6864f159deb5dc07 100644 (file)
@@ -745,7 +745,7 @@ void free_initrd_mem(unsigned long start, unsigned long end)
 {
        if (!keep_initrd) {
                poison_init_mem((void *)start, PAGE_ALIGN(end) - start);
-               free_reserved_area(start, end, 0, "initrd");
+               free_reserved_area((void *)start, (void *)end, 0, "initrd");
        }
 }
 
index f497ca77925ac71e98036e43030b2b73dc2ca162..6041e4008a83dead3e41bf22114b1bfcccd8134c 100644 (file)
@@ -398,7 +398,7 @@ void free_initrd_mem(unsigned long start, unsigned long end)
 {
        if (!keep_initrd) {
                poison_init_mem((void *)start, PAGE_ALIGN(end) - start);
-               free_reserved_area(start, end, 0, "initrd");
+               free_reserved_area((void *)start, (void *)end, 0, "initrd");
        }
 }
 
index e66e8406f99211ba17e28ae59b491c029aa5ace6..5a79fa08cb3c746a2a2b629b4667dd05ee51c823 100644 (file)
@@ -154,6 +154,6 @@ void free_initmem(void)
 #ifdef CONFIG_BLK_DEV_INITRD
 void free_initrd_mem(unsigned long start, unsigned long end)
 {
-       free_reserved_area(start, end, 0, "initrd");
+       free_reserved_area((void *)start, (void *)end, 0, "initrd");
 }
 #endif
index 82d01a71207ffbd4eb89f9a2eb8afde424528c16..8e9eab272811fcde2f61ce0434de9822cbe2bd2f 100644 (file)
@@ -133,7 +133,7 @@ void __init mem_init(void)
 void __init free_initrd_mem(unsigned long start, unsigned long end)
 {
 #ifndef CONFIG_MPU
-       free_reserved_area(start, end, 0, "initrd");
+       free_reserved_area((void *)start, (void *)end, 0, "initrd");
 #endif
 }
 #endif
index a9fcd89b251b6ebd25eef44ce010cc8cf2f7c8a9..97914e5fc987e11868af309b8369b3834d064f0f 100644 (file)
@@ -77,7 +77,7 @@ void __init mem_init(void)
 #ifdef CONFIG_BLK_DEV_INITRD
 void __init free_initrd_mem(unsigned long start, unsigned long end)
 {
-       free_reserved_area(start, end, 0, "initrd");
+       free_reserved_area((void *)start, (void *)end, 0, "initrd");
 }
 #endif
 
index dee354fa6b64f93ae7c0e0842fe82b4a304ef1fc..a67f3a5897b8acca0f9812b8d889401fb6dd2994 100644 (file)
@@ -173,6 +173,6 @@ void free_initmem(void)
 #ifdef CONFIG_BLK_DEV_INITRD
 void __init free_initrd_mem(unsigned long start, unsigned long end)
 {
-       free_reserved_area(start, end, 0, "initrd");
+       free_reserved_area((void *)start, (void *)end, 0, "initrd");
 } /* end free_initrd_mem() */
 #endif
index ff349d70a29b6860b007f7583d747ff448f2ef8c..57e03c59861d68d95f822d180f54b53cb26d0f54 100644 (file)
@@ -161,7 +161,7 @@ void __init mem_init(void)
 #ifdef CONFIG_BLK_DEV_INITRD
 void free_initrd_mem(unsigned long start, unsigned long end)
 {
-       free_reserved_area(start, end, 0, "initrd");
+       free_reserved_area((void *)start, (void *)end, 0, "initrd");
 }
 #endif
 
index d1fe4b402601f9b1b416346aecbe8b90d74b7b88..da568c2e839f60de6af3327a9ae920fe6e6ab6b7 100644 (file)
@@ -154,8 +154,7 @@ ia64_init_addr_space (void)
 void
 free_initmem (void)
 {
-       free_reserved_area((unsigned long)ia64_imva(__init_begin),
-                          (unsigned long)ia64_imva(__init_end),
+       free_reserved_area(ia64_imva(__init_begin), ia64_imva(__init_end),
                           0, "unused kernel");
 }
 
index ab4cbce91a9bfa40acabdc13776b7bbef5fc21c2..d80412d0c14edb4494c3d08b8045422139e9c8e4 100644 (file)
@@ -191,6 +191,6 @@ void free_initmem(void)
  *======================================================================*/
 void free_initrd_mem(unsigned long start, unsigned long end)
 {
-       free_reserved_area(start, end, 0, "initrd");
+       free_reserved_area((void *)start, (void *)end, 0, "initrd");
 }
 #endif
index 1af2ca3411f6dbb8cd6fc23323951f6f979af168..95de725534e99006bf3de2e0b304430b7bc492f5 100644 (file)
@@ -202,6 +202,6 @@ void __init mem_init(void)
 #ifdef CONFIG_BLK_DEV_INITRD
 void free_initrd_mem(unsigned long start, unsigned long end)
 {
-       free_reserved_area(start, end, 0, "initrd");
+       free_reserved_area((void *)start, (void *)end, 0, "initrd");
 }
 #endif
index d05b8455c44cb9ac356c33da7473478c7047c44d..5e2238dd72e0193eb2f96f513c07226d670f1ca4 100644 (file)
@@ -414,7 +414,8 @@ void free_initmem(void)
 #ifdef CONFIG_BLK_DEV_INITRD
 void free_initrd_mem(unsigned long start, unsigned long end)
 {
-       free_reserved_area(start, end, POISON_FREE_INITMEM, "initrd");
+       free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM,
+                          "initrd");
 }
 #endif
 
index b38ae3acfeb45adbe98f95c05c9c52e42721a215..d7b8ada9345f491d56b5273ec904e2d6adab7870 100644 (file)
@@ -235,7 +235,7 @@ void __init setup_memory(void)
 #ifdef CONFIG_BLK_DEV_INITRD
 void free_initrd_mem(unsigned long start, unsigned long end)
 {
-       free_reserved_area(start, end, 0, "initrd");
+       free_reserved_area((void *)start, (void *)end, 0, "initrd");
 }
 #endif
 
index 9b973e0af9cbbd2ba7c164fcfea8d9ac93265d36..268f2a94031ba99c244575b9ec7fdffddecd44fa 100644 (file)
@@ -440,7 +440,8 @@ void free_init_pages(const char *what, unsigned long begin, unsigned long end)
 #ifdef CONFIG_BLK_DEV_INITRD
 void free_initrd_mem(unsigned long start, unsigned long end)
 {
-       free_reserved_area(start, end, POISON_FREE_INITMEM, "initrd");
+       free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM,
+                          "initrd");
 }
 #endif
 
index 5a8ace63a6b48188a6efbdc852f1d6c530d4913f..e19049d1f2b9730c56d028f6ea054bdc5bb9ebec 100644 (file)
@@ -152,6 +152,7 @@ void free_initmem(void)
 #ifdef CONFIG_BLK_DEV_INITRD
 void free_initrd_mem(unsigned long start, unsigned long end)
 {
-       free_reserved_area(start, end, POISON_FREE_INITMEM, "initrd");
+       free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM,
+                          "initrd");
 }
 #endif
index b3cbc670383789461bf29c61531e8c76679aa964..ab113325dc4c94dfab6fe2e0c86421dd89a8bb1d 100644 (file)
@@ -261,7 +261,7 @@ void __init mem_init(void)
 #ifdef CONFIG_BLK_DEV_INITRD
 void free_initrd_mem(unsigned long start, unsigned long end)
 {
-       free_reserved_area(start, end, 0, "initrd");
+       free_reserved_area((void *)start, (void *)end, 0, "initrd");
 }
 #endif
 
index 1c965642068b48d6b7102a5b6adb365f321f73e6..8fa418355e96bb9f7e9b67b9b99f6dbdf2d21a99 100644 (file)
@@ -1101,6 +1101,7 @@ void flush_tlb_all(void)
 #ifdef CONFIG_BLK_DEV_INITRD
 void free_initrd_mem(unsigned long start, unsigned long end)
 {
-       num_physpages += free_reserved_area(start, end, 0, "initrd");
+       num_physpages += free_reserved_area((void *)start, (void *)end, 0,
+                                           "initrd");
 }
 #endif
index 6782221d49bde4d5b2074fba47e5bae8fab33d84..5e4830a33c083b113a9a74702ec7a60685a762bc 100644 (file)
@@ -756,7 +756,7 @@ static __init void kvm_free_tmp(void)
        end = (ulong)&kvm_tmp[ARRAY_SIZE(kvm_tmp)] & PAGE_MASK;
 
        /* Free the tmp space we don't need */
-       free_reserved_area(start, end, 0, NULL);
+       free_reserved_area((void *)start, (void *)end, 0, NULL);
 }
 
 static int __init kvm_guest_init(void)
index 0988a26e04131e5408f8f1f3a16627b21699ad4a..347c5b1bbd62b7e850c9e8f7bc4367b1ff8b0d92 100644 (file)
@@ -407,7 +407,7 @@ void free_initmem(void)
 #ifdef CONFIG_BLK_DEV_INITRD
 void __init free_initrd_mem(unsigned long start, unsigned long end)
 {
-       free_reserved_area(start, end, 0, "initrd");
+       free_reserved_area((void *)start, (void *)end, 0, "initrd");
 }
 #endif
 
index 89ebae4008f2ff6ec46a40e10327b2302f668705..0878c89fe7d22131a16fbed19c82f12e92bb4615 100644 (file)
@@ -172,7 +172,8 @@ void free_initmem(void)
 #ifdef CONFIG_BLK_DEV_INITRD
 void __init free_initrd_mem(unsigned long start, unsigned long end)
 {
-       free_reserved_area(start, end, POISON_FREE_INITMEM, "initrd");
+       free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM,
+                          "initrd");
 }
 #endif
 
index 0940682ab38bdd700227226e22803e6310096aa5..f5dd61eb4544150f336532aa8c7f6fe3a0224d7a 100644 (file)
@@ -108,7 +108,8 @@ void __init mem_init(void)
 #ifdef CONFIG_BLK_DEV_INITRD
 void free_initrd_mem(unsigned long start, unsigned long end)
 {
-       free_reserved_area(start, end, POISON_FREE_INITMEM, "initrd");
+       free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM,
+                          "initrd");
 }
 #endif
 
index 20f9ead650d3e27c20d6f37e87a639288729b22d..b892a9b7d7e365f94915e767aa24f72be4572989 100644 (file)
@@ -505,7 +505,7 @@ void free_initmem(void)
 #ifdef CONFIG_BLK_DEV_INITRD
 void free_initrd_mem(unsigned long start, unsigned long end)
 {
-       free_reserved_area(start, end, 0, "initrd");
+       free_reserved_area((void *)start, (void *)end, 0, "initrd");
 }
 #endif
 
index af472cf7c69a1998ab1b16dcba9edb884ef7e743..d5f9c023826f90db8653efbd6d219e378fbb2b0d 100644 (file)
@@ -372,8 +372,8 @@ void free_initmem (void)
 #ifdef CONFIG_BLK_DEV_INITRD
 void free_initrd_mem(unsigned long start, unsigned long end)
 {
-       num_physpages += free_reserved_area(start, end, POISON_FREE_INITMEM,
-                                           "initrd");
+       num_physpages += free_reserved_area((void *)start, (void *)end,
+                                           POISON_FREE_INITMEM, "initrd");
 }
 #endif
 
index a7171997adfdd4b7b5bf9154528b94c31b0a3bb3..a54cdcdb6a8a52249928d0c25653f9264ce6e299 100644 (file)
@@ -2124,8 +2124,8 @@ void free_initmem(void)
 #ifdef CONFIG_BLK_DEV_INITRD
 void free_initrd_mem(unsigned long start, unsigned long end)
 {
-       num_physpages += free_reserved_area(start, end, POISON_FREE_INITMEM,
-                                           "initrd");
+       num_physpages += free_reserved_area((void *)start, (void *)end,
+                                           POISON_FREE_INITMEM, "initrd");
 }
 #endif
 
index 9df292b270a8f40fed5e32121d2dafb086919a23..2aa7a2448d5844237f7b0ae7bc51b367ee8650ff 100644 (file)
@@ -244,7 +244,7 @@ void free_initmem(void)
 #ifdef CONFIG_BLK_DEV_INITRD
 void free_initrd_mem(unsigned long start, unsigned long end)
 {
-       free_reserved_area(start, end, 0, "initrd");
+       free_reserved_area((void *)start, (void *)end, 0, "initrd");
 }
 #endif
 
index 63df12d71ce386247971161ce4d070a089731ed1..220755cc970031610a5f4a1f9acd1dc7250ae5aa 100644 (file)
@@ -486,7 +486,7 @@ static int keep_initrd;
 void free_initrd_mem(unsigned long start, unsigned long end)
 {
        if (!keep_initrd)
-               free_reserved_area(start, end, 0, "initrd");
+               free_reserved_area((void *)start, (void *)end, 0, "initrd");
 }
 
 static int __init keepinitrd_setup(char *__unused)
index bba125b4bb0693172c5e50bf92b8798b27606720..4d658efc3289caad3c3e1d8eb18300fcdf36fd41 100644 (file)
@@ -214,7 +214,7 @@ extern int initrd_is_mapped;
 void free_initrd_mem(unsigned long start, unsigned long end)
 {
        if (initrd_is_mapped)
-               free_reserved_area(start, end, 0, "initrd");
+               free_reserved_area((void *)start, (void *)end, 0, "initrd");
 }
 #endif
 
index 949bd70358954a4435daa7a033c57b3c58398f06..be1b96ce06501e81b58dbf31d04f41427c8c1a30 100644 (file)
@@ -1311,7 +1311,7 @@ extern void free_initmem(void);
  * "poison" if it's non-zero.
  * Return pages freed into the buddy system.
  */
-extern unsigned long free_reserved_area(unsigned long start, unsigned long end,
+extern unsigned long free_reserved_area(void *start, void *end,
                                        int poison, char *s);
 #ifdef CONFIG_HIGHMEM
 /*
@@ -1355,8 +1355,7 @@ static inline unsigned long free_initmem_default(int poison)
 {
        extern char __init_begin[], __init_end[];
 
-       return free_reserved_area(PAGE_ALIGN((unsigned long)&__init_begin) ,
-                                 ((unsigned long)&__init_end) & PAGE_MASK,
+       return free_reserved_area(&__init_begin, &__init_end,
                                  poison, "unused kernel");
 }
 
index d711dcdda36275d82c09e7d72267ad00586d41ff..be18ccd017bbf63d72c26129849423de742df0a8 100644 (file)
@@ -5206,25 +5206,26 @@ early_param("movablecore", cmdline_parse_movablecore);
 
 #endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
 
-unsigned long free_reserved_area(unsigned long start, unsigned long end,
-                                int poison, char *s)
+unsigned long free_reserved_area(void *start, void *end, int poison, char *s)
 {
-       unsigned long pages, pos;
+       void *pos;
+       unsigned long pages = 0;
 
-       pos = start = PAGE_ALIGN(start);
-       end &= PAGE_MASK;
-       for (pages = 0; pos < end; pos += PAGE_SIZE, pages++) {
+       start = (void *)PAGE_ALIGN((unsigned long)start);
+       end = (void *)((unsigned long)end & PAGE_MASK);
+       for (pos = start; pos < end; pos += PAGE_SIZE, pages++) {
                if (poison)
-                       memset((void *)pos, poison, PAGE_SIZE);
-               free_reserved_page(virt_to_page((void *)pos));
+                       memset(pos, poison, PAGE_SIZE);
+               free_reserved_page(virt_to_page(pos));
        }
 
        if (pages && s)
-               pr_info("Freeing %s memory: %ldK (%lx - %lx)\n",
+               pr_info("Freeing %s memory: %ldK (%p - %p)\n",
                        s, pages << (PAGE_SHIFT - 10), start, end);
 
        return pages;
 }
+EXPORT_SYMBOL(free_reserved_area);
 
 #ifdef CONFIG_HIGHMEM
 void free_highmem_page(struct page *page)