From: Sam Edwards <cfsworks@gmail.com>
To: Dave Jiang <dave.jiang@intel.com>,
linus.walleij@linaro.org, rafael@kernel.org
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
lenb@kernel.org, robert.moore@intel.com,
Jonathan.Cameron@huawei.com, dan.j.williams@intel.com,
guohanjun@huawei.com, arnd@arndb.de, linux-acpi@vger.kernel.org,
acpica-devel@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] acpi: Fix ARM32 platforms compile issue introduced by fw_table changes
Date: Tue, 21 Nov 2023 13:49:54 -0800 [thread overview]
Message-ID: <7e4038d8-ef60-f943-a7ba-db59ce9a2aa7@gmail.com> (raw)
In-Reply-To: <170058229266.2356592.11579977558324549374.stgit@djiang5-mobl3>
On 11/21/23 07:58, Dave Jiang wrote:
> Linus reported that:
> After commit a103f46633fd the kernel stopped compiling for
> several ARM32 platforms that I am building with a bare metal
> compiler. Bare metal compilers (arm-none-eabi-) don't
> define __linux__.
>
> This is because the header <acpi/platform/acenv.h> is now
> in the include path for <linux/irq.h>:
>
> CC arch/arm/kernel/irq.o
> CC kernel/sysctl.o
> CC crypto/api.o
> In file included from ../include/acpi/acpi.h:22,
> from ../include/linux/fw_table.h:29,
> from ../include/linux/acpi.h:18,
> from ../include/linux/irqchip.h:14,
> from ../arch/arm/kernel/irq.c:25:
> ../include/acpi/platform/acenv.h:218:2: error: #error Unknown target environment
> 218 | #error Unknown target environment
> | ^~~~~
>
> The issue is caused by the introducing of splitting out the ACPI code to
> support the new generic fw_table code.
>
> Rafael suggested moving the fw_table.h include in linux/acpi.h to below
> the asm/acpi.h. The move also helped with eliminating the inclusion of
> acpi/acpi.h in fw_table.h. The unfortunate circular inclusion of
> linux/acpi.h is needed for fw_table.h due fw_table code needing the
> defined acpi structs in order to build.
>
> Fixes: a103f46633fd ("acpi: Move common tables helper functions to common lib")
> Reported-by: Linus Walleij <linus.walleij@linaro.org>
> Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> ---
> include/linux/acpi.h | 23 ++++++++++++-----------
> include/linux/fw_table.h | 1 -
> 2 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index 54189e0e5f41..2789beb26138 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -15,7 +15,6 @@
> #include <linux/mod_devicetable.h>
> #include <linux/property.h>
> #include <linux/uuid.h>
> -#include <linux/fw_table.h>
>
> struct irq_domain;
> struct irq_domain_ops;
> @@ -25,16 +24,6 @@ struct irq_domain_ops;
> #endif
> #include <acpi/acpi.h>
>
> -#ifdef CONFIG_ACPI_TABLE_LIB
> -#define EXPORT_SYMBOL_ACPI_LIB(x) EXPORT_SYMBOL_NS_GPL(x, ACPI)
> -#define __init_or_acpilib
> -#define __initdata_or_acpilib
> -#else
> -#define EXPORT_SYMBOL_ACPI_LIB(x)
> -#define __init_or_acpilib __init
> -#define __initdata_or_acpilib __initdata
> -#endif
> -
> #ifdef CONFIG_ACPI
>
> #include <linux/list.h>
> @@ -48,6 +37,18 @@ struct irq_domain_ops;
> #include <acpi/acpi_io.h>
> #include <asm/acpi.h>
>
> +#include <linux/fw_table.h>
> +
> +#ifdef CONFIG_ACPI_TABLE_LIB
> +#define EXPORT_SYMBOL_ACPI_LIB(x) EXPORT_SYMBOL_NS_GPL(x, ACPI)
> +#define __init_or_acpilib
> +#define __initdata_or_acpilib
> +#else
> +#define EXPORT_SYMBOL_ACPI_LIB(x)
> +#define __init_or_acpilib __init
> +#define __initdata_or_acpilib __initdata
> +#endif
> +
> static inline acpi_handle acpi_device_handle(struct acpi_device *adev)
> {
> return adev ? adev->handle : NULL;
> diff --git a/include/linux/fw_table.h b/include/linux/fw_table.h
> index ff8fa58d5818..a722300c215b 100644
> --- a/include/linux/fw_table.h
> +++ b/include/linux/fw_table.h
> @@ -26,7 +26,6 @@ struct acpi_subtable_proc {
> };
>
> #include <linux/acpi.h>
> -#include <acpi/acpi.h>
Hi Dave,
Seems to me that the #include <linux/acpi.h> should go too, to break the
circular including cycle. If it remains, I fear that there could be
subtle problems in the future depending on which header is included
first in a compilation unit. It sounds now like the only correct way to
get fw_table.h included is transitively via linux/acpi.h (of note:
lib/fw_table.c will have to be updated; it's the only file that
currently breaks this rule) so that removal will just help enforce this.
Plus, includes in the middle of non-preprocessor declarations are a
(sometimes necessary, definitely not here) code smell, in my view.
If this include must remain for some reason, perhaps a comment should be
added to call attention to the circular situation and provide justification?
Cheers,
Sam
>
> union acpi_subtable_headers {
> struct acpi_subtable_header common;
>
>
>
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-11-21 21:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-21 15:58 [PATCH] acpi: Fix ARM32 platforms compile issue introduced by fw_table changes Dave Jiang
2023-11-21 21:49 ` Sam Edwards [this message]
2023-11-21 22:11 ` Dave Jiang
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=7e4038d8-ef60-f943-a7ba-db59ce9a2aa7@gmail.com \
--to=cfsworks@gmail.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=acpica-devel@lists.linux.dev \
--cc=arnd@arndb.de \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=guohanjun@huawei.com \
--cc=lenb@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=rafael@kernel.org \
--cc=robert.moore@intel.com \
/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