[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240514073910.27048-1-yangtiezhu@loongson.cn>
Date: Tue, 14 May 2024 15:39:10 +0800
From: Tiezhu Yang <yangtiezhu@...ngson.cn>
To: Huacai Chen <chenhuacai@...nel.org>,
rafael@...nel.org
Cc: loongarch@...ts.linux.dev,
linux-acpi@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [RFC PATCH] LoongArch: Remove ACPI related ifdefs in platform_init()
acpi_table_upgrade() and acpi_boot_table_init() are defined as
empty function under !CONFIG_ACPI_TABLE_UPGRADE and !CONFIG_ACPI
in include/linux/acpi.h, there are no implicit declaration errors
with various configs. Furthermore, CONFIG_ACPI is always set due
to config ACPI is selected by config LOONGARCH. Thus, just remove
ACPI related ifdefs to call the functions directly.
#ifdef CONFIG_ACPI_TABLE_UPGRADE
void acpi_table_upgrade(void);
#else
static inline void acpi_table_upgrade(void) { }
#endif
#ifdef CONFIG_ACPI
...
void acpi_boot_table_init (void);
...
#else /* !CONFIG_ACPI */
...
static inline void acpi_boot_table_init(void)
{
}
...
#endif /* !CONFIG_ACPI */
Signed-off-by: Tiezhu Yang <yangtiezhu@...ngson.cn>
---
Another way is to guard the related code under CONFIG_ACPI,
but I think it is not necessary, like this:
@@ -351,10 +351,8 @@ void __init platform_init(void)
arch_reserve_vmcore();
arch_reserve_crashkernel();
-#ifdef CONFIG_ACPI_TABLE_UPGRADE
- acpi_table_upgrade();
-#endif
#ifdef CONFIG_ACPI
+ acpi_table_upgrade();
acpi_gbl_use_default_register_widths = false;
acpi_boot_table_init();
#endif
arch/loongarch/kernel/setup.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c
index 60e0fe97f61a..da96f871cf73 100644
--- a/arch/loongarch/kernel/setup.c
+++ b/arch/loongarch/kernel/setup.c
@@ -351,13 +351,9 @@ void __init platform_init(void)
arch_reserve_vmcore();
arch_reserve_crashkernel();
-#ifdef CONFIG_ACPI_TABLE_UPGRADE
acpi_table_upgrade();
-#endif
-#ifdef CONFIG_ACPI
acpi_gbl_use_default_register_widths = false;
acpi_boot_table_init();
-#endif
early_init_fdt_scan_reserved_mem();
unflatten_and_copy_device_tree();
--
2.42.0
Powered by blists - more mailing lists