[PATCH v1] LoongArch: Remove CONFIG_ACPI_TABLE_UPGRADE in platform_init()

Tiezhu Yang posted 1 patch 1 year, 6 months ago
arch/loongarch/kernel/setup.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
[PATCH v1] LoongArch: Remove CONFIG_ACPI_TABLE_UPGRADE in platform_init()
Posted by Tiezhu Yang 1 year, 6 months ago
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.

As Huacai suggested, CONFIG_ACPI_TABLE_UPGRADE is ugly and not
necessary here, just remove it. At the same time, just keep
CONFIG_ACPI to prevent build error and give a signal to tell
us the code is ACPI-specific, and also put acpi_table_upgrade()
under CONFIG_ACPI.

  #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@loongson.cn>
---
 arch/loongarch/kernel/setup.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c
index ea6d5db6c878..08a077e4efd7 100644
--- a/arch/loongarch/kernel/setup.c
+++ b/arch/loongarch/kernel/setup.c
@@ -353,10 +353,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
-- 
2.42.0
Re: [PATCH v1] LoongArch: Remove CONFIG_ACPI_TABLE_UPGRADE in platform_init()
Posted by Huacai Chen 1 year, 6 months ago
Applied, thank you.

Huacai

On Wed, May 29, 2024 at 2:32 PM Tiezhu Yang <yangtiezhu@loongson.cn> 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.
>
> As Huacai suggested, CONFIG_ACPI_TABLE_UPGRADE is ugly and not
> necessary here, just remove it. At the same time, just keep
> CONFIG_ACPI to prevent build error and give a signal to tell
> us the code is ACPI-specific, and also put acpi_table_upgrade()
> under CONFIG_ACPI.
>
>   #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@loongson.cn>
> ---
>  arch/loongarch/kernel/setup.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c
> index ea6d5db6c878..08a077e4efd7 100644
> --- a/arch/loongarch/kernel/setup.c
> +++ b/arch/loongarch/kernel/setup.c
> @@ -353,10 +353,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
> --
> 2.42.0
>