initramfs: provide a generic free_initrd_mem implementation
authorChristoph Hellwig <hch@lst.de>
Tue, 14 May 2019 00:18:34 +0000 (17:18 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 14 May 2019 16:47:47 +0000 (09:47 -0700)
For most architectures free_initrd_mem just expands to the same
free_reserved_area call.  Provide that as a generic implementation marked
__weak.

Link: http://lkml.kernel.org/r/20190213174621.29297-8-hch@lst.de
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> [m68k]
Acked-by: Mike Rapoport <rppt@linux.ibm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com> [arm64]
Cc: Steven Price <steven.price@arm.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Guan Xuetao <gxt@pku.edu.cn>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 files changed:
arch/alpha/mm/init.c
arch/arc/mm/init.c
arch/c6x/mm/init.c
arch/h8300/mm/init.c
arch/m68k/mm/init.c
arch/microblaze/mm/init.c
arch/nds32/mm/init.c
arch/nios2/mm/init.c
arch/openrisc/mm/init.c
arch/parisc/mm/init.c
arch/powerpc/mm/mem.c
arch/sh/mm/init.c
arch/um/kernel/mem.c
arch/unicore32/mm/init.c
init/initramfs.c

index a42fc5c4db893fdafa5825347600f1baff9890db..97f4940f11e3be7b284bb9d8a1a1132d8ccec0f6 100644 (file)
@@ -291,11 +291,3 @@ free_initmem(void)
 {
        free_initmem_default(-1);
 }
-
-#ifdef CONFIG_BLK_DEV_INITRD
-void
-free_initrd_mem(unsigned long start, unsigned long end)
-{
-       free_reserved_area((void *)start, (void *)end, -1, "initrd");
-}
-#endif
index e1ab2d7f1d646510ab17a4be31b675e88027745b..c357a3bd15328448d7e844cff9b37e2838731e39 100644 (file)
@@ -214,10 +214,3 @@ void __ref free_initmem(void)
 {
        free_initmem_default(-1);
 }
-
-#ifdef CONFIG_BLK_DEV_INITRD
-void __init free_initrd_mem(unsigned long start, unsigned long end)
-{
-       free_reserved_area((void *)start, (void *)end, -1, "initrd");
-}
-#endif
index fe582c3a1794143baff4a686e85f2b24d526fe4a..6fd43ec53507163de0afcec3276d60657c798150 100644 (file)
@@ -69,13 +69,6 @@ void __init mem_init(void)
        mem_init_print_info(NULL);
 }
 
-#ifdef CONFIG_BLK_DEV_INITRD
-void __init free_initrd_mem(unsigned long start, unsigned long end)
-{
-       free_reserved_area((void *)start, (void *)end, -1, "initrd");
-}
-#endif
-
 void __init free_initmem(void)
 {
        free_initmem_default(-1);
index 0f04a5e9aa4f393226d7b1c287d2111826d944ec..ea635c9025fe7dea04810b1b5c7f045fabc5c0f2 100644 (file)
@@ -103,14 +103,6 @@ void __init mem_init(void)
        mem_init_print_info(NULL);
 }
 
-
-#ifdef CONFIG_BLK_DEV_INITRD
-void free_initrd_mem(unsigned long start, unsigned long end)
-{
-       free_reserved_area((void *)start, (void *)end, -1, "initrd");
-}
-#endif
-
 void
 free_initmem(void)
 {
index 8868a4c9adaefb3914f0c775a4205504d391ec87..778cacb7d57b3defdf05ef114af4a07423a107c2 100644 (file)
@@ -147,10 +147,3 @@ void __init mem_init(void)
        init_pointer_tables();
        mem_init_print_info(NULL);
 }
-
-#ifdef CONFIG_BLK_DEV_INITRD
-void free_initrd_mem(unsigned long start, unsigned long end)
-{
-       free_reserved_area((void *)start, (void *)end, -1, "initrd");
-}
-#endif
index 7e97d44f653801ddd8972320988aa376c8ccc2b3..b675bc666e68c15524da0732ce79fdddbafd04ba 100644 (file)
@@ -186,13 +186,6 @@ void __init setup_memory(void)
        paging_init();
 }
 
-#ifdef CONFIG_BLK_DEV_INITRD
-void free_initrd_mem(unsigned long start, unsigned long end)
-{
-       free_reserved_area((void *)start, (void *)end, -1, "initrd");
-}
-#endif
-
 void free_initmem(void)
 {
        free_initmem_default(-1);
index 1d03633f89a9f3e7b953db45001cec2839c25deb..9a7065c1fb839eedb285d02027103ff0ba19817f 100644 (file)
@@ -257,13 +257,6 @@ void free_initmem(void)
        free_initmem_default(-1);
 }
 
