Skip to contentSkip to conversation

Start removing <env.h> from headers when not required

PATCH In review Tom Rini 7 participants 38 messages May 14, 2025 – May 29, 2025

Subsystems (14)
lore
Share & tools
lore

Tom Rini

author
#0 lore raw

cover Start removing <env.h> from headers when not required

Hey all,

Given Simon's series at [1] I started looking in to what brings in <env.h> when not strictly required and in turn has some unintended implicit includes. This series takes care of the places where, commonly, <linux/string.h> or <env.h> itself were required along with a few other less common cases. This sets aside for the moment what to do about net-common.h and env_get_ip() as I'm not entirely sure what's best there.

[1]: https://patchwork.ozlabs.org/project/uboot/list/?series=454939&state=*

Signature · 1 line
Tom
author
#1 lore raw

PATCH 1/5 global: Add <linux/string.h> instead of long indirect include path

In a number of cases we have C files which rely on a chain of indirect include paths to get <linux/string.h> to be included via <command.h>. To facilitate cleaning up <command.h> make this code directly include <linux/string.h>.

---
Cc: Andrew Davis <[email protected]>
Cc: Bin Meng <[email protected]>
Cc: Dai Okamura <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Francesco Dolcini <[email protected]>
Cc: Ilias Apalodimas <[email protected]>
Cc: Jens Wiklander <[email protected]>
Cc: Kunihiko Hayashi <[email protected]>
Cc: Mingkai Hu <[email protected]>
Cc: Priyanka Jain <[email protected]>
Cc: Shengzhou Liu <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Svyatoslav Ryhel <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: William Zhang <[email protected]>

---
 arch/arm/mach-imx/mx5/clock.c             | 1 +
 arch/arm/mach-keystone/cmd_clock.c        | 1 +
 arch/arm/mach-tegra/tegra124/bct.c        | 1 +
 arch/arm/mach-tegra/tegra20/bct.c         | 1 +
 arch/arm/mach-tegra/tegra30/bct.c         | 1 +
 arch/arm/mach-uniphier/dram/cmd_ddrmphy.c | 1 +
 arch/arm/mach-uniphier/dram/cmd_ddrphy.c  | 1 +
 board/freescale/common/qixis.c            | 1 +
 board/freescale/ls1043ardb/cpld.c         | 1 +
 board/freescale/ls1046ardb/cpld.c         | 1 +
 board/freescale/p2041rdb/cpld.c           | 1 +
 board/freescale/t102xrdb/cpld.c           | 1 +
 board/freescale/t104xrdb/cpld.c           | 1 +
 board/freescale/t208xrdb/cpld.c           | 1 +
 board/freescale/t4rdb/cpld.c              | 1 +
 board/toradex/apalis_imx6/do_fuse.c       | 1 +
 board/toradex/colibri_imx6/do_fuse.c      | 1 +
 boot/image-pre-load.c                     | 1 +
 cmd/2048.c                                | 1 +
 cmd/armflash.c                            | 1 +
 cmd/bootstage.c                           | 1 +
 cmd/cache.c                               | 1 +
 cmd/diag.c                                | 1 +
 cmd/dm.c                                  | 1 +
 cmd/echo.c                                | 1 +
 cmd/flash.c                               | 1 +
 cmd/fuse.c                                | 1 +
 cmd/irq.c                                 | 1 +
 cmd/legacy_led.c                          | 1 +
 cmd/mp.c                                  | 1 +
 cmd/optee.c                               | 1 +
 cmd/sha1sum.c                             | 1 +
 cmd/sleep.c                               | 1 +
 cmd/smccc.c                               | 1 +
 cmd/stackprot_test.c                      | 1 +
 cmd/strings.c                             | 1 +
 cmd/test.c                                | 1 +
 cmd/timer.c                               | 1 +
 cmd/ufs.c                                 | 1 +
 cmd/x86/mtrr.c                            | 1 +
 drivers/tpm/sandbox_common.c              | 1 +
 41 files changed, 41 insertions(+)
arch/arm/mach-imx/mx5/clock.c +1 -0
index 41116e2c6a2c..9901f8a7b56f 100644
@@ -10,6 +10,7 @@
 #include <log.h>
 #include <asm/io.h>
 #include <linux/errno.h>
+#include <linux/string.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/crm_regs.h>
 #include <asm/arch/clock.h>
arch/arm/mach-keystone/cmd_clock.c +1 -0
index e9ecc05953a8..7b94a80b725e 100644
@@ -8,6 +8,7 @@
 
 #include <vsprintf.h>
 #include <command.h>
+#include <linux/string.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/psc_defs.h>
arch/arm/mach-tegra/tegra124/bct.c +1 -0
index a71aa87fce12..4dc4b7138ab8 100644
@@ -7,6 +7,7 @@
 #include <command.h>
 #include <log.h>
 #include <vsprintf.h>
+#include <linux/string.h>
 #include <asm/arch-tegra/crypto.h>
 #include "bct.h"
 #include "uboot_aes.h"
arch/arm/mach-tegra/tegra20/bct.c +1 -0
index b647b6b26d2a..253cb2436761 100644
@@ -7,6 +7,7 @@
 #include <command.h>
 #include <log.h>
 #include <vsprintf.h>
+#include <linux/string.h>
 #include <asm/arch-tegra/crypto.h>
 #include "bct.h"
 #include "uboot_aes.h"
arch/arm/mach-tegra/tegra30/bct.c +1 -0
index 250009ea8d8e..398ba1de3869 100644
@@ -7,6 +7,7 @@
 #include <command.h>
 #include <log.h>
 #include <vsprintf.h>
+#include <linux/string.h>
 #include <asm/arch-tegra/crypto.h>
 #include "bct.h"
 #include "uboot_aes.h"
arch/arm/mach-uniphier/dram/cmd_ddrmphy.c +1 -0
index 629f8b90c9d8..be4ce3265bb8 100644
@@ -9,6 +9,7 @@
 #include <linux/io.h>
 #include <linux/printk.h>
 #include <linux/sizes.h>
+#include <linux/string.h>
 
 #include "../soc-info.h"
 #include "ddrmphy-regs.h"
arch/arm/mach-uniphier/dram/cmd_ddrphy.c +1 -0
index ca519d1c7e0c..3ccafe206382 100644
@@ -10,6 +10,7 @@
 #include <linux/io.h>
 #include <linux/printk.h>
 #include <linux/sizes.h>
+#include <linux/string.h>
 
 #include "../soc-info.h"
 #include "ddrphy-regs.h"
board/freescale/common/qixis.c +1 -0
index 7815ba2dbce9..04cad48f033a 100644
@@ -12,6 +12,7 @@
 #include <asm/io.h>
 #include <linux/compiler.h>
 #include <linux/time.h>
+#include <linux/string.h>
 #include <i2c.h>
 #include "qixis.h"
 
board/freescale/ls1043ardb/cpld.c +1 -0
index bda2f3ac3a69..39b6c6449cf7 100644
@@ -7,6 +7,7 @@
 
 #include <config.h>
 #include <command.h>
+#include <linux/string.h>
 #include <asm/io.h>
 #include "cpld.h"
 
board/freescale/ls1046ardb/cpld.c +1 -0
index 7f8ca2e857fd..26a5962bd6ee 100644
@@ -7,6 +7,7 @@
 
 #include <config.h>
 #include <command.h>
+#include <linux/string.h>
 #include <asm/io.h>
 #include "cpld.h"
 
board/freescale/p2041rdb/cpld.c +1 -0
index 915a8b994d5c..2bba377d4d45 100644
@@ -12,6 +12,7 @@
  */
 
 #include <command.h>
+#include <linux/string.h>
 #include <asm/io.h>
 
 #include "cpld.h"
board/freescale/t102xrdb/cpld.c +1 -0
index cc933ccd5440..00ea9d8f5038 100644
@@ -9,6 +9,7 @@
 
 #include <config.h>
 #include <command.h>
+#include <linux/string.h>
 #include <asm/io.h>
 #include "cpld.h"
 
board/freescale/t104xrdb/cpld.c +1 -0
index c2d526ae15ac..038e40e2faef 100644
@@ -12,6 +12,7 @@
 
 #include <config.h>
 #include <command.h>
+#include <linux/string.h>
 #include <asm/io.h>
 
 #include "cpld.h"
board/freescale/t208xrdb/cpld.c +1 -0
index d2226af62786..838d88d977e5 100644
@@ -7,6 +7,7 @@
 
 #include <config.h>
 #include <command.h>
+#include <linux/string.h>
 #include <asm/io.h>
 #include "cpld.h"
 
board/freescale/t4rdb/cpld.c +1 -0
index f076350c1c55..258581eee960 100644
@@ -16,6 +16,7 @@
 
 #include <config.h>
 #include <command.h>
+#include <linux/string.h>
 #include <asm/io.h>
 
 #include "cpld.h"
board/toradex/apalis_imx6/do_fuse.c +1 -0
index 698b05bc5ad5..8721276bed83 100644
@@ -11,6 +11,7 @@
 #include <command.h>
 #include <console.h>
 #include <fuse.h>
