Hi, Tiezhu, On Tue, May 14, 2024 at 3:39 PM Tiezhu Yang <yangtiezhu@xxxxxxxxxxx> wrote: > > 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@xxxxxxxxxxx> > --- > > 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 I agree to remove CONFIG_ACPI_TABLE_UPGRADE since it is ugly and unnecessary here. But I prefer to keep CONFIG_ACPI (in addition, put acpi_table_upgrade() after CONFIG_ACPI). Because CONFIG_ACPI is not just to prevent build error, but also a signal to tell us the code is ACPI-specific. Huacai > > 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 >