loongarch.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Huacai Chen <chenhuacai@kernel.org>
To: Tiezhu Yang <yangtiezhu@loongson.cn>
Cc: rafael@kernel.org, loongarch@lists.linux.dev,
	linux-acpi@vger.kernel.org,  linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] LoongArch: Remove ACPI related ifdefs in platform_init()
Date: Tue, 14 May 2024 15:45:30 +0800	[thread overview]
Message-ID: <CAAhV-H7iOuEEDZNHveirZA9pAH1Ax1+nRo=_miqhyzDSzzCWtw@mail.gmail.com> (raw)
In-Reply-To: <20240514073910.27048-1-yangtiezhu@loongson.cn>

Hi, Tiezhu,

On Tue, May 14, 2024 at 3:39 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. 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@loongson.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
>

      reply	other threads:[~2024-05-14  7:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-14  7:39 [RFC PATCH] LoongArch: Remove ACPI related ifdefs in platform_init() Tiezhu Yang
2024-05-14  7:45 ` Huacai Chen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAhV-H7iOuEEDZNHveirZA9pAH1Ax1+nRo=_miqhyzDSzzCWtw@mail.gmail.com' \
    --to=chenhuacai@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=rafael@kernel.org \
    --cc=yangtiezhu@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).