lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAhV-H7iOuEEDZNHveirZA9pAH1Ax1+nRo=_miqhyzDSzzCWtw@mail.gmail.com>
Date: Tue, 14 May 2024 15:45:30 +0800
From: Huacai Chen <chenhuacai@...nel.org>
To: Tiezhu Yang <yangtiezhu@...ngson.cn>
Cc: rafael@...nel.org, loongarch@...ts.linux.dev, linux-acpi@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH] LoongArch: Remove ACPI related ifdefs in platform_init()

Hi, Tiezhu,

On Tue, May 14, 2024 at 3:39 PM Tiezhu Yang <yangtiezhu@...ngson.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. 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
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
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