Skip to content

Commit

Permalink
initramfs: provide a generic free_initrd_mem implementation
Browse files Browse the repository at this point in the history
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/[email protected]
Signed-off-by: Christoph Hellwig <[email protected]>
Acked-by: Geert Uytterhoeven <[email protected]>	[m68k]
Acked-by: Mike Rapoport <[email protected]>
Cc: Catalin Marinas <[email protected]>	[arm64]
Cc: Steven Price <[email protected]>
Cc: Alexander Viro <[email protected]>
Cc: Guan Xuetao <[email protected]>
Cc: Russell King <[email protected]>
Cc: Will Deacon <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Christoph Hellwig authored and torvalds committed May 14, 2019
1 parent d8ae8a3 commit 4afd58e
Show file tree
Hide file tree
Showing 15 changed files with 5 additions and 100 deletions.
8 changes: 0 additions & 8 deletions arch/alpha/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 0 additions & 7 deletions arch/arc/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 0 additions & 7 deletions arch/c6x/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 0 additions & 8 deletions arch/h8300/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
7 changes: 0 additions & 7 deletions arch/m68k/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 0 additions & 7 deletions arch/microblaze/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 0 additions & 7 deletions arch/nds32/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
7 changes: 0 additions & 7 deletions arch/nios2/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 0 additions & 7 deletions arch/openrisc/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 0 additions & 7 deletions arch/parisc/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 0 additions & 7 deletions arch/powerpc/mm/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 0 additions & 7 deletions arch/sh/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 0 additions & 7 deletions arch/um/kernel/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 0 additions & 7 deletions arch/unicore32/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions init/initramfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 4afd58e

Please sign in to comment.