Re: [PATCH] global: Restrict use of '#include '

2023-12-21 Thread Tom Rini
On Thu, 14 Dec 2023 07:16:54 -0500, Tom Rini wrote:

> 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.
> 
> [...]

Applied to u-boot/next, thanks!

-- 
Tom




Re: [PATCH] global: Restrict use of '#include '

2023-12-16 Thread Simon Glass
On Thu, 14 Dec 2023 at 05:16, Tom Rini  wrote:
>
> 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 
> ---
> 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(-)
>

Reviewed-by: Simon Glass 


[PATCH] global: Restrict use of '#include '

2023-12-14 Thread Tom Rini
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 
---
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, ethei...@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
---