From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2F696C61D85 for ; Tue, 21 Nov 2023 21:50:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=t6qRs06s2w4W/8g778dXVmhq0+jY1MXa42KYAkdQrfo=; b=dlt7TlGP6zhbaC 1gGy0DBLPJqRIjbJcq3rTMqdeTUUZKr+gD/sLy/BkYrFhRX0mlUZajxGO3LTTM0nij/GQOPDHc5HW OedoF2VWAr8SsmNY4vD0gPpoyX64vAk27xjCyObYJ8Zgm3UpW3LoZJKSarYy8iYgPqEqOqSQWmW32 oSPncH04du07Qv+JbCNUWIhOsFWRvWPRmc1mM+d9UM+o6L5HDwykxbMJU5A69O5GKxqMppfwVbRcx ZSzlQki/3VrgoDN4e3FBM316VFjT/eO4Aq4ErQf64Y34tgootey87hiNeszAt9cz9mgAU2x5lxfVa XaKjROUEFfyGCTtxve9Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5Yd9-0008WG-2Q; Tue, 21 Nov 2023 21:50:03 +0000 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5Yd6-0008V2-0f for linux-arm-kernel@lists.infradead.org; Tue, 21 Nov 2023 21:50:01 +0000 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-6cbb71c3020so157296b3a.1 for ; Tue, 21 Nov 2023 13:49:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700603397; x=1701208197; darn=lists.infradead.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=+Gtgz9FsdyKFDL5tR7CMd1m/DpQtkGweBHqoxGbzpzs=; b=AGFD9DiFDQbPJRuTu2ztc0iJ0ZPgQcjFp8TxPKhySOKcm1CkjEgq96SljxA9OfxWMx tr7IaluJ1XqBQeqbtyCZhSFYzyG2VMgdVuYwsqmx3r6o97i/TVKLwjhXjGtdR8gz2Qv1 aw0FVBSxiRfueuxeua65zTUvddsTX8ZCn7VPDRCGrdf6YCA2i13hvck3b2khgCzlOO7p i5FeYklWul38bJFEKm5rQHYwa8XHmtPVtBu142t7z3HCG17xveXtxO8mmqAhiV/a5SD1 OFUws73Z1pruA605b8hYQ/aG6AxmYdmqkBp7u+Vs52aGuSGiH3mycq8ocXdXVFtayUQi iCwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700603397; x=1701208197; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+Gtgz9FsdyKFDL5tR7CMd1m/DpQtkGweBHqoxGbzpzs=; b=w72a5iu59BwJP68P3eTFOLRb4pC99SGcNlqzd/YBhxph6yrBP5Z8StezahzUdspZn8 jVF4iA7GfHfst/7JXOoD9XONsHo5GZW+dyc3U2872DEbOp9zv1XxltlfPB2DCH1fEvji pOjbqXXtqIJV1EUOl8jMX9rlDogD0eWqVrsMVzhMQ9/b0L3wosUbyi4Cai6CkAM/xO0g EHLFfGVRKCYM50yGgWAPtyJG6WMGrYK767Rj9LI+7fpzGwThqLHefsOfjExTIJH5srk0 ndoji2ED1+F4Z+ZlW7Eygj6rtesOfvTbDnh6RQcaC8+imPhNKnDa0WsQ9jkYWpYSrvKF bNWw== X-Gm-Message-State: AOJu0YxdCegIo4wzSDJJiSsBg0BaegpAL8cuKFyeWGWLBnMxGBNYesYn mrMMQ/cc4T1K2WliXmmeekk= X-Google-Smtp-Source: AGHT+IGvhU9AXpv6DkrhrnepHN3HLJircjSluq81o11W8qfsOoNA0iOUwKAD0D6E1evrcgiZsgbd7Q== X-Received: by 2002:a05:6a21:a59b:b0:187:962d:746b with SMTP id gd27-20020a056a21a59b00b00187962d746bmr1015699pzc.9.1700603397092; Tue, 21 Nov 2023 13:49:57 -0800 (PST) Received: from [10.64.107.252] (static-198-54-134-172.cust.tzulo.com. [198.54.134.172]) by smtp.gmail.com with ESMTPSA id 9-20020a630b09000000b005b92d3cb4c2sm8385412pgl.58.2023.11.21.13.49.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 Nov 2023 13:49:56 -0800 (PST) Message-ID: <7e4038d8-ef60-f943-a7ba-db59ce9a2aa7@gmail.com> Date: Tue, 21 Nov 2023 13:49:54 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH] acpi: Fix ARM32 platforms compile issue introduced by fw_table changes Content-Language: en-US To: Dave Jiang , linus.walleij@linaro.org, rafael@kernel.org Cc: "Rafael J. Wysocki" , 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 References: <170058229266.2356592.11579977558324549374.stgit@djiang5-mobl3> From: Sam Edwards In-Reply-To: <170058229266.2356592.11579977558324549374.stgit@djiang5-mobl3> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231121_135000_245721_449A5662 X-CRM114-Status: GOOD ( 26.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 is now > in the include path for : > > 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 > Suggested-by: Rafael J. Wysocki > Signed-off-by: Dave Jiang > --- > 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 > #include > #include > -#include > > struct irq_domain; > struct irq_domain_ops; > @@ -25,16 +24,6 @@ struct irq_domain_ops; > #endif > #include > > -#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 > @@ -48,6 +37,18 @@ struct irq_domain_ops; > #include > #include > > +#include > + > +#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 > -#include Hi Dave, Seems to me that the #include 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