-#ifdef CONFIG_BLK_DEV_INITRD
-void free_initrd_mem(unsigned long start, unsigned long end)
-{
-       free_reserved_area((void *)start, (void *)end, -1, "initrd");
-}
-#endif
-
 void __set_fixmap(enum fixed_addresses idx,
                               phys_addr_t phys, pgprot_t flags)
 {
index 16cea5776b87c6aa51101ea690f8a6401df191bb..60736a72588364602196600251e471fc22a73d13 100644 (file)
@@ -82,13 +82,6 @@ void __init mmu_init(void)
        flush_tlb_all();
 }
 
-#ifdef CONFIG_BLK_DEV_INITRD
-void __init free_initrd_mem(unsigned long start, unsigned long end)
-{
-       free_reserved_area((void *)start, (void *)end, -1, "initrd");
-}
-#endif
-
 void __ref free_initmem(void)
 {
        free_initmem_default(-1);
index caeb4184e8a6bb030f93b647e0cbd076b8918a48..08df7f0b1d9648f41dbddbecdc21b5ede77c0d31 100644 (file)
@@ -224,13 +224,6 @@ void __init mem_init(void)
        return;
 }
 
-#ifdef CONFIG_BLK_DEV_INITRD
-void free_initrd_mem(unsigned long start, unsigned long end)
-{
-       free_reserved_area((void *)start, (void *)end, -1, "initrd");
-}
-#endif
-
 void free_initmem(void)
 {
        free_initmem_default(-1);
index 3b0f9eab7f2cdcf0259ec6b4def076fea0b87565..11ec1f1221a66588af23fa30d305751d10836b6f 100644 (file)
@@ -917,10 +917,3 @@ void flush_tlb_all(void)
        spin_unlock(&sid_lock);
 }
 #endif
-
-#ifdef CONFIG_BLK_DEV_INITRD
-void free_initrd_mem(unsigned long start, unsigned long end)
-{
-       free_reserved_area((void *)start, (void *)end, -1, "initrd");
-}
-#endif
index cd525d709072abf95c60c96bde6bd9cbc2deec48..20266898f3a880f2963b8016d87aeb4e1a8e991b 100644 (file)
@@ -338,13 +338,6 @@ void free_initmem(void)
        free_initmem_default(POISON_FREE_INITMEM);
 }
 
-#ifdef CONFIG_BLK_DEV_INITRD
-void __init free_initrd_mem(unsigned long start, unsigned long end)
-{
-       free_reserved_area((void *)start, (void *)end, -1, "initrd");
-}
-#endif
-
 /*
  * This is called when a page has been modified by the kernel.
  * It just marks the page as not i-cache clean.  We do the i-cache
index 70621324db4128f5f805f80a3b58f1360fe2d527..3e68d98af1bd6a56b88f8244eac6ee8c2b0e06ba 100644 (file)
@@ -408,13 +408,6 @@ void free_initmem(void)
        free_initmem_default(-1);
 }
 
-#ifdef CONFIG_BLK_DEV_INITRD
-void free_initrd_mem(unsigned long start, unsigned long end)
-{
-       free_reserved_area((void *)start, (void *)end, -1, "initrd");
-}
-#endif
-
 #ifdef CONFIG_MEMORY_HOTPLUG
 int arch_add_memory(int nid, u64 start, u64 size, struct vmem_altmap *altmap,
                bool want_memblock)
index 99aa11bf53d108d9bb5878d70e7b762b07334b1d..a9c9a94c096f7f44d23bf63249a080f67395b3be 100644 (file)
@@ -188,13 +188,6 @@ void free_initmem(void)
 {
 }
 
-#ifdef CONFIG_BLK_DEV_INITRD
-void free_initrd_mem(unsigned long start, unsigned long end)
-{
-       free_reserved_area((void *)start, (void *)end, -1, "initrd");
-}
-#endif
-
 /* Allocate and free page tables. */
 
 pgd_t *pgd_alloc(struct mm_struct *mm)
index c0573feb5064b155c2c8b96ab4e17ca74874c252..6e352de80038dcbe205fbf07d81db354f4801e54 100644 (file)
@@ -292,10 +292,3 @@ void free_initmem(void)
 {
        free_initmem_default(-1);
 }
-
-#ifdef CONFIG_BLK_DEV_INITRD
-void free_initrd_mem(unsigned long start, unsigned long end)
-{
-       free_reserved_area((void *)start, (void *)end, -1, "initrd");
-}
-#endif
index cb3d17735c6627948f295dc13db440d1df5f8295..fcb759a106be6b791278cd04ac092764f36cdc4d 100644 (file)
@@ -527,6 +527,11 @@ extern unsigned long __initramfs_size;
 #include <linux/initrd.h>
 #include <linux/kexec.h>
 
+void __weak free_initrd_mem(unsigned long start, unsigned long end)
+{
+       free_reserved_area((void *)start, (void *)end, -1, "initrd");
+}
+
 #ifdef CONFIG_KEXEC_CORE
 static bool kexec_free_initrd(void)
 {