+#include <linux/string.h>
 
 static int mfgr_fuse(void)
 {
board/toradex/colibri_imx6/do_fuse.c +1 -0
index 698b05bc5ad5..8721276bed83 100644
@@ -11,6 +11,7 @@
 #include <command.h>
 #include <console.h>
 #include <fuse.h>
+#include <linux/string.h>
 
 static int mfgr_fuse(void)
 {
boot/image-pre-load.c +1 -0
index adf3b341a203..2f851ebb28c2 100644
@@ -7,6 +7,7 @@
 #include "mkimage.h"
 #else
 #include <asm/global_data.h>
+#include <env.h>
 #include <mapmem.h>
 DECLARE_GLOBAL_DATA_PTR;
 #endif /* !USE_HOSTCC*/
cmd/2048.c +1 -0
index 42cd171b0e41..aa0f82721dc1 100644
@@ -8,6 +8,7 @@
 #include <rand.h>
 #include <vsprintf.h>
 #include <linux/delay.h>
+#include <linux/string.h>
 
 #define SIZE 4
 static uint score;
cmd/armflash.c +1 -0
index e292cf85c45d..83f616db4efb 100644
@@ -9,6 +9,7 @@
 #include <console.h>
 #include <flash.h>
 #include <vsprintf.h>
+#include <linux/string.h>
 #include <asm/io.h>
 
 #define MAX_REGIONS 4
cmd/bootstage.c +1 -0
index 8248c41ca826..5c6d5a3ab453 100644
@@ -6,6 +6,7 @@
 #include <bootstage.h>
 #include <command.h>
 #include <vsprintf.h>
+#include <linux/string.h>
 
 static int do_bootstage_report(struct cmd_tbl *cmdtp, int flag, int argc,
 			       char *const argv[])
cmd/cache.c +1 -0
index 3049f5c305f2..b7007877ab03 100644
@@ -10,6 +10,7 @@
 #include <command.h>
 #include <cpu_func.h>
 #include <linux/compiler.h>
+#include <linux/string.h>
 
 static int parse_argv(const char *);
 
cmd/diag.c +1 -0
index c6da5aae3fcd..4a88ab00a074 100644
@@ -9,6 +9,7 @@
  */
 #include <command.h>
 #include <post.h>
+#include <linux/string.h>
 
 int do_diag(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
cmd/dm.c +1 -0
index ec9cfd85376e..1f212c0f0309 100644
@@ -9,6 +9,7 @@
 #include <command.h>
 #include <dm/root.h>
 #include <dm/util.h>
+#include <linux/string.h>
 
 static int do_dm_dump_driver_compat(struct cmd_tbl *cmdtp, int flag, int argc,
 				    char * const argv[])
cmd/echo.c +1 -0
index 973213a03a66..d1346504cfb5 100644
@@ -5,6 +5,7 @@
  */
 
 #include <command.h>
+#include <linux/string.h>
 
 static int do_echo(struct cmd_tbl *cmdtp, int flag, int argc,
 		   char *const argv[])
cmd/flash.c +1 -0
index fd660ec477c9..76aa387ba596 100644
@@ -10,6 +10,7 @@
 #include <command.h>
 #include <log.h>
 #include <vsprintf.h>
+#include <linux/string.h>
 #include <u-boot/uuid.h>
 
 #if defined(CONFIG_CMD_MTDPARTS)
cmd/fuse.c +1 -0
index 6c42c0968093..e2206cdf0d54 100644
@@ -14,6 +14,7 @@
 #include <mapmem.h>
 #include <vsprintf.h>
 #include <linux/errno.h>
+#include <linux/string.h>
 
 static int confirm_prog(void)
 {
cmd/irq.c +1 -0
index da223b4b2cce..58483d04de82 100644
@@ -6,6 +6,7 @@
 #include <config.h>
 #include <command.h>
 #include <irq_func.h>
+#include <linux/string.h>
 
 static int do_interrupts(struct cmd_tbl *cmdtp, int flag, int argc,
 			 char *const argv[])
cmd/legacy_led.c +1 -0
index 50de7e89d8f4..db312ae6e2dd 100644
@@ -12,6 +12,7 @@
 #include <command.h>
 #include <status_led.h>
 #include <vsprintf.h>
+#include <linux/string.h>
 
 struct led_tbl_s {
 	char		*string;	/* String for use in the command */
cmd/mp.c +1 -0
index 261bb8a07d43..686e1f8a82fc 100644
@@ -6,6 +6,7 @@
 #include <command.h>
 #include <cpu_func.h>
 #include <vsprintf.h>
+#include <linux/string.h>
 
 static int cpu_status_all(void)
 {
cmd/optee.c +1 -0
index e3aae5e9f9bf..155c9f1bb732 100644
@@ -6,6 +6,7 @@
 #include <errno.h>
 #include <tee.h>
 #include <vsprintf.h>
+#include <linux/string.h>
 
 #define TA_HELLO_WORLD_CMD_INC_VALUE 0
 /* This needs to match the UUID of the Hello World TA. */
cmd/sha1sum.c +1 -0
index 52aa26c78d2f..f2757146bbaf 100644
@@ -9,6 +9,7 @@
 
 #include <command.h>
 #include <hash.h>
+#include <linux/string.h>
 #include <u-boot/sha1.h>
 
 int do_sha1sum(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
cmd/sleep.c +1 -0
index 7616fed75566..a8c896e0c5ee 100644
@@ -9,6 +9,7 @@
 #include <time.h>
 #include <vsprintf.h>
 #include <linux/delay.h>
+#include <linux/string.h>
 
 static int do_sleep(struct cmd_tbl *cmdtp, int flag, int argc,
 		    char *const argv[])
cmd/smccc.c +1 -0
index 3a4d885e37e1..fa04bb05ca42 100644
@@ -9,6 +9,7 @@
 #include <linux/arm-smccc.h>
 #include <linux/compiler.h>
 #include <linux/psci.h>
+#include <linux/string.h>
 
 static int do_call(struct cmd_tbl *cmdtp, int flag, int argc,
 		   char *const argv[])
cmd/stackprot_test.c +1 -0
index e7ff4a061589..78e9beba5bf3 100644
@@ -4,6 +4,7 @@
  */
 
 #include <command.h>
+#include <linux/string.h>
 
 static int do_test_stackprot_fail(struct cmd_tbl *cmdtp, int flag, int argc,
 				  char *const argv[])
cmd/strings.c +1 -0
index 5bcb0f2b567c..beac2a6e6b3a 100644
@@ -9,6 +9,7 @@
 #include <config.h>
 #include <command.h>
 #include <vsprintf.h>
+#include <linux/string.h>
 
 static char *start_addr, *last_addr;
 
cmd/test.c +1 -0
index b4c3eabf9f60..4774d2964874 100644
@@ -8,6 +8,7 @@
 #include <fs.h>
 #include <log.h>
 #include <vsprintf.h>
+#include <linux/string.h>
 
 #define OP_INVALID	0
 #define OP_NOT		1
cmd/timer.c +1 -0
index 04fcd84ac6a6..427309e108df 100644
@@ -6,6 +6,7 @@
 
 #include <command.h>
 #include <time.h>
+#include <linux/string.h>
 
 static int do_timer(struct cmd_tbl *cmdtp, int flag, int argc,
 		    char *const argv[])
cmd/ufs.c +1 -0
index 6e21fbb1685c..790dab50f183 100644
@@ -8,6 +8,7 @@
 #include <command.h>
 #include <ufs.h>
 #include <vsprintf.h>
+#include <linux/string.h>
 
 static int do_ufs(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
cmd/x86/mtrr.c +1 -0
index 289865515ef5..91130453039d 100644
@@ -6,6 +6,7 @@
 #include <command.h>
 #include <log.h>
 #include <vsprintf.h>
+#include <linux/string.h>
 #include <asm/msr.h>
 #include <asm/mp.h>
 #include <asm/mtrr.h>
drivers/tpm/sandbox_common.c +1 -0
index 596e01563899..9d386fc32e5a 100644
@@ -9,6 +9,7 @@
 
 #include <tpm-v1.h>
 #include <tpm-v2.h>
+#include <linux/string.h>
 #include <asm/unaligned.h>
 #include "sandbox_common.h"
 
Signature · 1 line
2.43.0
author
#2 lore raw

PATCH 2/5 cmd/mem.c, test/cmd/mem_copy.c: Add <compiler.h>

In reply to Tom Rini

These files require <compiler.h> in order to have MEM_SUPPORT_64BIT_DATA be defined but currently rely on a long indirect include path to get it. Add this directly.

---
 cmd/mem.c           | 1 +
 test/cmd/mem_copy.c | 1 +
 2 files changed, 2 insertions(+)
cmd/mem.c +1 -0
index 9e716776393a..e5b9cb293491 100644
@@ -14,6 +14,7 @@
 #include <bootretry.h>
 #include <cli.h>
 #include <command.h>
+#include <compiler.h>
 #include <console.h>
 #include <display_options.h>
 #ifdef CONFIG_MTD_NOR_FLASH
test/cmd/mem_copy.c +1 -0
index 3e904fc4e4ba..8e551f18a852 100644
@@ -4,6 +4,7 @@
  */
 
 #include <command.h>
+#include <compiler.h>
 #include <console.h>
 #include <mapmem.h>
 #include <dm/test.h>
Signature · 1 line
2.43.0
author
#3 lore raw

PATCH 3/5 gpio: pca953x: Add missing <asm/byteorder.h>

In reply to Tom Rini

This driver takes a long implicit include path to get this header which it directly uses. Add it.

---
 drivers/gpio/pca953x.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpio/pca953x.c +1 -0
index 2fb14590c0fe..f0a79b92b024 100644
@@ -13,6 +13,7 @@
 #include <i2c.h>
 #include <pca953x.h>
 #include <vsprintf.h>
+#include <asm/byteorder.h>
 
 /* Default to an address that hopefully won't corrupt other i2c devices */
 #ifndef CFG_SYS_I2C_PCA953X_ADDR
Signature · 1 line
2.43.0
author
#4 lore raw

PATCH 4/5 global: Avoid indirect inclusion of <env.h> from <command.h>

In reply to Tom Rini

The include file <command.h> does not need anything from <env.h>. Furthermore, include/env.h itself includes other headers which can lead to longer indirect inclusion paths. To prepare to remove <env.h> from <command.h> fix all of the places which had relied on this indirect inclusion to instead include <env.h> directly.

---
Cc: Anatolij Gustschin <[email protected]>
Cc: Bin Meng <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Ilias Apalodimas <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Jerome Forissier <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: Lukasz Majewski <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Mark Kettenis <[email protected]>
Cc: Masahisa Kojima <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Rayagonda Kokatanur <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Simon Goldschmidt <[email protected]>
Cc: Stefan Bosch <[email protected]>
Cc: Tien Fong Chee <[email protected]>
Cc: Tingting Meng <[email protected]>
Cc: Tobias Waldekranz <[email protected]>

---
 arch/arm/cpu/armv8/fsl-layerscape/fdt.c             | 1 +
 arch/arm/mach-apple/board.c                         | 1 +
 arch/arm/mach-k3/r5/common.c                        | 1 +
 arch/arm/mach-socfpga/board.c                       | 1 +
 arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c | 1 +
 board/liebherr/mccmon6/spl.c                        | 1 +
 board/siemens/common/board_am335x.c                 | 1 +
 board/socionext/developerbox/fwu_plat.c             | 1 +
 boot/bootmeth_android.c                             | 1 +
 cmd/abootimg.c                                      | 1 +
 cmd/adc.c                                           | 1 +
 cmd/armflash.c                                      | 1 +
 cmd/bcb.c                                           | 1 +
 cmd/blkmap.c                                        | 1 +
 cmd/bootflow.c                                      | 1 +
 cmd/booti.c                                         | 1 +
 cmd/bootmeth.c                                      | 1 +
 cmd/broadcom/nitro_image_load.c                     | 1 +
 cmd/extension_board.c                               | 1 +
 cmd/hash.c                                          | 1 +
 cmd/mbr.c                                           | 1 +
 cmd/mem.c                                           | 1 +
 cmd/mmc.c                                           | 1 +
 cmd/sandbox/exception.c                             | 1 +
 cmd/seama.c                                         | 1 +
 cmd/spawn.c                                         | 1 +
 cmd/upl.c                                           | 1 +
 cmd/x86/zboot.c                                     | 1 +
 common/usb.c                                        | 1 +
 drivers/power/axp221.c                              | 1 +
 drivers/video/nexell_display.c                      | 1 +
 lib/efi_loader/efi_firmware.c                       | 1 +
 test/boot/bootdev.c                                 | 1 +
 test/boot/bootflow.c                                | 1 +
 test/boot/bootm.c                                   | 1 +
 test/boot/bootmeth.c                                | 1 +
 test/boot/measurement.c                             | 1 +
 test/boot/upl.c                                     | 1 +
 test/cmd/fdt.c                                      | 1 +
 test/cmd/hash.c                                     | 1 +
 test/cmd/mem_search.c                               | 1 +
 test/cmd/setexpr.c                                  | 1 +
 test/common/test_autoboot.c                         | 1 +
 test/dm/blkmap.c                                    | 1 +
 test/dm/button.c                                    | 1 +
 test/dm/fastboot.c                                  | 1 +
 test/dm/part.c                                      | 1 +
 test/env/fdt.c                                      | 1 +
 test/hush/dollar.c                                  | 1 +
 test/hush/if.c                                      | 1 +
 test/hush/loop.c                                    | 1 +
 51 files changed, 51 insertions(+)
arch/arm/cpu/armv8/fsl-layerscape/fdt.c +1 -0
index ca6be3626fbe..e8d2339f1a3b 100644
@@ -7,6 +7,7 @@
 #include <config.h>
 #include <clock_legacy.h>
 #include <efi_loader.h>
+#include <env.h>
 #include <log.h>
 #include <asm/cache.h>
 #include <linux/libfdt.h>
arch/arm/mach-apple/board.c +1 -0
index 2644a04a6228..2604c5a710ef 100644
@@ -6,6 +6,7 @@
 #include <dm.h>
 #include <dm/uclass-internal.h>
 #include <efi_loader.h>
+#include <env.h>
 #include <lmb.h>
 
 #include <asm/armv8/mmu.h>
arch/arm/mach-k3/r5/common.c +1 -0
index 0b6604039f3e..fa146549f137 100644
@@ -5,6 +5,7 @@
  * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
  */
 
+#include <env.h>
 #include <linux/printk.h>
 #include <linux/types.h>
 #include <asm/hardware.h>
arch/arm/mach-socfpga/board.c +1 -0
index 8506d5104134..bda123248033 100644
@@ -7,6 +7,7 @@
 
 #include <config.h>
 #include <errno.h>
+#include <env.h>
 #include <fdtdec.h>
 #include <log.h>
 #include <init.h>
arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c +1 -0
index 04640e476e6b..506ecac2ef08 100644
@@ -6,6 +6,7 @@
 #include <bootm.h>
 #include <command.h>
 #include <dfu.h>
+#include <env.h>
 #include <image.h>
 #include <asm/arch/stm32prog.h>
 #include <linux/printk.h>
board/liebherr/mccmon6/spl.c +1 -0
index b1f6881275d5..e612d9e9ce03 100644
@@ -5,6 +5,7 @@
  *         Richard Hu <[email protected]>
  */
 
+#include <env.h>
 #include <image.h>
 #include <init.h>
 #include <asm/arch/clock.h>
board/siemens/common/board_am335x.c +1 -0
index daf0bb930ec0..939ff81797dd 100644
@@ -10,6 +10,7 @@
  */
 
 #include <command.h>
+#include <env.h>
 #include <serial.h>
 #include <watchdog.h>
 #include <asm/arch/clock.h>
board/socionext/developerbox/fwu_plat.c +1 -0
index a8b111477ef9..5d2f40f241ce 100644
@@ -4,6 +4,7 @@
  */
 
 #include <efi_loader.h>
+#include <env.h>
 #include <fwu.h>
 #include <fwu_mdata.h>
 #include <memalign.h>
boot/bootmeth_android.c +1 -0
index 654ebfdf1fcc..8c2bde10e171 100644
@@ -18,6 +18,7 @@
 #include <bootm.h>
 #include <bootmeth.h>
 #include <dm.h>
+#include <env.h>
 #include <image.h>
 #include <malloc.h>
 #include <mapmem.h>
cmd/abootimg.c +1 -0
index ae7a1a7c83b0..44de00fb9c97 100644
@@ -6,6 +6,7 @@
 
 #include <android_image.h>
 #include <command.h>
+#include <env.h>
 #include <image.h>
 #include <mapmem.h>
 
cmd/adc.c +1 -0
index 4d3b5b61f6f0..334ba7fdeca8 100644
@@ -5,6 +5,7 @@
  */
 #include <command.h>
 #include <dm.h>
+#include <env.h>
 #include <adc.h>
 #include <linux/printk.h>
 
cmd/armflash.c +1 -0
index 83f616db4efb..cde275c881b1 100644
@@ -7,6 +7,7 @@
  */
 #include <command.h>
 #include <console.h>
+#include <env.h>
 #include <flash.h>
 #include <vsprintf.h>
 #include <linux/string.h>
cmd/bcb.c +1 -0
index 16eabfe00f5a..d6d944bd6b31 100644
@@ -8,6 +8,7 @@
 #include <android_bootloader_message.h>
 #include <bcb.h>
 #include <command.h>
+#include <env.h>
 #include <android_ab.h>
 #include <display_options.h>
 #include <log.h>
cmd/blkmap.c +1 -0
index 86a123b1cd37..65edec899e2c 100644
@@ -7,6 +7,7 @@
 #include <blk.h>
 #include <blkmap.h>
 #include <command.h>
+#include <env.h>
 #include <malloc.h>
 #include <dm/device.h>
 
cmd/bootflow.c +1 -0
index a1fd59a69f47..d4f7d3361500 100644
@@ -13,6 +13,7 @@
 #include <command.h>
 #include <console.h>
 #include <dm.h>
+#include <env.h>
 #include <mapmem.h>
 
 /**
cmd/booti.c +1 -0
index 1a57fe913977..7e6d94262993 100644
@@ -6,6 +6,7 @@
 
 #include <bootm.h>
 #include <command.h>
+#include <env.h>
 #include <image.h>
 #include <irq_func.h>
 #include <lmb.h>
cmd/bootmeth.c +1 -0
index 2f41fa1bec6b..ea4b3f47db8a 100644
@@ -11,6 +11,7 @@
 #include <bootstd.h>
 #include <command.h>
 #include <dm.h>
+#include <env.h>
 #include <malloc.h>
 #include <dm/uclass-internal.h>
 
cmd/broadcom/nitro_image_load.c +1 -0
index 289b184e9afd..fe08679840ef 100644
@@ -4,6 +4,7 @@
  */
 
 #include <command.h>
+#include <env.h>
 #include <vsprintf.h>
 
 #define FW_IMAGE_SIG	0xff123456
cmd/extension_board.c +1 -0
index 6c14d0ddebdc..317b260bf36a 100644
@@ -7,6 +7,7 @@
 #include <bootdev.h>
 #include <command.h>
 #include <dm.h>
+#include <env.h>
 #include <malloc.h>
 #include <extension_board.h>
 #include <mapmem.h>
cmd/hash.c +1 -0
index 5b40982b098d..96d0e443a5b6 100644
@@ -10,6 +10,7 @@
  */
 
 #include <command.h>
+#include <env.h>
 #include <hash.h>
 #include <linux/ctype.h>
 
cmd/mbr.c +1 -0
index 7e1f92a13bb5..7fe6c9e103ab 100644
@@ -10,6 +10,7 @@
 
 #include <blk.h>
 #include <command.h>
+#include <env.h>
 #include <malloc.h>
 #include <part.h>
 #include <vsprintf.h>
cmd/mem.c +1 -0
index e5b9cb293491..b8afe62e4749 100644
@@ -17,6 +17,7 @@
 #include <compiler.h>
 #include <console.h>
 #include <display_options.h>
+#include <env.h>
 #ifdef CONFIG_MTD_NOR_FLASH
 #include <flash.h>
 #endif
cmd/mmc.c +1 -0
index fe7899ec793c..5340a58be8ee 100644
@@ -8,6 +8,7 @@
 #include <command.h>
 #include <console.h>
 #include <display_options.h>
+#include <env.h>
 #include <mapmem.h>
 #include <memalign.h>
 #include <mmc.h>
cmd/sandbox/exception.c +1 -0
index f9c847d8ff28..e015acf60e2b 100644
@@ -6,6 +6,7 @@
  */
 
 #include <command.h>
+#include <env.h>
 
 static int do_sigsegv(struct cmd_tbl *cmdtp, int flag, int argc,
 		      char *const argv[])
cmd/seama.c +1 -0
index 3c8e81992340..d62879780906 100644
@@ -5,6 +5,7 @@
  */
 
 #include <command.h>
+#include <env.h>
 #include <nand.h>
 
 /*
cmd/spawn.c +1 -0
index 37737b8627c8..8829aa9728d2 100644
@@ -5,6 +5,7 @@
 
 #include <command.h>
 #include <console.h>
+#include <env.h>
 #include <malloc.h>
 #include <vsprintf.h>
 #include <uthread.h>
cmd/upl.c +1 -0
index c9a823bbc064..ef2183d85281 100644
@@ -12,6 +12,7 @@
 #include <alist.h>
 #include <command.h>
 #include <display_options.h>
+#include <env.h>
 #include <mapmem.h>
 #include <string.h>
 #include <upl.h>
cmd/x86/zboot.c +1 -0
index 94e602b8a5b6..3876d1632362 100644
@@ -8,6 +8,7 @@
 #define LOG_CATEGORY	LOGC_BOOT
 
 #include <command.h>
+#include <env.h>
 #include <mapmem.h>
 #include <vsprintf.h>
 #include <asm/zimage.h>
common/usb.c +1 -0
index 7a8435296c67..6a4ad346f4ba 100644
@@ -28,6 +28,7 @@
 #include <command.h>
 #include <dm.h>
 #include <dm/device_compat.h>
+#include <env.h>
 #include <log.h>
 #include <malloc.h>
 #include <memalign.h>
drivers/power/axp221.c +1 -0
index c22ca03f4694..f5daa2430821 100644
@@ -10,6 +10,7 @@
  */
 
 #include <command.h>
+#include <env.h>
 #include <errno.h>
 #include <asm/arch/pmic_bus.h>
 #include <axp_pmic.h>
drivers/video/nexell_display.c +1 -0
index 7bda33fb16e1..ea3776258a00 100644
@@ -10,6 +10,7 @@
 #include <config.h>
 #include <command.h>
 #include <dm.h>
+#include <env.h>
 #include <mapmem.h>
 #include <malloc.h>
 #include <linux/compat.h>
lib/efi_loader/efi_firmware.c +1 -0
index d44dc09813e3..75501e215575 100644
@@ -12,6 +12,7 @@
 #include <dfu.h>
 #include <efi_loader.h>
 #include <efi_variable.h>
+#include <env.h>
 #include <fwu.h>
 #include <image.h>
 #include <signatures.h>
test/boot/bootdev.c +1 -0
index 9af947868707..a5f3d4462a94 100644
@@ -10,6 +10,7 @@
 #include <dm.h>
 #include <bootdev.h>
 #include <bootflow.h>
+#include <env.h>
 #include <mapmem.h>
 #include <os.h>
 #include <test/ut.h>
test/boot/bootflow.c +1 -0
index b261bd5f620e..a930d2cc309a 100644
@@ -14,6 +14,7 @@
 #include <dm.h>
 #include <efi.h>
 #include <efi_loader.h>
+#include <env.h>
 #include <expo.h>
 #include <mapmem.h>
 #ifdef CONFIG_SANDBOX
test/boot/bootm.c +1 -0
index 1d1efe71ad52..ed60094f3c1a 100644
@@ -6,6 +6,7 @@
  */
 
 #include <bootm.h>
+#include <env.h>
 #include <asm/global_data.h>
 #include <test/test.h>
 #include <test/ut.h>
test/boot/bootmeth.c +1 -0
index 577f259fb371..2ef3569ad837 100644
@@ -9,6 +9,7 @@
 #include <bootmeth.h>
 #include <bootstd.h>
 #include <dm.h>
+#include <env.h>
 #include <test/ut.h>
 #include "bootstd_common.h"
 
test/boot/measurement.c +1 -0
index 1d38663fc0f8..71f503f1567d 100644
@@ -7,6 +7,7 @@
  */
 
 #include <bootm.h>
+#include <env.h>
 #include <malloc.h>
 #include <test/test.h>
 #include <test/ut.h>
test/boot/upl.c +1 -0
index eec89026fc30..e2dc3d51edaa 100644
@@ -7,6 +7,7 @@
  */
 
 #include <abuf.h>
+#include <env.h>
 #include <mapmem.h>
 #include <upl.h>
 #include <dm/ofnode.h>
test/cmd/fdt.c +1 -0
index c11c181c807c..96a8488e1720 100644
@@ -6,6 +6,7 @@
  */
 
 #include <console.h>
+#include <env.h>
 #include <fdt_support.h>
 #include <mapmem.h>
 #include <asm/global_data.h>
test/cmd/hash.c +1 -0
index 296dd762b31d..bb96380c351a 100644
@@ -6,6 +6,7 @@
  */
 
 #include <command.h>
+#include <env.h>
 #include <dm.h>
 #include <dm/test.h>
 #include <test/test.h>
test/cmd/mem_search.c +1 -0
index df8938bdb6c6..61de0dfb9a98 100644
@@ -7,6 +7,7 @@
  */
 
 #include <console.h>
+#include <env.h>
 #include <mapmem.h>
 #include <dm/test.h>
 #include <test/ut.h>
test/cmd/setexpr.c +1 -0
index 85803eb54b8c..93b0c4b68f50 100644
@@ -7,6 +7,7 @@
  */
 
 #include <console.h>
+#include <env.h>
 #include <mapmem.h>
 #include <dm/test.h>
 #include <test/ut.h>
test/common/test_autoboot.c +1 -0
index e3050d02c605..5feff57c2714 100644
@@ -6,6 +6,7 @@
  */
 
 #include <autoboot.h>
+#include <env.h>
 #include <test/common.h>
 #include <test/test.h>
 #include <test/ut.h>
test/dm/blkmap.c +1 -0
index a6a0b4d4e208..d04b68b50aec 100644
@@ -7,6 +7,7 @@
 #include <blk.h>
 #include <blkmap.h>
 #include <dm.h>
+#include <env.h>
 #include <asm/test.h>
 #include <dm/test.h>
 #include <test/test.h>
test/dm/button.c +1 -0
index 3612f308f029..f05f4ca27ceb 100644
@@ -8,6 +8,7 @@
 #include <dm.h>
 #include <adc.h>
 #include <button.h>
+#include <env.h>
 #include <power/regulator.h>
 #include <power/sandbox_pmic.h>
 #include <asm/gpio.h>
test/dm/fastboot.c +1 -0
index 73c43f829240..5b51b6bf9dd4 100644
@@ -4,6 +4,7 @@
  */
 
 #include <dm.h>
+#include <env.h>
 #include <fastboot.h>
 #include <fb_mmc.h>
 #include <mmc.h>
test/dm/part.c +1 -0
index c5c4b3fdba1b..caae23bd4aad 100644
@@ -4,6 +4,7 @@
  */
 
 #include <dm.h>
+#include <env.h>
 #include <mmc.h>
 #include <part.h>
 #include <part_efi.h>
test/env/fdt.c +1 -0
index c495ac7b307c..3652563f3304 100644
@@ -1,4 +1,5 @@
 #include <command.h>
+#include <env.h>
 #include <env_attr.h>
 #include <test/env.h>
 #include <test/ut.h>
test/hush/dollar.c +1 -0
index 820110799a20..b83a64d091d1 100644
@@ -5,6 +5,7 @@
  */
 
 #include <command.h>
+#include <env.h>
 #include <env_attr.h>
 #include <test/hush.h>
 #include <test/ut.h>
test/hush/if.c +1 -0
index 8939b7a6c86f..ea615b246a9a 100644
@@ -5,6 +5,7 @@
  */
 
 #include <command.h>
+#include <env.h>
 #include <env_attr.h>
 #include <vsprintf.h>
 #include <test/hush.h>
test/hush/loop.c +1 -0
index 7154b9bc0ae3..ea72ac773bac 100644
@@ -5,6 +5,7 @@
  */
 
 #include <command.h>
+#include <env.h>
 #include <env_attr.h>
 #include <test/hush.h>
 #include <test/ut.h>
Signature · 1 line
2.43.0
Reviewed-by on v1 4/5
#5 lore raw

Re: [PATCH 4/5] global: Avoid indirect inclusion of <env.h> from <command.h>

Hi Tom,

Thank you for the patch.

Quoted 7 lines · Tom Rini

The include file <command.h> does not need anything from <env.h>. Furthermore, include/env.h itself includes other headers which can lead to longer indirect inclusion paths. To prepare to remove <env.h> from <command.h> fix all of the places which had relied on this indirect inclusion to instead include <env.h> directly.

Quoted 1 line

---

Reviewed-by on v1 4/5
#6 lore raw

Re: [PATCH 4/5] global: Avoid indirect inclusion of <env.h> from <command.h>

In reply to Tom Rini
Quoted 7 lines · Tom Rini

The include file <command.h> does not need anything from <env.h>. Furthermore, include/env.h itself includes other headers which can lead to longer indirect inclusion paths. To prepare to remove <env.h> from <command.h> fix all of the places which had relied on this indirect inclusion to instead include <env.h> directly.

Thanks,

Signature · 1 line
Jerome
author
#7 lore raw

PATCH 5/5 include/command.h: Drop <env.h>

In reply to Tom Rini

Now that all of the cases of code that relied on <command.h> to provide <env.h> (or one of the headers that it includes, and so forth) have been fixed, we can drop the include from here.

---
 include/command.h | 1 -
 1 file changed, 1 deletion(-)
include/command.h +0 -1
index 4158ca11b0ef..5d225cd197f7 100644
@@ -10,7 +10,6 @@
 #ifndef __COMMAND_H
 #define __COMMAND_H
 
-#include <env.h>
 #include <linker_lists.h>
 
 #include <linux/compiler_attributes.h>
Signature · 1 line
2.43.0
author
#8 lore raw

v3 cover Remove <env.h> from <net.h>

In reply to Tom Rini

Hey all,

This is a v3 of Simon's series[1] and depends on the series[2] I posted the other day that removes <env.h> from <command.h>. With this series done, I believe we've tackled all of the current cases of headers which include <env.h> without directly needing it. Much of this series is in fact Simon's v2 with the main differneces being:
- Removing <env.h> from <net.h> at the end
- Removing env_to_ip() given how little it's used rather than shuffling around where it's declared and un-inline'ing it. For a rarely used helper, this ends up being cleaner I think. Especially looking at some of the users (which called env_get repeatedly). If there's strong opinion here about using the other method[3] we can do that instead.
- Setting aside for now how to handle CMD_ELF=y and NO_NET=y because today it's actually fine as we unconditionally build lib/net_utils.c where string_to_ip() is defined. I'm unsure if a further series is warranted here or not. We rely on link-time optimization to keep code readable too.

[1]: https://lore.kernel.org/all/[email protected]
[2]: https://lore.kernel.org/all/[email protected]
[3]: https://lore.kernel.org/all/[email protected]

Signature · 1 line
Tom
author
#9 lore raw

PATCH v3 1/22 net: Remove env_get_ip helper() function

Currently, we have the function env_get_ip which takes an IP address in string form and returns a struct in_addr representation of that address. It is however little used and means that a number of places indirectly (and unclearly) get <env.h> via <net.h>. To clean this up start by replacing env_get_ip() calls with string_to_ip() calls. This is generally a no-op as env_get_ip(str) is an inline of string_to_ip(env_get(str)) but in a few cases we can or already have stored the result of env_get(str) and can save the additional call.

---
Changes in v3:
- New patch

Cc Jerome Forissier <[email protected]>
Cc Simon Glass <[email protected]>
---
 cmd/elf.c                |  2 +-
 cmd/net.c                |  2 +-
 drivers/net/netconsole.c | 11 ++++++-----
 include/net-common.h     | 13 -------------
 net/link_local.c         |  2 +-
 5 files changed, 9 insertions(+), 21 deletions(-)
cmd/elf.c +1 -1
index 6b49c613703e..5e0ee30a7c86 100644
@@ -247,7 +247,7 @@ int do_bootvx(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 			ptr += sprintf(build_buf + ptr, "e=%s", tmp);
 			tmp = env_get("netmask");
 			if (tmp) {
-				u32 mask = env_get_ip("netmask").s_addr;
+				u32 mask = string_to_ip(tmp).s_addr;
 				ptr += sprintf(build_buf + ptr,
 					       ":%08x ", ntohl(mask));
 			} else {
cmd/net.c +1 -1
index eaa1de5295f2..886735ea14f6 100644
@@ -564,7 +564,7 @@ int do_sntp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 	char *toff;
 
 	if (argc < 2) {
-		net_ntp_server = env_get_ip("ntpserverip");
+		net_ntp_server = string_to_ip(env_get("ntpserverip"));
 		if (net_ntp_server.s_addr == 0) {
 			printf("ntpserverip not set\n");
 			return CMD_RET_FAILURE;
drivers/net/netconsole.c +6 -5
index 1943de8ba730..c2ce4a80d120 100644
@@ -61,8 +61,8 @@ static int is_broadcast(struct in_addr ip)
 
 	/* update only when the environment has changed */
 	if (env_changed_id != env_id) {
-		netmask = env_get_ip("netmask");
-		our_ip = env_get_ip("ipaddr");
+		netmask = string_to_ip(env_get("netmask"));
+		our_ip = string_to_ip(env_get("ipaddr"));
 
 		env_changed_id = env_id;
 	}
@@ -81,11 +81,12 @@ static int refresh_settings_from_env(void)
 
 	/* update only when the environment has changed */
 	if (env_changed_id != env_id) {
-		if (env_get("ncip")) {
-			nc_ip = env_get_ip("ncip");
+		char *tmp = env_get("ncip");
+		if (tmp) {
+			nc_ip = string_to_ip(tmp);
 			if (!nc_ip.s_addr)
 				return -1;	/* ncip is 0.0.0.0 */
-			p = strchr(env_get("ncip"), ':');
+			p = strchr(tmp, ':');
 			if (p != NULL) {
 				nc_out_port = dectoul(p + 1, NULL);
 				nc_in_port = nc_out_port;
include/net-common.h +0 -13
index e536968a92bb..2ca565fe4edc 100644
@@ -456,19 +456,6 @@ void net_process_received_packet(uchar *in_packet, int len);
  */
 int update_tftp(ulong addr, char *interface, char *devstring);
 
-/**
- * env_get_ip() - Convert an environment value to an ip address
- *
- * @var: Environment variable to convert. The value of this variable must be
- *	in the format a.b.c.d, where each value is a decimal number from
- *	0 to 255
- * Return: IP address, or 0 if invalid
- */
-static inline struct in_addr env_get_ip(char *var)
-{
-	return string_to_ip(env_get(var));
-}
-
 int net_init(void);
 
 /* Called when a network operation fails to know if it should be re-tried */
net/link_local.c +1 -1
index 179721333ffc..f6425ff3df26 100644
@@ -106,7 +106,7 @@ static void configure_wait(void)
 
 void link_local_start(void)
 {
-	ip = env_get_ip("llipaddr");
+	ip = string_to_ip(env_get("llipaddr"));
 	if (ip.s_addr != 0 &&
 	    (ntohl(ip.s_addr) & IN_CLASSB_NET) != LINKLOCAL_ADDR) {
 		puts("invalid link address");
Signature · 1 line
2.43.0
author
#10 lore raw

PATCH v3 2/22 congatec: Include env.h to permit reading the environment

In reply to Tom Rini

From: Simon Glass <[email protected]>

This file reads from the environment but does not include the correct header. Update it.

---
Changes in v3:
- Keep config.h, update commit message - trini

---
 board/congatec/cgtqmx8/cgtqmx8.c | 1 +
 1 file changed, 1 insertion(+)
board/congatec/cgtqmx8/cgtqmx8.c +1 -0
index 054e4e10867a..03be02a2884f 100644
@@ -4,6 +4,7 @@
  * Copyright (C) 2019 Oliver Graute <[email protected]>
  */
 #include <config.h>
+#include <env.h>
 #include <errno.h>
 #include <linux/libfdt.h>
 #include <fsl_esdhc.h>
Signature · 1 line
2.43.0
author
#11 lore raw

PATCH v3 3/22 dhelectronics: Include env.h to permit reading the environment

In reply to Tom Rini

From: Simon Glass <[email protected]>

This file reads from the environment but does not include the correct header. Update it.

---
Changes in v3:
- None

---
 board/dhelectronics/common/dh_common.c | 1 +
 1 file changed, 1 insertion(+)
board/dhelectronics/common/dh_common.c +1 -0
index 71010803f555..8c052c45007a 100644
@@ -5,6 +5,7 @@
  */
 
 #include <dm.h>
+#include <env.h>
 #include <i2c_eeprom.h>
 #include <net.h>
 #include <u-boot/crc.h>
Signature · 1 line
2.43.0
author
#12 lore raw

PATCH v3 4/22 imx8ulp_evk: Include env.h to permit reading the environment

In reply to Tom Rini

From: Simon Glass <[email protected]>

This file reads from the environment but does not include the correct header. Update it.

---
Changes in v3:
- None

---
 board/freescale/imx8ulp_evk/imx8ulp_evk.c | 1 +
 1 file changed, 1 insertion(+)
board/freescale/imx8ulp_evk/imx8ulp_evk.c +1 -0
index 0af610672637..4bf77a488ccd 100644
@@ -3,6 +3,7 @@
  * Copyright 2020 NXP
  */
 
+#include <env.h>
 #include <miiphy.h>
 #include <netdev.h>
 #include <asm/arch/imx8ulp-pins.h>
Signature · 1 line
2.43.0
author
#13 lore raw

PATCH v3 5/22 net: Include string.h in net-legacy.h

In reply to Tom Rini

From: Simon Glass <[email protected]>

This file uses memcpy() but does not include the header file. Update it.

---
Changes in v3:
- None

---
 include/net-legacy.h | 1 +
 1 file changed, 1 insertion(+)
include/net-legacy.h +1 -0
index 51780999a883..a7dbcec1506b 100644
@@ -17,6 +17,7 @@
 #include <log.h>
 #include <time.h>
 #include <linux/if_ether.h>
+#include <linux/string.h>
 
 struct bd_info;
 struct cmd_tbl;
Signature · 1 line
2.43.0
author
#14 lore raw

PATCH v3 6/22 venice: Include env.h to permit reading the environment

In reply to Tom Rini

From: Simon Glass <[email protected]>

This file reads from the environment but does not include the correct header. Update it.

---
Changes in v3:
- None

---
 board/gateworks/venice/venice.c | 1 +
 1 file changed, 1 insertion(+)
board/gateworks/venice/venice.c +1 -0
index 98b33624f041..f9bcdd8496ed 100644
@@ -3,6 +3,7 @@
  * Copyright 2021 Gateworks Corporation
  */
 
+#include <env.h>
 #include <fdt_support.h>
 #include <init.h>
 #include <led.h>
Signature · 1 line
2.43.0
author
#15 lore raw

PATCH v3 7/22 phytec: Include env.h to permit reading the environment

In reply to Tom Rini

From: Simon Glass <[email protected]>

This file reads from the environment but does not include the correct header. Update it.

---
Changes in v3:
- None

---
 board/phytec/common/phytec_som_detection_blocks.c | 1 +
 1 file changed, 1 insertion(+)
board/phytec/common/phytec_som_detection_blocks.c +1 -0
index 5f3c27ef0c22..b44ff85972f9 100644
@@ -4,6 +4,7 @@
  * Author: Daniel Schultz <[email protected]>
  */
 
+#include <env.h>
 #include <malloc.h>
 #include <u-boot/crc.h>
 #include <net.h>
Signature · 1 line
2.43.0
author
#16 lore raw

PATCH v3 8/22 ronetix: Include env.h to permit reading the environment

In reply to Tom Rini

From: Simon Glass <[email protected]>

This file reads from the environment but does not include the correct header. Update it.

---
Changes in v3:
- None

---
 board/ronetix/imx8mq-cm/imx8mq_cm.c | 1 +
 1 file changed, 1 insertion(+)
board/ronetix/imx8mq-cm/imx8mq_cm.c +1 -0
index fbee2c39771e..602216854ba4 100644
@@ -3,6 +3,7 @@
  * Copyright 2018 NXP
  */
 
+#include <env.h>
 #include <miiphy.h>
 #include <asm-generic/gpio.h>
 #include <asm/arch/imx8mq_pins.h>
Signature · 1 line
2.43.0
author
#17 lore raw

PATCH v3 9/22 toradex: Include env.h to permit reading the environment

In reply to Tom Rini

From: Simon Glass <[email protected]>

Two files read from the environment but don't not include the correct header. Update them.

---
Changes in v3:
- None

---
 board/toradex/colibri_imx7/colibri_imx7.c   | 1 +
 board/toradex/verdin-imx8mm/verdin-imx8mm.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
board/toradex/colibri_imx7/colibri_imx7.c +1 -0
index 7de29e3abfb6..69a8a18d3a75 100644
@@ -4,6 +4,7 @@
  */
 
 #include <cpu_func.h>
+#include <env.h>
 #include <init.h>
 #include <net.h>
 #include <asm/arch/clock.h>
board/toradex/verdin-imx8mm/verdin-imx8mm.c +1 -1
index 9359e0ac6bff..066e8db678fb 100644
@@ -3,7 +3,7 @@
  * Copyright 2020-2021 Toradex
  */
 
-#include <config.h>
+#include <env.h>
 #include <init.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
Signature · 1 line
2.43.0
author
#18 lore raw

PATCH v3 10/22 advantech: Include env.h in imx8qm_dmsse20_a1

In reply to Tom Rini

From: Simon Glass <[email protected]>

This file uses the environment but does not include the header file. Update it.

---
Changes in v3:
- None

---
 board/advantech/imx8qm_dmsse20_a1/imx8qm_dmsse20_a1.c | 1 +
 1 file changed, 1 insertion(+)
board/advantech/imx8qm_dmsse20_a1/imx8qm_dmsse20_a1.c +1 -0
index 50b35db5f6cf..accd300df04d 100644
@@ -4,6 +4,7 @@
  * Copyright 2019-2023 Kococonnector GmbH
  */
 
+#include <env.h>
 #include <errno.h>
 #include <linux/libfdt.h>
 #include <asm/io.h>
Signature · 1 line
2.43.0
author
#19 lore raw

PATCH v3 11/22 tegra: Include env.h to permit reading the environment

In reply to Tom Rini

From: Simon Glass <[email protected]>

This file reads from the environment but does not include the correct header. Update it.

---
Changes in v3:
- None

---
 arch/arm/mach-tegra/dt-setup.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-tegra/dt-setup.c +1 -0
index f4ae602d5239..96044ac78ce4 100644
@@ -3,6 +3,7 @@
  * Copyright (c) 2010-2016, NVIDIA CORPORATION.
  */
 
+#include <env.h>
 #include <fdtdec.h>
 #include <stdlib.h>
 #include <asm/arch-tegra/cboot.h>
Signature · 1 line
2.43.0
author
#20 lore raw

PATCH v3 12/22 synology: Include env.h to permit reading the environment

In reply to Tom Rini

From: Simon Glass <[email protected]>

This file reads from the environment but does not include the correct header. Update it.

---
Changes in v3:
- None

---
 board/Synology/ds414/ds414.c | 1 +
 1 file changed, 1 insertion(+)
board/Synology/ds414/ds414.c +1 -0
index 1a4cea87e1a7..02d6a4a1ea8a 100644
@@ -4,6 +4,7 @@
  * Copyright (C) 2015 Phil Sutter <[email protected]>
  */
 
+#include <env.h>
 #include <init.h>
 #include <miiphy.h>
 #include <asm/global_data.h>
Signature · 1 line
2.43.0
author
#21 lore raw

PATCH v3 13/22 amlogic: Include env.h to permit reading the environment

In reply to Tom Rini

From: Simon Glass <[email protected]>

This file reads from the environment but does not include the correct header. Update it.

---
Changes in v3:
- None

---
 board/amlogic/jethub-j100/jethub-j100.c | 1 +
 1 file changed, 1 insertion(+)
board/amlogic/jethub-j100/jethub-j100.c +1 -0
index b770a1f8c537..9e87fb9f9d73 100644
@@ -5,6 +5,7 @@
  */
 
 #include <dm.h>
+#include <env.h>
 #include <init.h>
 #include <net.h>
 #include <asm/io.h>
Signature · 1 line
2.43.0
author
#22 lore raw

PATCH v3 14/22 freescale: Include env.h to permit reading the environment

In reply to Tom Rini

From: Simon Glass <[email protected]>

This file reads from the environment but does not include the correct header. Update it.

---
Changes in v3:
- None

---
 board/freescale/mx7dsabresd/mx7dsabresd.c | 1 +
 1 file changed, 1 insertion(+)
board/freescale/mx7dsabresd/mx7dsabresd.c +1 -0
index 3db167c0dad3..bef4f901ff74 100644
@@ -3,6 +3,7 @@
  * Copyright (C) 2015 Freescale Semiconductor, Inc.
  */
 
+#include <env.h>
 #include <init.h>
 #include <net.h>
 #include <asm/arch/clock.h>
Signature · 1 line
2.43.0
author
#23 lore raw

PATCH v3 15/22 google: Include env.h to permit reading the environment

In reply to Tom Rini

From: Simon Glass <[email protected]>

This file reads from the environment but does not include the correct header. Update it.

---
Changes in v3:
- None

---
 board/google/chameleonv3/board.c | 2 ++
 1 file changed, 2 insertions(+)
board/google/chameleonv3/board.c +2 -0
index 4d3049689d3a..d8ffdd25b387 100644
@@ -2,6 +2,8 @@
 /*
  * Copyright 2022 Google LLC
  */
+
+#include <env.h>
 #include <net.h>
 #include <errno.h>
 #include "mercury_aa1.h"
Signature · 1 line
2.43.0
author
#24 lore raw

PATCH v3 16/22 liebherr: Include env.h to permit reading the environment

In reply to Tom Rini

From: Simon Glass <[email protected]>

This file reads from the environment but does not include the correct header. Update it.

---
Changes in v3:
- None

---
 board/liebherr/xea/xea.c | 1 +
 1 file changed, 1 insertion(+)
board/liebherr/xea/xea.c +1 -0
index 1d4f165fd13a..9630e7f576b2 100644
@@ -13,6 +13,7 @@
  *
  */
 
+#include <env.h>
 #include <fdt_support.h>
 #include <init.h>
 #include <log.h>
Signature · 1 line
2.43.0
Reviewed-by on v3 16/22
#25 lore raw

Re: [PATCH v3 16/22] liebherr: Include env.h to permit reading the environment

Quoted 19 lines · On Thu, 15 May 2025 17:31:45 -0600 Tom Rini <[email protected]> wrote:

From: Simon Glass <[email protected]>

This file reads from the environment but does not include the correct header. Update it.

---
Changes in v3:
- None

---
 board/liebherr/xea/xea.c | 1 +
 1 file changed, 1 insertion(+)
board/liebherr/xea/xea.c +0 -0
index 1d4f165fd13a..9630e7f576b2 100644

board/liebherr/xea/xea.c line 19

Quoted 7 lines
board/liebherr/xea/xea.c +1 -0
@@ -13,6 +13,7 @@
  *
  */
 
+#include <env.h>
 #include <fdt_support.h>
 #include <init.h>
 #include <log.h>

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

author
#26 lore raw

PATCH v3 17/22 technexion: Include env.h to permit reading the environment

In reply to Tom Rini

From: Simon Glass <[email protected]>

This file reads from the environment but does not include the correct header. Update it.

---
Changes in v3:
- None

---
 board/technexion/pico-imx7d/pico-imx7d.c | 1 +
 1 file changed, 1 insertion(+)
board/technexion/pico-imx7d/pico-imx7d.c +1 -0
index d0f739c624a1..cf6b7fcbd958 100644
@@ -3,6 +3,7 @@
  * Copyright (C) 2017 NXP Semiconductors
  */
 
+#include <env.h>
 #include <init.h>
 #include <net.h>
 #include <asm/arch/clock.h>
Signature · 1 line
2.43.0
author
#27 lore raw

PATCH v3 18/22 net: Include byteorder in net6.h

In reply to Tom Rini

From: Simon Glass <[email protected]>

This file uses byteorder but does not include the header file. Update it.

---
Changes in v3:
- None

---
 include/net6.h | 1 +
 1 file changed, 1 insertion(+)
include/net6.h +1 -0
index 2ceeaba06399..39573e490a66 100644
@@ -11,6 +11,7 @@
 #define __NET6_H__
 
 #include <net.h>
+#include <asm/byteorder.h>
 #include <linux/ctype.h>
 #include <linux/errno.h>
 
Signature · 1 line
2.43.0
author
#28 lore raw

PATCH v3 19/22 net: Include env.h in pcap.c

In reply to Tom Rini

From: Simon Glass <[email protected]>

This file uses the environment but does not include the header file. Update it.

---
Changes in v3:
- None

---
 net/pcap.c | 1 +
 1 file changed, 1 insertion(+)
net/pcap.c +1 -0
index c959e3e4e511..d1d6f705cda0 100644
@@ -3,6 +3,7 @@
  * Copyright 2019 Ramon Fried <[email protected]>
  */
 
+#include <env.h>
 #include <net.h>
 #include <net/pcap.h>
 #include <time.h>
Signature · 1 line
2.43.0
author
#29 lore raw

PATCH v3 20/22 net: dc2114x: Include env.h to permit reading the environment

In reply to Tom Rini

From: Simon Glass <[email protected]>

This file uses the environment but does not include the header file. Update it.

---
Changes in v3:
- None

---
 drivers/net/dc2114x.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/dc2114x.c +1 -0
index 7c0665faa8e1..8fa549280aac 100644
@@ -3,6 +3,7 @@
 #include <asm/io.h>
 #include <cpu_func.h>
 #include <dm.h>
+#include <env.h>
 #include <malloc.h>
 #include <net.h>
 #include <netdev.h>
Signature · 1 line
2.43.0
author
#30 lore raw

PATCH v3 21/22 global: Avoid indirect inclusion of <env.h> from <net.h>

In reply to Tom Rini

Now that env_get_ip() has been removed, the include file <net.h> does not need anything from <env.h>. Furthermore, include/env.h itself includes other headers which can lead to longer indirect inclusion paths. To prepare to remove <env.h> from <net.h> fix all of the remaining places which had relied on this indirect inclusion to instead include <env.h> directly.

---
Changes in v3:
- New patch

Cc "Huan 'Kitty' Wang" <[email protected]>
Cc "Ying-Chun Liu (PaulLiu)" <[email protected]>
Cc Angus Ainslie <[email protected]> (supporter:PURISM LIBREM5 PHONE)
Cc Heinrich Schuchardt <[email protected]>
Cc Ian Ray <[email protected]>
Cc Ilias Apalodimas <[email protected]>
Cc Jan Kiszka <[email protected]>
Cc Jerome Forissier <[email protected]>
Cc Joe Hershberger <[email protected]>
Cc Le Jin <[email protected]>
Cc Martyn Welch <[email protected]>
Cc Niel Fourie <[email protected]>
Cc Ramon Fried <[email protected]>
Cc Rick Chen <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tim Harvey <[email protected]>
Cc Wolfgang Wallner <[email protected]>
---
 board/BuR/brppt2/board.c                            | 1 +
 board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c | 1 +
 board/andestech/ae350/ae350.c                       | 1 +
 board/data_modul/common/common.c                    | 1 +
 board/gateworks/gw_ventana/gw_ventana.c             | 1 +
 board/ge/b1x5v2/b1x5v2.c                            | 1 +
 board/keymile/kmcent2/kmcent2.c                     | 1 +
 board/purism/librem5/librem5.c                      | 1 +
 board/siemens/iot2050/board.c                       | 1 +
 board/ti/j721e/evm.c                                | 1 +
 boot/bootmeth_efi.c                                 | 1 +
 boot/bootmeth_pxe.c                                 | 1 +
 cmd/pxe.c                                           | 1 +
 drivers/net/pfe_eth/pfe_firmware.c                  | 1 +
 lib/efi_loader/efi_bootmgr.c                        | 1 +
 lib/efi_loader/efi_net.c                            | 1 +
 net/lwip/dhcp.c                                     | 1 +
 net/lwip/dns.c                                      | 1 +
 net/lwip/net-lwip.c                                 | 1 +
 net/lwip/tftp.c                                     | 1 +
 net/lwip/wget.c                                     | 1 +
 test/dm/dsa.c                                       | 1 +
 22 files changed, 22 insertions(+)
board/BuR/brppt2/board.c +1 -0
index c0a163251b46..de206bdf1bc4 100644
@@ -7,6 +7,7 @@
  *
  */
 #include <cpu_func.h>
+#include <env.h>
 #include <hang.h>
 #include <init.h>
 #include <spl.h>
board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c +1 -0
index b9f47006d610..8c9e98308765 100644
@@ -7,6 +7,7 @@
 #include <dwc3-uboot.h>
 #include <efi.h>
 #include <efi_loader.h>
+#include <env.h>
 #include <errno.h>
 #include <miiphy.h>
 #include <netdev.h>
board/andestech/ae350/ae350.c +1 -0
index 1d9d4a929c22..9bdd2ab17805 100644
@@ -6,6 +6,7 @@
 
 #include <config.h>
 #include <cpu_func.h>
+#include <env.h>
 #include <flash.h>
 #include <image.h>
 #include <init.h>
board/data_modul/common/common.c +1 -0
index 9e35dc5d6cb1..7d344792937e 100644
@@ -12,6 +12,7 @@
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/mach-imx/iomux-v3.h>
 #include <dm/uclass.h>
+#include <env.h>
 #include <hang.h>
 #include <i2c_eeprom.h>
 #include <image.h>
board/gateworks/gw_ventana/gw_ventana.c +1 -0
index 21a908c20dd5..457d8281a664 100644
@@ -6,6 +6,7 @@
  */
 
 #include <command.h>
+#include <env.h>
 #include <fdt_support.h>
 #include <gsc.h>
 #include <hwconfig.h>
board/ge/b1x5v2/b1x5v2.c +1 -0
index c1aacd1458b1..ddb7304d493a 100644
@@ -17,6 +17,7 @@
 #include <asm/io.h>
 #include <asm/mach-imx/video.h>
 #include <command.h>
+#include <env.h>
 #include <i2c.h>
 #include <input.h>
 #include <ipu_pixfmt.h>
board/keymile/kmcent2/kmcent2.c +1 -0
index 783853d5c6f6..0f43ebfec4d5 100644
@@ -6,6 +6,7 @@
  * Copyright 2013 Freescale Semiconductor, Inc.
  */
 
+#include <env.h>
 #include <event.h>
 #include <asm/cache.h>
 #include <asm/fsl_fdt.h>
board/purism/librem5/librem5.c +1 -0
index 8ca8792fa422..5178ee6929d8 100644
@@ -6,6 +6,7 @@
 
 #include <malloc.h>
 #include <errno.h>
+#include <env.h>
 #include <asm/io.h>
 #include <miiphy.h>
 #include <asm/mach-imx/iomux-v3.h>
board/siemens/iot2050/board.c +1 -0
index d827f728a08c..161210c60a96 100644
@@ -11,6 +11,7 @@
 #include <config.h>
 #include <bootstage.h>
 #include <dm.h>
+#include <env.h>
 #include <fdt_support.h>
 #include <i2c.h>
 #include <led.h>
board/ti/j721e/evm.c +1 -0
index 0525f6e6f979..b1ed29af0018 100644
@@ -8,6 +8,7 @@
  */
 
 #include <efi_loader.h>
+#include <env.h>
 #include <generic-phy.h>
 #include <image.h>
 #include <net.h>
boot/bootmeth_efi.c +1 -0
index 0c9b4c3d59dc..0af23df3a4a5 100644
@@ -15,6 +15,7 @@
 #include <dm.h>
 #include <efi.h>
 #include <efi_loader.h>
+#include <env.h>
 #include <fs.h>
 #include <malloc.h>
 #include <mapmem.h>
boot/bootmeth_pxe.c +1 -0
index 6e5e0f99ea42..faa8d729b151 100644
@@ -13,6 +13,7 @@
 #include <bootmeth.h>
 #include <command.h>
 #include <dm.h>
+#include <env.h>
 #include <extlinux.h>
 #include <fs.h>
 #include <log.h>
cmd/pxe.c +1 -0
index 0f26b3b42197..e82247af6c07 100644
@@ -5,6 +5,7 @@
  */
 
 #include <command.h>
+#include <env.h>
 #include <fs.h>
 #include <net.h>
 #include <net6.h>
drivers/net/pfe_eth/pfe_firmware.c +1 -0
index da4f2ca42a5b..b821fb17a1d6 100644
@@ -12,6 +12,7 @@
 
 #include <dm.h>
 #include <dm/device-internal.h>
+#include <env.h>
 #include <image.h>
 #include <log.h>
 #include <malloc.h>
lib/efi_loader/efi_bootmgr.c +1 -0
index c0df5cb9acd9..298149bcc332 100644
@@ -12,6 +12,7 @@
 #include <charset.h>
 #include <dm.h>
 #include <efi.h>
+#include <env.h>
 #include <log.h>
 #include <malloc.h>
 #include <net.h>
lib/efi_loader/efi_net.c +1 -0
index b3291b4f1d52..9db738ead9dd 100644
@@ -18,6 +18,7 @@
 #define LOG_CATEGORY LOGC_EFI
 
 #include <efi_loader.h>
+#include <env.h>
 #include <dm.h>
 #include <linux/sizes.h>
 #include <malloc.h>
net/lwip/dhcp.c +1 -0
index 92bd7067a7fb..043d2ab6e946 100644
@@ -3,6 +3,7 @@
 
 #include <command.h>
 #include <console.h>
+#include <env.h>
 #include <log.h>
 #include <dm/device.h>
 #include <linux/delay.h>
net/lwip/dns.c +1 -0
index 19172ac959ac..6862869d9e30 100644
@@ -3,6 +3,7 @@
 
 #include <command.h>
 #include <console.h>
+#include <env.h>
 #include <lwip/dns.h>
 #include <lwip/timeouts.h>
 #include <net.h>
net/lwip/net-lwip.c +1 -0
index f05c4cd3f64f..abc52b32049c 100644
@@ -3,6 +3,7 @@
 /* Copyright (C) 2024 Linaro Ltd. */
 
 #include <command.h>
+#include <env.h>
 #include <dm/device.h>
 #include <dm/uclass.h>
 #include <hexdump.h>
net/lwip/tftp.c +1 -0
index 4f9b2049187c..56d27f821212 100644
@@ -6,6 +6,7 @@
 #include <display_options.h>
 #include <dm/device.h>
 #include <efi_loader.h>
+#include <env.h>
 #include <image.h>
 #include <linux/delay.h>
 #include <lwip/apps/tftp_client.h>
net/lwip/wget.c +1 -0
index a3b82908877f..46c16edcc440 100644
@@ -5,6 +5,7 @@
 #include <console.h>
 #include <display_options.h>
 #include <efi_loader.h>
+#include <env.h>
 #include <image.h>
 #include <lwip/apps/http_client.h>
 #include "lwip/altcp_tls.h"
test/dm/dsa.c +1 -0
index 9a31ae39d952..46e48741fbaa 100644
@@ -3,6 +3,7 @@
  * Copyright 2020-2021 NXP
  */
 
+#include <env.h>
 #include <net/dsa.h>
 #include <dm/test.h>
 #include <test/ut.h>
Signature · 1 line
2.43.0
Reviewed-by on v3 21/22
#31 lore raw

Re: [PATCH v3 21/22] global: Avoid indirect inclusion of <env.h> from <net.h>

Quoted 45 lines · Tom Rini

Now that env_get_ip() has been removed, the include file <net.h> does not need anything from <env.h>. Furthermore, include/env.h itself includes other headers which can lead to longer indirect inclusion paths. To prepare to remove <env.h> from <net.h> fix all of the remaining places which had relied on this indirect inclusion to instead include <env.h> directly.

---
Changes in v3:
- New patch

Cc "Huan 'Kitty' Wang" <[email protected]>
Cc "Ying-Chun Liu (PaulLiu)" <[email protected]>
Cc Angus Ainslie <[email protected]> (supporter:PURISM LIBREM5 PHONE)
Cc Heinrich Schuchardt <[email protected]>
Cc Ian Ray <[email protected]>
Cc Ilias Apalodimas <[email protected]>
Cc Jan Kiszka <[email protected]>
Cc Jerome Forissier <[email protected]>
Cc Joe Hershberger <[email protected]>
Cc Le Jin <[email protected]>
Cc Martyn Welch <[email protected]>
Cc Niel Fourie <[email protected]>
Cc Ramon Fried <[email protected]>
Cc Rick Chen <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tim Harvey <[email protected]>
Cc Wolfgang Wallner <[email protected]>
---
 board/BuR/brppt2/board.c                            | 1 +
 board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c | 1 +
 board/andestech/ae350/ae350.c                       | 1 +
 board/data_modul/common/common.c                    | 1 +
 board/gateworks/gw_ventana/gw_ventana.c             | 1 +
 board/ge/b1x5v2/b1x5v2.c                            | 1 +
 board/keymile/kmcent2/kmcent2.c                     | 1 +
 board/purism/librem5/librem5.c                      | 1 +
 board/siemens/iot2050/board.c                       | 1 +
 board/ti/j721e/evm.c                                | 1 +
 boot/bootmeth_efi.c                                 | 1 +
 boot/bootmeth_pxe.c                                 | 1 +
 cmd/pxe.c                                           | 1 +
 drivers/net/pfe_eth/pfe_firmware.c                  | 1 +
 lib/efi_loader/efi_bootmgr.c                        | 1 +
Quoted 8 lines
 lib/efi_loader/efi_net.c                            | 1 +
 net/lwip/dhcp.c                                     | 1 +
 net/lwip/dns.c                                      | 1 +
 net/lwip/net-lwip.c                                 | 1 +
 net/lwip/tftp.c                                     | 1 +
 net/lwip/wget.c                                     | 1 +
 test/dm/dsa.c                                       | 1 +
 22 files changed, 22 insertions(+)
Reviewed-by on v3 21/22
#32 lore raw

Re: [PATCH v3 21/22] global: Avoid indirect inclusion of <env.h> from <net.h>

In reply to Tom Rini
Quoted 29 lines · Tom Rini

Now that env_get_ip() has been removed, the include file <net.h> does not need anything from <env.h>. Furthermore, include/env.h itself includes other headers which can lead to longer indirect inclusion paths. To prepare to remove <env.h> from <net.h> fix all of the remaining places which had relied on this indirect inclusion to instead include <env.h> directly.

---
Changes in v3:
- New patch

Cc "Huan 'Kitty' Wang" <[email protected]>
Cc "Ying-Chun Liu (PaulLiu)" <[email protected]>
Cc Angus Ainslie <[email protected]> (supporter:PURISM LIBREM5 PHONE)
Cc Heinrich Schuchardt <[email protected]>
Cc Ian Ray <[email protected]>
Cc Ilias Apalodimas <[email protected]>
Cc Jan Kiszka <[email protected]>
Cc Jerome Forissier <[email protected]>
Cc Joe Hershberger <[email protected]>
Cc Le Jin <[email protected]>
Cc Martyn Welch <[email protected]>
Cc Niel Fourie <[email protected]>
Cc Ramon Fried <[email protected]>
Cc Rick Chen <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tim Harvey <[email protected]>
Cc Wolfgang Wallner <[email protected]>
Quoted 7 lines
---
  board/BuR/brppt2/board.c                            | 1 +
  board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c | 1 +
  board/andestech/ae350/ae350.c                       | 1 +
  board/data_modul/common/common.c                    | 1 +
  board/gateworks/gw_ventana/gw_ventana.c             | 1 +
  board/ge/b1x5v2/b1x5v2.c                            | 1 +

For b1x5v2.c:

Quoted 282 lines
  board/keymile/kmcent2/kmcent2.c                     | 1 +
  board/purism/librem5/librem5.c                      | 1 +
  board/siemens/iot2050/board.c                       | 1 +
  board/ti/j721e/evm.c                                | 1 +
  boot/bootmeth_efi.c                                 | 1 +
  boot/bootmeth_pxe.c                                 | 1 +
  cmd/pxe.c                                           | 1 +
  drivers/net/pfe_eth/pfe_firmware.c                  | 1 +
  lib/efi_loader/efi_bootmgr.c                        | 1 +
  lib/efi_loader/efi_net.c                            | 1 +
  net/lwip/dhcp.c                                     | 1 +
  net/lwip/dns.c                                      | 1 +
  net/lwip/net-lwip.c                                 | 1 +
  net/lwip/tftp.c                                     | 1 +
  net/lwip/wget.c                                     | 1 +
  test/dm/dsa.c                                       | 1 +
  22 files changed, 22 insertions(+)
board/BuR/brppt2/board.c +1 -0
index c0a163251b46..de206bdf1bc4 100644
@@ -7,6 +7,7 @@
   *
   */
  #include <cpu_func.h>
+#include <env.h>
  #include <hang.h>
  #include <init.h>
  #include <spl.h>
board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c +1 -0
index b9f47006d610..8c9e98308765 100644
@@ -7,6 +7,7 @@
  #include <dwc3-uboot.h>
  #include <efi.h>
  #include <efi_loader.h>
+#include <env.h>
  #include <errno.h>
  #include <miiphy.h>
  #include <netdev.h>
board/andestech/ae350/ae350.c +1 -0
index 1d9d4a929c22..9bdd2ab17805 100644
@@ -6,6 +6,7 @@
 
  #include <config.h>
  #include <cpu_func.h>
+#include <env.h>
  #include <flash.h>
  #include <image.h>
  #include <init.h>
board/data_modul/common/common.c +1 -0
index 9e35dc5d6cb1..7d344792937e 100644
@@ -12,6 +12,7 @@
  #include <asm/mach-imx/boot_mode.h>
  #include <asm/mach-imx/iomux-v3.h>
  #include <dm/uclass.h>
+#include <env.h>
  #include <hang.h>
  #include <i2c_eeprom.h>
  #include <image.h>
board/gateworks/gw_ventana/gw_ventana.c +1 -0
index 21a908c20dd5..457d8281a664 100644
@@ -6,6 +6,7 @@
   */
 
  #include <command.h>
+#include <env.h>
  #include <fdt_support.h>
  #include <gsc.h>
  #include <hwconfig.h>
board/ge/b1x5v2/b1x5v2.c +1 -0
index c1aacd1458b1..ddb7304d493a 100644
@@ -17,6 +17,7 @@
  #include <asm/io.h>
  #include <asm/mach-imx/video.h>
  #include <command.h>
+#include <env.h>
  #include <i2c.h>
  #include <input.h>
  #include <ipu_pixfmt.h>
board/keymile/kmcent2/kmcent2.c +1 -0
index 783853d5c6f6..0f43ebfec4d5 100644
@@ -6,6 +6,7 @@
   * Copyright 2013 Freescale Semiconductor, Inc.
   */
 
+#include <env.h>
  #include <event.h>
  #include <asm/cache.h>
  #include <asm/fsl_fdt.h>
board/purism/librem5/librem5.c +1 -0
index 8ca8792fa422..5178ee6929d8 100644
@@ -6,6 +6,7 @@
 
  #include <malloc.h>
  #include <errno.h>
+#include <env.h>
  #include <asm/io.h>
  #include <miiphy.h>
  #include <asm/mach-imx/iomux-v3.h>
board/siemens/iot2050/board.c +1 -0
index d827f728a08c..161210c60a96 100644
@@ -11,6 +11,7 @@
  #include <config.h>
  #include <bootstage.h>
  #include <dm.h>
+#include <env.h>
  #include <fdt_support.h>
  #include <i2c.h>
  #include <led.h>
board/ti/j721e/evm.c +1 -0
index 0525f6e6f979..b1ed29af0018 100644
@@ -8,6 +8,7 @@
   */
 
  #include <efi_loader.h>
+#include <env.h>
  #include <generic-phy.h>
  #include <image.h>
  #include <net.h>
boot/bootmeth_efi.c +1 -0
index 0c9b4c3d59dc..0af23df3a4a5 100644
@@ -15,6 +15,7 @@
  #include <dm.h>
  #include <efi.h>
  #include <efi_loader.h>
+#include <env.h>
  #include <fs.h>
  #include <malloc.h>
  #include <mapmem.h>
boot/bootmeth_pxe.c +1 -0
index 6e5e0f99ea42..faa8d729b151 100644
@@ -13,6 +13,7 @@
  #include <bootmeth.h>
  #include <command.h>
  #include <dm.h>
+#include <env.h>
  #include <extlinux.h>
  #include <fs.h>
  #include <log.h>
cmd/pxe.c +1 -0
index 0f26b3b42197..e82247af6c07 100644
@@ -5,6 +5,7 @@
   */
 
  #include <command.h>
+#include <env.h>
  #include <fs.h>
  #include <net.h>
  #include <net6.h>
drivers/net/pfe_eth/pfe_firmware.c +1 -0
index da4f2ca42a5b..b821fb17a1d6 100644
@@ -12,6 +12,7 @@
 
  #include <dm.h>
  #include <dm/device-internal.h>
+#include <env.h>
  #include <image.h>
  #include <log.h>
  #include <malloc.h>
lib/efi_loader/efi_bootmgr.c +1 -0
index c0df5cb9acd9..298149bcc332 100644
@@ -12,6 +12,7 @@
  #include <charset.h>
  #include <dm.h>
  #include <efi.h>
+#include <env.h>
  #include <log.h>
  #include <malloc.h>
  #include <net.h>
lib/efi_loader/efi_net.c +1 -0
index b3291b4f1d52..9db738ead9dd 100644
@@ -18,6 +18,7 @@
  #define LOG_CATEGORY LOGC_EFI
 
  #include <efi_loader.h>
+#include <env.h>
  #include <dm.h>
  #include <linux/sizes.h>
  #include <malloc.h>
net/lwip/dhcp.c +1 -0
index 92bd7067a7fb..043d2ab6e946 100644
@@ -3,6 +3,7 @@
 
  #include <command.h>
  #include <console.h>
+#include <env.h>
  #include <log.h>
  #include <dm/device.h>
  #include <linux/delay.h>
net/lwip/dns.c +1 -0
index 19172ac959ac..6862869d9e30 100644
@@ -3,6 +3,7 @@
 
  #include <command.h>
  #include <console.h>
+#include <env.h>
  #include <lwip/dns.h>
  #include <lwip/timeouts.h>
  #include <net.h>
net/lwip/net-lwip.c +1 -0
index f05c4cd3f64f..abc52b32049c 100644
@@ -3,6 +3,7 @@
  /* Copyright (C) 2024 Linaro Ltd. */
 
  #include <command.h>
+#include <env.h>
  #include <dm/device.h>
  #include <dm/uclass.h>
  #include <hexdump.h>
net/lwip/tftp.c +1 -0
index 4f9b2049187c..56d27f821212 100644
@@ -6,6 +6,7 @@
  #include <display_options.h>
  #include <dm/device.h>
  #include <efi_loader.h>
+#include <env.h>
  #include <image.h>
  #include <linux/delay.h>
  #include <lwip/apps/tftp_client.h>
net/lwip/wget.c +1 -0
index a3b82908877f..46c16edcc440 100644
@@ -5,6 +5,7 @@
  #include <console.h>
  #include <display_options.h>
  #include <efi_loader.h>
+#include <env.h>
  #include <image.h>
  #include <lwip/apps/http_client.h>
  #include "lwip/altcp_tls.h"
test/dm/dsa.c +1 -0
index 9a31ae39d952..46e48741fbaa 100644
@@ -3,6 +3,7 @@
   * Copyright 2020-2021 NXP
   */
 
+#include <env.h>
  #include <net/dsa.h>
  #include <dm/test.h>
  #include <test/ut.h>
Reviewed-by on v3 21/22
#33 lore raw

Re: [PATCH v3 21/22] global: Avoid indirect inclusion of <env.h> from <net.h>

In reply to Tom Rini
Quoted 33 lines

From: Tom Rini <[email protected]>
Sent: Friday, May 16, 2025 1:31
Subject: [PATCH v3 21/22] global: Avoid indirect inclusion of <env.h> from <net.h>

Now that env_get_ip() has been removed, the include file <net.h> does not need anything from <env.h>. Furthermore, include/env.h itself includes other headers which can lead to longer indirect inclusion paths. To prepare to remove <env.h> from <net.h> fix all of the remaining places which had relied on this indirect inclusion to instead include <env.h> directly.

---
Changes in v3:
- New patch

Cc "Huan 'Kitty' Wang" <[email protected]>
Cc "Ying-Chun Liu (PaulLiu)" <[email protected]>
Cc Angus Ainslie <[email protected]> (supporter:PURISM LIBREM5 PHONE)
Cc Heinrich Schuchardt <[email protected]>
Cc Ian Ray <[email protected]>
Cc Ilias Apalodimas <[email protected]>
Cc Jan Kiszka <[email protected]>
Cc Jerome Forissier <[email protected]>
Cc Joe Hershberger <[email protected]>
Cc Le Jin <[email protected]>
Cc Martyn Welch <[email protected]>
Cc Niel Fourie <[email protected]>
Cc Ramon Fried <[email protected]>
Cc Rick Chen <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tim Harvey <[email protected]>
Cc Wolfgang Wallner <[email protected]>
Quoted 2 lines

---
 board/BuR/brppt2/board.c                            | 1 +

For brppt2/board.c:

Quoted 35 lines

 board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c | 1 + board/andestech/ae350/ae350.c                       | 1 + board/data_modul/common/common.c                    | 1 + board/gateworks/gw_ventana/gw_ventana.c             | 1 + board/ge/b1x5v2/b1x5v2.c                            | 1 + board/keymile/kmcent2/kmcent2.c                     | 1 + board/purism/librem5/librem5.c                      | 1 + board/siemens/iot2050/board.c                       | 1 +

 board/ti/j721e/evm.c                                | 1 +
 boot/bootmeth_efi.c                                 | 1 +
 boot/bootmeth_pxe.c                                 | 1 +

 cmd/pxe.c                                           | 1 + drivers/net/pfe_eth/pfe_firmware.c                  | 1 + lib/efi_loader/efi_bootmgr.c                        | 1 + lib/efi_loader/efi_net.c                            | 1 + net/lwip/dhcp.c                                     | 1 + net/lwip/dns.c                                      | 1 + net/lwip/net-lwip.c                                 | 1 + net/lwip/tftp.c                                     | 1 + net/lwip/wget.c                                     | 1 + test/dm/dsa.c                                       | 1 +

 22 files changed, 22 insertions(+)
board/BuR/brppt2/board.c +1 -0
index c0a163251b46..de206bdf1bc4 100644
@@ -7,6 +7,7 @@
   *
   */
  #include <cpu_func.h>
+#include <env.h>
  #include <hang.h>
  #include <init.h>
  #include <spl.h>
Acked-by on v3 21/22
#34 lore raw

Re: [PATCH v3 21/22] global: Avoid indirect inclusion of <env.h> from <net.h>

In reply to Tom Rini
Quoted 8 lines · Tom Rini

Now that env_get_ip() has been removed, the include file <net.h> does not need anything from <env.h>. Furthermore, include/env.h itself includes other headers which can lead to longer indirect inclusion paths. To prepare to remove <env.h> from <net.h> fix all of the remaining places which had relied on this indirect inclusion to instead include <env.h> directly.

Quoted 314 lines

---
Changes in v3:
- New patch

Cc "Huan 'Kitty' Wang" <[email protected]>
Cc "Ying-Chun Liu (PaulLiu)" <[email protected]>
Cc Angus Ainslie <[email protected]> (supporter:PURISM LIBREM5 PHONE)
Cc Heinrich Schuchardt <[email protected]>
Cc Ian Ray <[email protected]>
Cc Ilias Apalodimas <[email protected]>
Cc Jan Kiszka <[email protected]>
Cc Jerome Forissier <[email protected]>
Cc Joe Hershberger <[email protected]>
Cc Le Jin <[email protected]>
Cc Martyn Welch <[email protected]>
Cc Niel Fourie <[email protected]>
Cc Ramon Fried <[email protected]>
Cc Rick Chen <[email protected]>
Cc Simon Glass <[email protected]>
Cc Tim Harvey <[email protected]>
Cc Wolfgang Wallner <[email protected]>
---
 board/BuR/brppt2/board.c                            | 1 +
 board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c | 1 +
 board/andestech/ae350/ae350.c                       | 1 +
 board/data_modul/common/common.c                    | 1 +
 board/gateworks/gw_ventana/gw_ventana.c             | 1 +
 board/ge/b1x5v2/b1x5v2.c                            | 1 +
 board/keymile/kmcent2/kmcent2.c                     | 1 +
 board/purism/librem5/librem5.c                      | 1 +
 board/siemens/iot2050/board.c                       | 1 +
 board/ti/j721e/evm.c                                | 1 +
 boot/bootmeth_efi.c                                 | 1 +
 boot/bootmeth_pxe.c                                 | 1 +
 cmd/pxe.c                                           | 1 +
 drivers/net/pfe_eth/pfe_firmware.c                  | 1 +
 lib/efi_loader/efi_bootmgr.c                        | 1 +
 lib/efi_loader/efi_net.c                            | 1 +
 net/lwip/dhcp.c                                     | 1 +
 net/lwip/dns.c                                      | 1 +
 net/lwip/net-lwip.c                                 | 1 +
 net/lwip/tftp.c                                     | 1 +
 net/lwip/wget.c                                     | 1 +
 test/dm/dsa.c                                       | 1 +
 22 files changed, 22 insertions(+)
board/BuR/brppt2/board.c +1 -0
index c0a163251b46..de206bdf1bc4 100644
@@ -7,6 +7,7 @@
  *
  */
 #include <cpu_func.h>
+#include <env.h>
 #include <hang.h>
 #include <init.h>
 #include <spl.h>
board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c +1 -0
index b9f47006d610..8c9e98308765 100644
@@ -7,6 +7,7 @@
 #include <dwc3-uboot.h>
 #include <efi.h>
 #include <efi_loader.h>
+#include <env.h>
 #include <errno.h>
 #include <miiphy.h>
 #include <netdev.h>
board/andestech/ae350/ae350.c +1 -0
index 1d9d4a929c22..9bdd2ab17805 100644
@@ -6,6 +6,7 @@
 
 #include <config.h>
 #include <cpu_func.h>
+#include <env.h>
 #include <flash.h>
 #include <image.h>
 #include <init.h>
board/data_modul/common/common.c +1 -0
index 9e35dc5d6cb1..7d344792937e 100644
@@ -12,6 +12,7 @@
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/mach-imx/iomux-v3.h>
 #include <dm/uclass.h>
+#include <env.h>
 #include <hang.h>
 #include <i2c_eeprom.h>
 #include <image.h>
board/gateworks/gw_ventana/gw_ventana.c +1 -0
index 21a908c20dd5..457d8281a664 100644
@@ -6,6 +6,7 @@
  */
 
 #include <command.h>
+#include <env.h>
 #include <fdt_support.h>
 #include <gsc.h>
 #include <hwconfig.h>
board/ge/b1x5v2/b1x5v2.c +1 -0
index c1aacd1458b1..ddb7304d493a 100644
@@ -17,6 +17,7 @@
 #include <asm/io.h>
 #include <asm/mach-imx/video.h>
 #include <command.h>
+#include <env.h>
 #include <i2c.h>
 #include <input.h>
 #include <ipu_pixfmt.h>
board/keymile/kmcent2/kmcent2.c +1 -0
index 783853d5c6f6..0f43ebfec4d5 100644
@@ -6,6 +6,7 @@
  * Copyright 2013 Freescale Semiconductor, Inc.
  */
 
+#include <env.h>
 #include <event.h>
 #include <asm/cache.h>
 #include <asm/fsl_fdt.h>
board/purism/librem5/librem5.c +1 -0
index 8ca8792fa422..5178ee6929d8 100644
@@ -6,6 +6,7 @@
 
 #include <malloc.h>
 #include <errno.h>
+#include <env.h>
 #include <asm/io.h>
 #include <miiphy.h>
 #include <asm/mach-imx/iomux-v3.h>
board/siemens/iot2050/board.c +1 -0
index d827f728a08c..161210c60a96 100644
@@ -11,6 +11,7 @@
 #include <config.h>
 #include <bootstage.h>
 #include <dm.h>
+#include <env.h>
 #include <fdt_support.h>
 #include <i2c.h>
 #include <led.h>
board/ti/j721e/evm.c +1 -0
index 0525f6e6f979..b1ed29af0018 100644
@@ -8,6 +8,7 @@
  */
 
 #include <efi_loader.h>
+#include <env.h>
 #include <generic-phy.h>
 #include <image.h>
 #include <net.h>
boot/bootmeth_efi.c +1 -0
index 0c9b4c3d59dc..0af23df3a4a5 100644
@@ -15,6 +15,7 @@
 #include <dm.h>
 #include <efi.h>
 #include <efi_loader.h>
+#include <env.h>
 #include <fs.h>
 #include <malloc.h>
 #include <mapmem.h>
boot/bootmeth_pxe.c +1 -0
index 6e5e0f99ea42..faa8d729b151 100644
@@ -13,6 +13,7 @@
 #include <bootmeth.h>
 #include <command.h>
 #include <dm.h>
+#include <env.h>
 #include <extlinux.h>
 #include <fs.h>
 #include <log.h>
cmd/pxe.c +1 -0
index 0f26b3b42197..e82247af6c07 100644
@@ -5,6 +5,7 @@
  */
 
 #include <command.h>
+#include <env.h>
 #include <fs.h>
 #include <net.h>
 #include <net6.h>
drivers/net/pfe_eth/pfe_firmware.c +1 -0
index da4f2ca42a5b..b821fb17a1d6 100644
@@ -12,6 +12,7 @@
 
 #include <dm.h>
 #include <dm/device-internal.h>
+#include <env.h>
 #include <image.h>
 #include <log.h>
 #include <malloc.h>
lib/efi_loader/efi_bootmgr.c +1 -0
index c0df5cb9acd9..298149bcc332 100644
@@ -12,6 +12,7 @@
 #include <charset.h>
 #include <dm.h>
 #include <efi.h>
+#include <env.h>
 #include <log.h>
 #include <malloc.h>
 #include <net.h>
lib/efi_loader/efi_net.c +1 -0
index b3291b4f1d52..9db738ead9dd 100644
@@ -18,6 +18,7 @@
 #define LOG_CATEGORY LOGC_EFI
 
 #include <efi_loader.h>
+#include <env.h>
 #include <dm.h>
 #include <linux/sizes.h>
 #include <malloc.h>
net/lwip/dhcp.c +1 -0
index 92bd7067a7fb..043d2ab6e946 100644
@@ -3,6 +3,7 @@
 
 #include <command.h>
 #include <console.h>
+#include <env.h>
 #include <log.h>
 #include <dm/device.h>
 #include <linux/delay.h>
net/lwip/dns.c +1 -0
index 19172ac959ac..6862869d9e30 100644
@@ -3,6 +3,7 @@
 
 #include <command.h>
 #include <console.h>
+#include <env.h>
 #include <lwip/dns.h>
 #include <lwip/timeouts.h>
 #include <net.h>
net/lwip/net-lwip.c +1 -0
index f05c4cd3f64f..abc52b32049c 100644
@@ -3,6 +3,7 @@
 /* Copyright (C) 2024 Linaro Ltd. */
 
 #include <command.h>
+#include <env.h>
 #include <dm/device.h>
 #include <dm/uclass.h>
 #include <hexdump.h>
net/lwip/tftp.c +1 -0
index 4f9b2049187c..56d27f821212 100644
@@ -6,6 +6,7 @@
 #include <display_options.h>
 #include <dm/device.h>
 #include <efi_loader.h>
+#include <env.h>
 #include <image.h>
 #include <linux/delay.h>
 #include <lwip/apps/tftp_client.h>
net/lwip/wget.c +1 -0
index a3b82908877f..46c16edcc440 100644
@@ -5,6 +5,7 @@
 #include <console.h>
 #include <display_options.h>
 #include <efi_loader.h>
+#include <env.h>
 #include <image.h>
 #include <lwip/apps/http_client.h>
 #include "lwip/altcp_tls.h"
test/dm/dsa.c +1 -1
index 9a31ae39d952..46e48741fbaa 100644
@@ -3,6 +3,7 @@
  * Copyright 2020-2021 NXP
  */
 
+#include <env.h>
 #include <net/dsa.h>
 #include <dm/test.h>
 #include <test/ut.h>
--

2.43.0

author
#35 lore raw

PATCH v3 22/22 include/net.h: Drop <env.h>

In reply to Tom Rini

Now that all of the cases of code that relied on <net.h> to provide <env.h> (or one of the headers that it includes, and so forth) have been fixed, we can drop the include from here.

---
Changes in v3:
- New patch

---
 include/net-common.h | 1 -
 1 file changed, 1 deletion(-)
include/net-common.h +0 -1
index 2ca565fe4edc..9e82b280df2c 100644
@@ -5,7 +5,6 @@
 
 #include <asm/cache.h>
 #include <command.h>
-#include <env.h>
 #include <hexdump.h>
 #include <linux/if_ether.h>
 #include <linux/sizes.h>
Signature · 1 line
2.43.0
author
#36 lore raw

Re: [PATCH v3 00/22] Remove <env.h> from <net.h>

In reply to Tom Rini
Quoted 19 lines · Tom Rini

Hey all,

This is a v3 of Simon's series[1] and depends on the series[2] I posted the other day that removes <env.h> from <command.h>. With this series done, I believe we've tackled all of the current cases of headers which include <env.h> without directly needing it. Much of this series is in fact Simon's v2 with the main differneces being:
- Removing <env.h> from <net.h> at the end
- Removing env_to_ip() given how little it's used rather than shuffling around where it's declared and un-inline'ing it. For a rarely used helper, this ends up being cleaner I think. Especially looking at some of the users (which called env_get repeatedly). If there's strong opinion here about using the other method[3] we can do that instead.
- Setting aside for now how to handle CMD_ELF=y and NO_NET=y because today it's actually fine as we unconditionally build lib/net_utils.c where string_to_ip() is defined. I'm unsure if a further series is warranted here or not. We rely on link-time optimization to keep code readable too.

Quoted 1 line

[...]

Applied to u-boot/next, thanks!

[01/22] net: Remove env_get_ip helper() function

        commit: 05f6f6e8c76c68a36125ec7a6af911ee9418bc99
[02/22] congatec: Include env.h to permit reading the environment
        commit: 67a7633e04d71c61018d857f27d18e05acc5b844
[03/22] dhelectronics: Include env.h to permit reading the environment
        commit: 09c9957e8808b6a3513450c802d43c9410a14368
[04/22] imx8ulp_evk: Include env.h to permit reading the environment
        commit: 84a1c99055166857efabe55277f01341404e8dda
[05/22] net: Include string.h in net-legacy.h
        commit: 0b9450989c195430521b01d97ba79a9b644119a6
[06/22] venice: Include env.h to permit reading the environment
        commit: 600145a8e10418d26f43045f9452610e39ce6f38
[07/22] phytec: Include env.h to permit reading the environment
        commit: b4135116116a318113968ce9f8f72c711d09dd28
[08/22] ronetix: Include env.h to permit reading the environment
        commit: 6e898e332b0e7e11ebeb83bdbfcd9e3e1600817a
[09/22] toradex: Include env.h to permit reading the environment
        commit: bcf10f16ea41cd690be59a88d8e7292881d01e56
[10/22] advantech: Include env.h in imx8qm_dmsse20_a1
        commit: 0f8a4a9c4427370c5f20b8ffcbd615fb9658921e
[11/22] tegra: Include env.h to permit reading the environment
        commit: 433e86abea7e8b570ee0ad89842ac806511d1b94
[12/22] synology: Include env.h to permit reading the environment
        commit: f24a197973ad0c5f473401b16a801794f2764678
[13/22] amlogic: Include env.h to permit reading the environment
        commit: 6d9d6ba71ab9391e5fb163634bfb1cc65987cdd4
[14/22] freescale: Include env.h to permit reading the environment
        commit: 2876ff79b257667438ae7a6132d5ce750ec501ac
[15/22] google: Include env.h to permit reading the environment
        commit: 98faae1617b44e53c475adf8552245691e1f05fb
[16/22] liebherr: Include env.h to permit reading the environment
        commit: ea9afef22d49a4ac12484e01fd459e225da790b7
[17/22] technexion: Include env.h to permit reading the environment
        commit: 7b612cfa757a44d1bdee6d087e24e2e5c9d8a868
[18/22] net: Include byteorder in net6.h
        commit: 22d4e22a3d2e8a95c37c0635701daaee8d5a5c6b
[19/22] net: Include env.h in pcap.c
        commit: 85b013e3f43ff4fa50ced6a23ba336813eaf9320
[20/22] net: dc2114x: Include env.h to permit reading the environment
        commit: 183d88cdfc19ea7bd56af69512f0d1425de73e77
[21/22] global: Avoid indirect inclusion of <env.h> from <net.h>
        commit: ae9ff5ae6f579f321a1b695c82453b67ec1bf6db
[22/22] include/net.h: Drop <env.h>
        commit: fe33175c073fe21945b39a4a8c27806cf0154bf3
Signature · 1 line
Tom
author
#37 lore raw
In reply to Tom Rini
Quoted 11 lines · Tom Rini

Hey all,

Given Simon's series at [1] I started looking in to what brings in <env.h> when not strictly required and in turn has some unintended implicit includes. This series takes care of the places where, commonly, <linux/string.h> or <env.h> itself were required along with a few other less common cases. This sets aside for the moment what to do about net-common.h and env_get_ip() as I'm not entirely sure what's best there.

[...]

Applied to u-boot/next, thanks!

[1/5] global: Add <linux/string.h> instead of long indirect include path

      commit: 64307118499db0be83db29cfcbd8860db1e44e37
[2/5] cmd/mem.c, test/cmd/mem_copy.c: Add <compiler.h>
      commit: 55717ca66f10bd8c1c05cd8053fee233d869e7e5
[3/5] gpio: pca953x: Add missing <asm/byteorder.h>
      commit: d0e1ee6590420ec13cfe3fa373679054ac08a184
[4/5] global: Avoid indirect inclusion of <env.h> from <command.h>
      commit: dcb7d927d181b5798c6fd4a1b1650cd821e3b6ed
[5/5] include/command.h: Drop <env.h>
      commit: 1e50f7457fcaaba2caf642132cf4f00f1eba29a9
Signature · 1 line
Tom