[PATCH RESEND 40/62] init: rename free_initrd_mem to free_initramfs_mem

Askar Safin
2025-09-14T03:51:46Z

This is cleanup after initrd removal

Signed-off-by: Askar Safin <safinaskar@gmail.com>
---
arch/arm/mm/init.c | 2 +-
arch/x86/mm/init.c | 2 +-
include/linux/initrd.h | 2 +-
init/initramfs.c | 10 +++++-----
4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 4faeec51c522..290e9f9874c9 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -437,7 +437,7 @@ void free_initmem(void)
}

#ifdef CONFIG_BLK_DEV_INITRD
-void free_initrd_mem(unsigned long start, unsigned long end)
+void free_initramfs_mem(unsigned long start, unsigned long end)
{
if (start == virt_external_initramfs_start)
start = round_down(start, PAGE_SIZE);
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index bb57e93b4caf..c7ca996fb430 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -981,7 +981,7 @@ void __ref free_initmem(void)
}

#ifdef CONFIG_BLK_DEV_INITRD
-void __init free_initrd_mem(unsigned long start, unsigned long end)
+void __init free_initramfs_mem(unsigned long start, unsigned long end)
{
/*
* end could be not aligned, and We can not align that,
diff --git a/include/linux/initrd.h b/include/linux/initrd.h
index 55239701c4e0..b2a0128c3438 100644
--- a/include/linux/initrd.h
+++ b/include/linux/initrd.h
@@ -7,7 +7,7 @@
extern int initramfs_below_start_ok;

extern unsigned long virt_external_initramfs_start, virt_external_initramfs_end;
-extern void free_initrd_mem(unsigned long, unsigned long);
+extern void free_initramfs_mem(unsigned long, unsigned long);

#ifdef CONFIG_BLK_DEV_INITRD
extern void __init reserve_initrd_mem(void);
diff --git a/init/initramfs.c b/init/initramfs.c
index 8ed352721a79..7a050e54ff1a 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -642,7 +642,7 @@ void __init reserve_initrd_mem(void)
if (!phys_external_initramfs_size)
return;
/*
- * Round the memory region to page boundaries as per free_initrd_mem()
+ * Round the memory region to page boundaries as per free_initramfs_mem()
* This allows us to detect whether the pages overlapping the initrd
* are in use, but more importantly, reserves the entire set of pages
* as we don't want these pages allocated for other purposes.
@@ -676,7 +676,7 @@ void __init reserve_initrd_mem(void)
virt_external_initramfs_end = 0;
}

-void __weak __init free_initrd_mem(unsigned long start, unsigned long end)
+void __weak __init free_initramfs_mem(unsigned long start, unsigned long end)
{
#ifdef CONFIG_ARCH_KEEP_MEMBLOCK
unsigned long aligned_start = ALIGN_DOWN(start, PAGE_SIZE);
@@ -707,9 +707,9 @@ static bool __init kexec_free_initrd(void)
*/
memset((void *)virt_external_initramfs_start, 0, virt_external_initramfs_end - virt_external_initramfs_start);
if (virt_external_initramfs_start < crashk_start)
- free_initrd_mem(virt_external_initramfs_start, crashk_start);
+ free_initramfs_mem(virt_external_initramfs_start, crashk_start);
if (virt_external_initramfs_end > crashk_end)
- free_initrd_mem(crashk_end, virt_external_initramfs_end);
+ free_initramfs_mem(crashk_end, virt_external_initramfs_end);
return true;
}
#else
@@ -744,7 +744,7 @@ static void __init do_populate_rootfs(void *unused, async_cookie_t cookie)
* free only memory that is not part of crashkernel region.
*/
if (!do_retain_initrd && virt_external_initramfs_start && !kexec_free_initrd()) {
- free_initrd_mem(virt_external_initramfs_start, virt_external_initramfs_end);
+ free_initramfs_mem(virt_external_initramfs_start, virt_external_initramfs_end);
} else if (do_retain_initrd && virt_external_initramfs_start) {
bin_attr_initrd.size = virt_external_initramfs_end - virt_external_initramfs_start;
bin_attr_initrd.private = (void *)virt_external_initramfs_start;
--
2.47.2