Commit 4afd58e1 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Linus Torvalds

initramfs: provide a generic free_initrd_mem implementation

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.deSigned-off-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>	[m68k]
Acked-by: default avatarMike 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent d8ae8a37
...@@ -291,11 +291,3 @@ free_initmem(void) ...@@ -291,11 +291,3 @@ free_initmem(void)
{ {
free_initmem_default(-1); 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
...@@ -214,10 +214,3 @@ void __ref free_initmem(void) ...@@ -214,10 +214,3 @@ void __ref free_initmem(void)
{ {
free_initmem_default(-1); 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
...@@ -69,13 +69,6 @@ void __init mem_init(void) ...@@ -69,13 +69,6 @@ void __init mem_init(void)
mem_init_print_info(NULL); 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) void __init free_initmem(void)
{ {
free_initmem_default(-1); free_initmem_default(-1);
......
...@@ -103,14 +103,6 @@ void __init mem_init(void) ...@@ -103,14 +103,6 @@ void __init mem_init(void)
mem_init_print_info(NULL); 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 void
free_initmem(void) free_initmem(void)
{ {
......
...@@ -147,10 +147,3 @@ void __init mem_init(void) ...@@ -147,10 +147,3 @@ void __init mem_init(void)
init_pointer_tables(); init_pointer_tables();
mem_init_print_info(NULL); 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
...@@ -186,13 +186,6 @@ void __init setup_memory(void) ...@@ -186,13 +186,6 @@ void __init setup_memory(void)
paging_init(); 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) void free_initmem(void)
{ {
free_initmem_default(-1); free_initmem_default(-1);
......
...@@ -257,13 +257,6 @@ void free_initmem(void) ...@@ -257,13 +257,6 @@ void free_initmem(void)
free_initmem_default(-1); 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, void __set_fixmap(enum fixed_addresses idx,
phys_addr_t phys, pgprot_t flags) phys_addr_t phys, pgprot_t flags)
{ {
......
...@@ -82,13 +82,6 @@ void __init mmu_init(void) ...@@ -82,13 +82,6 @@ void __init mmu_init(void)
flush_tlb_all(); 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) void __ref free_initmem(void)
{ {
free_initmem_default(-1); free_initmem_default(-1);
......
...@@ -224,13 +224,6 @@ void __init mem_init(void) ...@@ -224,13 +224,6 @@ void __init mem_init(void)
return; 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) void free_initmem(void)
{ {
free_initmem_default(-1); free_initmem_default(-1);
......
...@@ -917,10 +917,3 @@ void flush_tlb_all(void) ...@@ -917,10 +917,3 @@ void flush_tlb_all(void)
spin_unlock(&sid_lock); spin_unlock(&sid_lock);
} }
#endif #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
...@@ -338,13 +338,6 @@ void free_initmem(void) ...@@ -338,13 +338,6 @@ void free_initmem(void)
free_initmem_default(POISON_FREE_INITMEM); 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. * 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 * It just marks the page as not i-cache clean. We do the i-cache
......
...@@ -408,13 +408,6 @@ void free_initmem(void) ...@@ -408,13 +408,6 @@ void free_initmem(void)
free_initmem_default(-1); 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 #ifdef CONFIG_MEMORY_HOTPLUG
int arch_add_memory(int nid, u64 start, u64 size, struct vmem_altmap *altmap, int arch_add_memory(int nid, u64 start, u64 size, struct vmem_altmap *altmap,
bool want_memblock) bool want_memblock)
......
...@@ -188,13 +188,6 @@ void free_initmem(void) ...@@ -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. */ /* Allocate and free page tables. */
pgd_t *pgd_alloc(struct mm_struct *mm) pgd_t *pgd_alloc(struct mm_struct *mm)
......
...@@ -292,10 +292,3 @@ void free_initmem(void) ...@@ -292,10 +292,3 @@ void free_initmem(void)
{ {
free_initmem_default(-1); 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
...@@ -527,6 +527,11 @@ extern unsigned long __initramfs_size; ...@@ -527,6 +527,11 @@ extern unsigned long __initramfs_size;
#include <linux/initrd.h> #include <linux/initrd.h>
#include <linux/kexec.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 #ifdef CONFIG_KEXEC_CORE
static bool kexec_free_initrd(void) static bool kexec_free_initrd(void)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment