From patchwork Thu Dec 14 12:16:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rini X-Patchwork-Id: 1876170 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.a=rsa-sha256 header.s=google header.b=MFtNDmdA; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SrWYx5XSmz20LT for ; Thu, 14 Dec 2023 23:17:09 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 39E85878DB; Thu, 14 Dec 2023 13:17:05 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="MFtNDmdA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7C75187630; Thu, 14 Dec 2023 13:17:03 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-yw1-x1129.google.com (mail-yw1-x1129.google.com [IPv6:2607:f8b0:4864:20::1129]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id F0BA187980 for ; Thu, 14 Dec 2023 13:16:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-yw1-x1129.google.com with SMTP id 00721157ae682-5e36848f6c6so7560507b3.1 for ; Thu, 14 Dec 2023 04:16:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; t=1702556216; x=1703161016; darn=lists.denx.de; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=UEsp4i3qJzR4uyVVY5DUZ2T+IUOMKzY+vKPxgSyS0cg=; b=MFtNDmdAboWwi+imukKlttrUlRlzrCJuN6QsM5k73fjG3XEkWUca3vE/6JUfbbNWSw /k8j4BCN1iqALmEKaoXemt5rD+S61QYBbabZFXTuZIdLrbNdZil6kAD25pxI99b0aUTa B4vRwBjjCea4K6wtqxyv8BUKVqf/DTB9IR9go= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702556216; x=1703161016; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=UEsp4i3qJzR4uyVVY5DUZ2T+IUOMKzY+vKPxgSyS0cg=; b=CAcPNeYMm5a8Dkf/1cZVoC5A7LSeKfdu4LtPRC5tQH1eMDN4HqzZkX4rnuktu9JnrK Hr3w8qXwu5uYFiOhAXghp+pim4WoGpe5B4xuYd414blPR0MwBgw3LYhCl4uxNHrffHEL fX45d1t+Jlmmol+Mtww8JiHHp++rTZLpLLG+wCKPuifUL1QE+9NIHnJwCbj4FX5YP6oW hzQG3Duk/+s+Z7+AuSH5or4Y70Z9OSZ3dazhLx9pgYNtpP6Df2/9RROhldmojIjlTU28 +WfePO6GKDMQtmvNJMWiCf0lMdeslrYdYw5sqDhy908RHoHopZMHk9HUNdGDPLePJWxL osig== X-Gm-Message-State: AOJu0Yy/bAxzPNBgSNiQUkTg9jmPabi4Jy19l5pp/YV7oxgsAdrzQEGR 0VOEo7IJfPI7LCebJb1X0ZcNHNvmqFVFHRc7mXc= X-Google-Smtp-Source: AGHT+IFQuJwaQNhDfrW36modJEM95p3kUyqzyj7VOSMwtlK1Mevvgc+uKqwqdmAhdAPbioS713HsfA== X-Received: by 2002:a0d:e803:0:b0:5e3:561:3243 with SMTP id r3-20020a0de803000000b005e305613243mr2106606ywe.89.1702556216405; Thu, 14 Dec 2023 04:16:56 -0800 (PST) Received: from bill-the-cat.lan (2603-6081-7b00-6400-ef43-b142-0a3d-20b7.res6.spectrum.com. [2603:6081:7b00:6400:ef43:b142:a3d:20b7]) by smtp.gmail.com with ESMTPSA id b80-20020a0dd953000000b005e2ca09e751sm1277447ywe.110.2023.12.14.04.16.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 04:16:55 -0800 (PST) From: Tom Rini To: u-boot@lists.denx.de Cc: Simon Glass Subject: [PATCH] global: Restrict use of '#include ' Date: Thu, 14 Dec 2023 07:16:54 -0500 Message-Id: <20231214121654.3042335-1-trini@konsulko.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean In general terms, we -include include/linux/kconfig.h and so normal U-Boot code does not need to also #include it. However, for code which is shared with userspace we may need to add it so that either our full config is available or so that macros such as CONFIG_IS_ENABLED() can be evaluated. In this case make sure that we guard these includes with a test for USE_HOSTCC so that it clear as to why we're doing this. Signed-off-by: Tom Rini Reviewed-by: Simon Glass --- Cc: Simon Glass --- arch/arm/include/asm/arch-fsl-layerscape/config.h | 1 - arch/arm/mach-rockchip/tpl.c | 1 - arch/arm/mach-sunxi/dram_sun50i_h6.c | 1 - arch/arm/mach-sunxi/dram_sun50i_h616.c | 1 - arch/arm/mach-sunxi/dram_sunxi_dw.c | 1 - boot/image-fit.c | 2 +- boot/image.c | 2 +- drivers/timer/dw-apb-timer.c | 1 - env/embedded.c | 2 ++ include/bootstage.h | 2 ++ include/configs/at91-sama5_common.h | 2 -- include/configs/tqma6.h | 1 - include/env_internal.h | 1 - include/u-boot/ecdsa.h | 1 - lib/rsa/rsa-verify.c | 2 +- test/dm/scmi.c | 1 - tools/mkeficapsule.c | 1 - 17 files changed, 7 insertions(+), 16 deletions(-) diff --git a/arch/arm/include/asm/arch-fsl-layerscape/config.h b/arch/arm/include/asm/arch-fsl-layerscape/config.h index 516c9eab0478..faace43da710 100644 --- a/arch/arm/include/asm/arch-fsl-layerscape/config.h +++ b/arch/arm/include/asm/arch-fsl-layerscape/config.h @@ -7,7 +7,6 @@ #ifndef _ASM_ARMV8_FSL_LAYERSCAPE_CONFIG_H_ #define _ASM_ARMV8_FSL_LAYERSCAPE_CONFIG_H_ -#include #include #ifndef __ASSEMBLY__ diff --git a/arch/arm/mach-rockchip/tpl.c b/arch/arm/mach-rockchip/tpl.c index fdd0c592b3eb..2c3e9789cc89 100644 --- a/arch/arm/mach-rockchip/tpl.c +++ b/arch/arm/mach-rockchip/tpl.c @@ -16,7 +16,6 @@ #include #include #include -#include #if CONFIG_IS_ENABLED(BANNER_PRINT) #include diff --git a/arch/arm/mach-sunxi/dram_sun50i_h6.c b/arch/arm/mach-sunxi/dram_sun50i_h6.c index bff2e42513cc..62bc2a0231e3 100644 --- a/arch/arm/mach-sunxi/dram_sun50i_h6.c +++ b/arch/arm/mach-sunxi/dram_sun50i_h6.c @@ -15,7 +15,6 @@ #include #include #include -#include /* * The DRAM controller structure on H6 is similar to the ones on A23/A80: diff --git a/arch/arm/mach-sunxi/dram_sun50i_h616.c b/arch/arm/mach-sunxi/dram_sun50i_h616.c index c5c1331a4c3c..e62d5711d0f6 100644 --- a/arch/arm/mach-sunxi/dram_sun50i_h616.c +++ b/arch/arm/mach-sunxi/dram_sun50i_h616.c @@ -22,7 +22,6 @@ #include #include #include -#include enum { MBUS_QOS_LOWEST = 0, diff --git a/arch/arm/mach-sunxi/dram_sunxi_dw.c b/arch/arm/mach-sunxi/dram_sunxi_dw.c index 9382d3d0be89..daef051d0c8e 100644 --- a/arch/arm/mach-sunxi/dram_sunxi_dw.c +++ b/arch/arm/mach-sunxi/dram_sunxi_dw.c @@ -16,7 +16,6 @@ #include #include #include -#include static void mctl_phy_init(u32 val) { diff --git a/boot/image-fit.c b/boot/image-fit.c index 3cc556b727f5..89e377563ce6 100644 --- a/boot/image-fit.c +++ b/boot/image-fit.c @@ -15,6 +15,7 @@ #include #include #include +#include #else #include #include @@ -36,7 +37,6 @@ DECLARE_GLOBAL_DATA_PTR; #include #include #include -#include #include #include #include diff --git a/boot/image.c b/boot/image.c index 88b67bc3a199..fed5dda2025d 100644 --- a/boot/image.c +++ b/boot/image.c @@ -42,6 +42,7 @@ DECLARE_GLOBAL_DATA_PTR; #else /* USE_HOSTCC */ #include "mkimage.h" +#include #include #include @@ -62,7 +63,6 @@ DECLARE_GLOBAL_DATA_PTR; #include #include #include -#include #include #include #include diff --git a/drivers/timer/dw-apb-timer.c b/drivers/timer/dw-apb-timer.c index b171232c4844..6cd25251f945 100644 --- a/drivers/timer/dw-apb-timer.c +++ b/drivers/timer/dw-apb-timer.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include diff --git a/env/embedded.c b/env/embedded.c index 7cbe54c56e00..5b488ef818e8 100644 --- a/env/embedded.c +++ b/env/embedded.c @@ -4,7 +4,9 @@ * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com. */ +#ifdef USE_HOSTCC #include +#endif #ifndef __ASSEMBLY__ #define __ASSEMBLY__ /* Dirty trick to get only #defines */ diff --git a/include/bootstage.h b/include/bootstage.h index 59a76d0f0c40..f4e77b09d747 100644 --- a/include/bootstage.h +++ b/include/bootstage.h @@ -12,7 +12,9 @@ #define _BOOTSTAGE_H #include +#ifdef USE_HOSTCC #include +#endif /* Flags for each bootstage record */ enum bootstage_flags { diff --git a/include/configs/at91-sama5_common.h b/include/configs/at91-sama5_common.h index 4aa876a9f79d..81c76ef52a72 100644 --- a/include/configs/at91-sama5_common.h +++ b/include/configs/at91-sama5_common.h @@ -9,8 +9,6 @@ #ifndef __AT91_SAMA5_COMMON_H #define __AT91_SAMA5_COMMON_H -#include - /* ARM asynchronous clock */ #define CFG_SYS_AT91_SLOW_CLOCK 32768 #define CFG_SYS_AT91_MAIN_CLOCK 12000000 /* from 12 MHz crystal */ diff --git a/include/configs/tqma6.h b/include/configs/tqma6.h index 8c75a75a9e59..2da76f154313 100644 --- a/include/configs/tqma6.h +++ b/include/configs/tqma6.h @@ -8,7 +8,6 @@ #ifndef __CONFIG_H #define __CONFIG_H -#include #include /* place code in last 4 MiB of RAM */ diff --git a/include/env_internal.h b/include/env_internal.h index 5c289d67f90c..cbd1ef3e9141 100644 --- a/include/env_internal.h +++ b/include/env_internal.h @@ -15,7 +15,6 @@ #ifndef _ENV_INTERNAL_H_ #define _ENV_INTERNAL_H_ -#include /************************************************************************** * diff --git a/include/u-boot/ecdsa.h b/include/u-boot/ecdsa.h index 6e0269e3aed6..53490c6b287f 100644 --- a/include/u-boot/ecdsa.h +++ b/include/u-boot/ecdsa.h @@ -8,7 +8,6 @@ #include #include -#include /** * crypto_algo API impementation for ECDSA; diff --git a/lib/rsa/rsa-verify.c b/lib/rsa/rsa-verify.c index 2f3b34403913..096e7f6d178e 100644 --- a/lib/rsa/rsa-verify.c +++ b/lib/rsa/rsa-verify.c @@ -17,9 +17,9 @@ #else #include "fdt_host.h" #include "mkimage.h" +#include #include #endif -#include #include #include diff --git a/test/dm/scmi.c b/test/dm/scmi.c index e80667ef72a3..adf36ffaab1d 100644 --- a/test/dm/scmi.c +++ b/test/dm/scmi.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include diff --git a/tools/mkeficapsule.c b/tools/mkeficapsule.c index b8fc6069b584..6a261ff549dc 100644 --- a/tools/mkeficapsule.c +++ b/tools/mkeficapsule.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include