Skip to contentSkip to conversation

Audit include list for include/[a-m]*.h

PATCH In review Tom Rini 3 participants 21 messages May 21, 2025 – Jun 3, 2025

Subsystems (11)
lore
Share & tools
lore

Tom Rini

author
#0 lore raw

cover Audit include list for include/[a-m]*.h

Hey all,

Related to my other series I've posted recently on cleaning up some headers, this series here is the result of at least lightly auditing the #includes used in include/[a-m]*.h. This ignores subdirectories, as at least in part I think the top-level includes we've constructed are the most likely places to have some extra transitive include paths. I'm sure there's exceptions and I'll likely audit deeper once this first pass is done. This only gets as far as "include/m*.h" because I didn't want this to get too big. This also sets aside <miiphy.h> and <phy.h>. While miiphy.h does not directly need <phy.h> there are *so* many users and I think I had half of the tree just about not building when I first tried. It might be worth further investigation, but it might just be OK as-is.

Signature · 1 line
Tom
author
#1 lore raw

PATCH 1/17 include/ahci.h: Audit include list

This file does not need <pci.h> but does directly need <linux/types.h>.

---
 include/ahci.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/ahci.h +1 -1
index eb05cc687f64..470cda006de9 100644
@@ -7,7 +7,7 @@
 #ifndef _AHCI_H_
 #define _AHCI_H_
 
-#include <pci.h>
+#include <linux/types.h>
 
 #define AHCI_PCI_BAR		0x24
 #define AHCI_MAX_SG		56 /* hardware max is 64K */
Signature · 1 line
2.43.0
author
#2 lore raw

PATCH 2/17 include/arm_ffa.h: Audit include list

In reply to Tom Rini

This file does not need <linux/printk.h> but does directly need <linux/types.h>.

---
 include/arm_ffa.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/arm_ffa.h +1 -1
index db9b1be995e6..2994d8ee3ae1 100644
@@ -9,7 +9,7 @@
 #ifndef __ARM_FFA_H
 #define __ARM_FFA_H
 
-#include <linux/printk.h>
+#include <linux/types.h>
 
 /*
  * This header is public. It can be used by clients to access
Signature · 1 line
2.43.0
author
#3 lore raw

PATCH 3/17 include/bios_emul.h: Audit include list

In reply to Tom Rini

This file does not need <pc.h> but does directly need <linux/types.h>. Furthermore, arch/x86/lib/bios.c was getting <pci.h> via <bios_emul.h> so add it there.

---
 arch/x86/lib/bios.c | 1 +
 include/bios_emul.h | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/x86/lib/bios.c +1 -0
index de4578666fbd..77a8117d1580 100644
@@ -12,6 +12,7 @@
 #include <bios_emul.h>
 #include <irq_func.h>
 #include <log.h>
+#include <pci.h>
 #include <vesa.h>
 #include <linux/linkage.h>
 #include <asm/cache.h>
include/bios_emul.h +1 -1
index a7e6d73972ce..47a45296cc31 100644
@@ -8,7 +8,7 @@
 
 /* Include the register header directly here */
 #include "../drivers/bios_emulator/include/x86emu/regs.h"
-#include <pci.h>
+#include <linux/types.h>
 
 /****************************************************************************
 REMARKS:
Signature · 1 line
2.43.0
author
#4 lore raw

PATCH 4/17 include/bootflow.h: Audit include list

In reply to Tom Rini

This file does not need <linux/list.h> but does directly need <linux/types.h>.

---
Cc: Simon Glass <[email protected]>

---
 include/bootflow.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/bootflow.h +1 -1
index d408b8c85bd1..5a9ac5ed3b33 100644
@@ -11,7 +11,7 @@
 #include <bootdev.h>
 #include <image.h>
 #include <dm/ofnode_decl.h>
-#include <linux/list.h>
+#include <linux/types.h>
 
 struct bootstd_priv;
 struct expo;
Signature · 1 line
2.43.0
author
#5 lore raw

PATCH 5/17 include/bootstd.h: Audit include list

In reply to Tom Rini

This file does not need <linux/list.h> so remove it.

---
Cc: Simon Glass <[email protected]>

---
 include/bootstd.h | 1 -
 1 file changed, 1 deletion(-)
include/bootstd.h +0 -1
index 2bc464756dd9..f2fb5f55faab 100644
@@ -11,7 +11,6 @@
 
 #include <alist.h>
 #include <dm/ofnode_decl.h>
-#include <linux/list.h>
 #include <linux/types.h>
 
 struct udevice;
Signature · 1 line
2.43.0
author
#6 lore raw

PATCH 6/17 include/cadence-nand.h: Audit include list

In reply to Tom Rini

This file does not need <linux/mtd/mtd.h> but does directly need <linux/types.h>.

---
 include/cadence-nand.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/cadence-nand.h +1 -1
index 27ed217b1ed9..f08dce19cb9f 100644
@@ -12,7 +12,7 @@
 #define _CADENCE_NAND_H_
 #include <clk.h>
 #include <reset.h>
-#include <linux/mtd/mtd.h>
+#include <linux/types.h>
 #include <linux/mtd/rawnand.h>
 
 /*
Signature · 1 line
2.43.0
author
#7 lore raw

PATCH 7/17 include/cbfs.h: Audit include list

In reply to Tom Rini

This file does not need <compiler.h> but does directly need <linux/types.h>.

---
 include/cbfs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/cbfs.h +1 -1
index 2bc5de2297e4..1244dbdba0d1 100644
@@ -6,8 +6,8 @@
 #ifndef __CBFS_H
 #define __CBFS_H
 
-#include <compiler.h>
 #include <linux/compiler.h>
+#include <linux/types.h>
 
 struct cbfs_priv;
 
Signature · 1 line
2.43.0
author
#8 lore raw

PATCH 8/17 include/compiler.h: Audit include list

In reply to Tom Rini

This file does not need <time.h> so remove it.

---
 include/compiler.h | 2 --
 1 file changed, 2 deletions(-)
include/compiler.h +0 -2
index ef7b2cb1f7ea..f2e1e09c5980 100644
@@ -60,8 +60,6 @@
 # define __BIG_ENDIAN BIG_ENDIAN
 #endif
 
-#include <time.h>
-
 typedef uint8_t __u8;
 typedef uint16_t __u16;
 typedef uint32_t __u32;
Signature · 1 line
2.43.0
author
#9 lore raw

PATCH 9/17 include/dfu.h: Audit include list

In reply to Tom Rini

This file does not need a forward declaration of 'struct list_head' as it includes <linux/list.h> so remove it.

---
Cc: Mattijs Korpershoek <[email protected]>

---
 include/dfu.h | 1 -
 1 file changed, 1 deletion(-)
include/dfu.h +0 -1
index 12f9dfcdfcdf..80593a906fd2 100644
@@ -173,7 +173,6 @@ struct dfu_entity {
 	unsigned int inited:1;
 };
 
-struct list_head;
 extern struct list_head dfu_list;
 
 #ifdef CONFIG_SET_DFU_ALT_INFO
Signature · 1 line
2.43.0
Reviewed-by on v1 9/17
#10 lore raw

Re: [PATCH 09/17] include/dfu.h: Audit include list

Hi Tom,

Thank you for the patch.

Quoted 4 lines · Tom Rini

This file does not need a forward declaration of 'struct list_head' as it includes <linux/list.h> so remove it.

Quoted 20 lines

---
Cc: Mattijs Korpershoek <[email protected]>

---
 include/dfu.h | 1 -
 1 file changed, 1 deletion(-)
include/dfu.h +0 -1
index 12f9dfcdfcdf..80593a906fd2 100644
@@ -173,7 +173,6 @@ struct dfu_entity {
 	unsigned int inited:1;
 };
 
-struct list_head;
 extern struct list_head dfu_list;
 
 #ifdef CONFIG_SET_DFU_ALT_INFO
Signature · 1 line
2.43.0
author
#11 lore raw

PATCH 10/17 include/dw_hdmi.h: Audit include list

In reply to Tom Rini

This file does not need <edid.h> so remove it.

---
 include/dw_hdmi.h | 2 --
 1 file changed, 2 deletions(-)
include/dw_hdmi.h +0 -2
index b73518207ef5..fab5aafea194 100644
@@ -9,8 +9,6 @@
 #ifndef _DW_HDMI_H
 #define _DW_HDMI_H
 
-#include <edid.h>
-
 #define HDMI_EDID_BLOCK_SIZE            128
 
 /* Identification Registers */
Signature · 1 line
2.43.0
author
#12 lore raw

PATCH 11/17 include/dwmmc.h: Audit include list

In reply to Tom Rini

This file does not need <asm/cache.h> so remove it.

---
 include/dwmmc.h | 1 -
 1 file changed, 1 deletion(-)
include/dwmmc.h +0 -1
index 6edb9e1a59c5..87ca127cd6cd 100644
@@ -7,7 +7,6 @@
 #ifndef __DWMMC_HW_H
 #define __DWMMC_HW_H
 
-#include <asm/cache.h>
 #include <asm/io.h>
 #include <mmc.h>
 #include <linux/bitops.h>
Signature · 1 line
2.43.0
author
#13 lore raw

PATCH 12/17 include/efi_loader.h, include/efi_tcg2.h: Audit include list

In reply to Tom Rini

In include/efi_loader.h we do not directly need <log.h>, <part_efi.h>, <pe.h> nor <linux/oid_registry.h> so remove them. In include/efi_tcg2.h we make use of <part_efi.h> but did not include it, so add it directly.

---
Cc: Heinrich Schuchardt <[email protected]>
Cc: Ilias Apalodimas <[email protected]>

---
 include/efi_loader.h | 4 ----
 include/efi_tcg2.h   | 1 +
 2 files changed, 1 insertion(+), 4 deletions(-)
include/efi_loader.h +0 -4
index 84e8cfe320e2..f3c85ae8d663 100644
@@ -10,15 +10,11 @@
 
 #include <blk.h>
 #include <event.h>
-#include <log.h>
-#include <part_efi.h>
 #include <efi_api.h>
 #include <image.h>
-#include <pe.h>
 #include <setjmp.h>
 #include <linux/list.h>
 #include <linux/sizes.h>
-#include <linux/oid_registry.h>
 
 struct blk_desc;
 struct bootflow;
include/efi_tcg2.h +1 -0
index 7ed88809913b..34a3d4a04346 100644
@@ -17,6 +17,7 @@
 #define _EFI_TCG2_PROTOCOL_H_
 
 #include <efi_api.h>
+#include <part_efi.h>
 #include <tpm-v2.h>
 #include <tpm_tcg2.h>
 
Signature · 1 line
2.43.0
Reviewed-by Tested-by on v1 12/17
#14 lore raw

Re: [PATCH 12/17] include/efi_loader.h, include/efi_tcg2.h: Audit include list

Quoted 47 lines · Tom Rini

In include/efi_loader.h we do not directly need <log.h>, <part_efi.h>, <pe.h> nor <linux/oid_registry.h> so remove them. In include/efi_tcg2.h we make use of <part_efi.h> but did not include it, so add it directly.

---
Cc: Heinrich Schuchardt <[email protected]>
Cc: Ilias Apalodimas <[email protected]>

---
 include/efi_loader.h | 4 ----
 include/efi_tcg2.h   | 1 +
 2 files changed, 1 insertion(+), 4 deletions(-)
include/efi_loader.h +0 -4
index 84e8cfe320e2..f3c85ae8d663 100644
@@ -10,15 +10,11 @@
 
 #include <blk.h>
 #include <event.h>
-#include <log.h>
-#include <part_efi.h>
 #include <efi_api.h>
 #include <image.h>
-#include <pe.h>
 #include <setjmp.h>
 #include <linux/list.h>
 #include <linux/sizes.h>
-#include <linux/oid_registry.h>
 
 struct blk_desc;
 struct bootflow;
include/efi_tcg2.h +1 -1
index 7ed88809913b..34a3d4a04346 100644
@@ -17,6 +17,7 @@
 #define _EFI_TCG2_PROTOCOL_H_
 
 #include <efi_api.h>
+#include <part_efi.h>
 #include <tpm-v2.h>
 #include <tpm_tcg2.h>
 
--
Quoted 2 lines

2.43.0

author
#15 lore raw

PATCH 13/17 include/fat.h: Audit include list

In reply to Tom Rini

This file does not need <asm/cache.h> so remove it. However the file common/spl/spl_fat.c does need it, so add it there.

---
 common/spl/spl_fat.c | 1 +
 include/fat.h        | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)
common/spl/spl_fat.c +1 -0
index f426a068ff96..8b7cafa7291e 100644
@@ -16,6 +16,7 @@
 #include <errno.h>
 #include <image.h>
 #include <linux/libfdt.h>
+#include <asm/cache.h>
 
 static int fat_registered;
 
include/fat.h +0 -1
index ca97880de12d..bdf430f70675 100644
@@ -11,7 +11,6 @@
 
 #include <fs.h>
 #include <asm/byteorder.h>
-#include <asm/cache.h>
 
 struct disk_partition;
 
Signature · 1 line
2.43.0
author
#16 lore raw

PATCH 14/17 include/ide.h: Cleanup usage

In reply to Tom Rini

At this point in time, <ide.h> provides the IDE_BUS macro and the function prototype for ide_set_reset, which is used with IDE_RESET. The only files which should include this header are the ones that either use that macro or that function. Remove <blk.h> from <ide.h> and remove <ide.h> from places which do not need it.

---
 board/freescale/m5253demo/m5253demo.c | 1 +
 board/imgtec/malta/malta.c            | 1 -
 cmd/ide.c                             | 1 -
 common/board_r.c                      | 1 -
 disk/part.c                           | 1 -
 disk/part_amiga.c                     | 1 -
 disk/part_dos.c                       | 1 -
 disk/part_efi.c                       | 1 -
 disk/part_mac.c                       | 1 -
 include/ide.h                         | 2 --
 include/part.h                        | 1 -
 lib/efi_loader/efi_device_path.c      | 1 +
 12 files changed, 2 insertions(+), 11 deletions(-)
board/freescale/m5253demo/m5253demo.c +1 -0
index 446a79e67232..50c5320b55cb 100644
@@ -93,6 +93,7 @@ int testdram(void)
 
 #ifdef CONFIG_IDE
 #include <ata.h>
+#include <ide.h>
 void ide_set_reset(int idereset)
 {
 	atac_t *ata = (atac_t *) CONFIG_SYS_ATA_BASE_ADDR;
board/imgtec/malta/malta.c +0 -1
index 4a72ab5cecad..0ffa964178f0 100644
@@ -6,7 +6,6 @@
 
 #include <config.h>
 #include <fdt_support.h>
-#include <ide.h>
 #include <init.h>
 #include <net.h>
 #include <netdev.h>
cmd/ide.c +0 -1
index 036489fda979..ed30f9468660 100644
@@ -19,7 +19,6 @@
 #include <dm/device-internal.h>
 #include <dm/uclass-internal.h>
 
-#include <ide.h>
 #include <ata.h>
 
 #ifdef CONFIG_LED_STATUS
common/board_r.c +0 -1
index b90a4d9ff695..a1183f0811dd 100644
@@ -36,7 +36,6 @@
 #include <env.h>
 #include <env_internal.h>
 #include <fdtdec.h>
-#include <ide.h>
 #include <init.h>
 #include <initcall.h>
 #include <kgdb.h>
disk/part.c +0 -1
index 303178161c08..9cbd03686f5d 100644
@@ -8,7 +8,6 @@
 #include <command.h>
 #include <env.h>
 #include <errno.h>
-#include <ide.h>
 #include <log.h>
 #include <malloc.h>
 #include <part.h>
disk/part_amiga.c +0 -1
index 5b8ae5762d3a..22bf99f1b88c 100644
@@ -6,7 +6,6 @@
  */
 #include <command.h>
 #include <env.h>
-#include <ide.h>
 #include "part_amiga.h"
 #include <part.h>
 #include <vsprintf.h>
disk/part_dos.c +0 -1
index 96f748702fd5..5c77225cef93 100644
@@ -15,7 +15,6 @@
 
 #include <blk.h>
 #include <command.h>
-#include <ide.h>
 #include <memalign.h>
 #include <vsprintf.h>
 #include <asm/unaligned.h>
disk/part_efi.c +0 -1
index 932d058c184c..68ba1d11e7b6 100644
@@ -21,7 +21,6 @@
 #include <asm/unaligned.h>
 #include <command.h>
 #include <fdtdec.h>
-#include <ide.h>
 #include <malloc.h>
 #include <memalign.h>
 #include <part_efi.h>
disk/part_mac.c +0 -1
index 21c85942fd84..dd3ce0be832b 100644
@@ -15,7 +15,6 @@
 #include <command.h>
 #include <log.h>
 #include <memalign.h>
-#include <ide.h>
 #include "part_mac.h"
 #include <part.h>
 
include/ide.h +0 -2
index 2c25e74ede08..550b33056213 100644
@@ -7,8 +7,6 @@
 #ifndef	_IDE_H
 #define _IDE_H
 
-#include <blk.h>
-
 #define IDE_BUS(dev)	(dev / (CONFIG_SYS_IDE_MAXDEVICE / CONFIG_SYS_IDE_MAXBUS))
 
 /**
include/part.h +0 -1
index fcb3c13dea4d..3fa2d8424b70 100644
@@ -7,7 +7,6 @@
 #define _PART_H
 
 #include <blk.h>
-#include <ide.h>
 #include <u-boot/uuid.h>
 #include <linker_lists.h>
 #include <linux/errno.h>
lib/efi_loader/efi_device_path.c +1 -0
index c9bf2726fe24..66a951a8c1bb 100644
@@ -10,6 +10,7 @@
 #include <blk.h>
 #include <dm.h>
 #include <dm/root.h>
+#include <ide.h>
 #include <log.h>
 #include <net.h>
 #include <usb.h>
Signature · 1 line
2.43.0
author
#17 lore raw

PATCH 15/17 include/mmc.h: Audit include list

In reply to Tom Rini

This file does not need <linux/sizes.h> nor <linux/compiler.h> so remove them. This exposes however that a number of other files had been relying on this implicit include for <linux/sizes.h> so add that where needed.

---
 arch/powerpc/cpu/mpc85xx/fdt.c          | 1 +
 board/emulation/common/qemu_dfu.c       | 1 +
 board/toradex/verdin-am62/verdin-am62.c | 1 +
 drivers/mmc/mmc.c                       | 1 +
 drivers/mmc/snps_sdhci.c                | 1 +
 include/mmc.h                           | 2 --
 6 files changed, 5 insertions(+), 2 deletions(-)
arch/powerpc/cpu/mpc85xx/fdt.c +1 -0
index b2c0c517e7a0..143b7c624d27 100644
@@ -13,6 +13,7 @@
 #include <time.h>
 #include <asm/global_data.h>
 #include <linux/libfdt.h>
+#include <linux/sizes.h>
 #include <fdt_support.h>
 #include <asm/processor.h>
 #include <linux/ctype.h>
board/emulation/common/qemu_dfu.c +1 -0
index 393fcaeb7422..8a59f5ade13a 100644
@@ -7,6 +7,7 @@
 #include <env.h>
 #include <memalign.h>
 #include <mtd.h>
+#include <linux/sizes.h>
 
 #define DFU_ALT_BUF_LEN		SZ_1K
 
board/toradex/verdin-am62/verdin-am62.c +1 -0
index 7b2eecbf659a..eca2cc8bc7f8 100644
@@ -15,6 +15,7 @@
 #include <init.h>
 #include <k3-ddrss.h>
 #include <spl.h>
+#include <linux/sizes.h>
 #include <asm/arch/k3-ddr.h>
 
 #include "../common/tdx-cfg-block.h"
drivers/mmc/mmc.c +1 -0
index cdcf2e0c8fe0..9421a846e458 100644
@@ -20,6 +20,7 @@
 #include <linux/bitops.h>
 #include <linux/delay.h>
 #include <linux/printk.h>
+#include <linux/sizes.h>
 #include <power/regulator.h>
 #include <malloc.h>
 #include <memalign.h>
drivers/mmc/snps_sdhci.c +1 -0
index f5ede38c3c17..fe834ec29692 100644
@@ -6,6 +6,7 @@
 #include <clk.h>
 #include <dm.h>
 #include <linux/bitfield.h>
+#include <linux/sizes.h>
 #include <sdhci.h>
 
 /* DWCMSHC specific Mode Select value */
include/mmc.h +0 -2
index eead666ae442..87f7ef131b63 100644
@@ -11,8 +11,6 @@
 
 #include <linux/bitops.h>
 #include <linux/list.h>
-#include <linux/sizes.h>
-#include <linux/compiler.h>
 #include <linux/dma-direction.h>
 #include <cyclic.h>
 #include <part.h>
Signature · 1 line
2.43.0
author
#18 lore raw

PATCH 16/17 include/mtd.h: Cleanup usage

In reply to Tom Rini

There are only a few things found in <mtd.h> today. Go through and audit the C files which include <mtd.h> and remove it when not required. Then, add it to the files which had either missed it or had an indirect inclusion of it.

---
 arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c | 1 +
 board/bosch/guardian/board.c                    | 1 -
 board/dhelectronics/dh_stm32mp1/board.c         | 1 -
 board/isee/igep00x0/igep00x0.c                  | 1 +
 board/xilinx/zynqmp/zynqmp.c                    | 1 +
 cmd/legacy-mtd-utils.c                          | 1 -
 cmd/mtdparts.c                                  | 1 +
 drivers/fwu-mdata/raw_mtd.c                     | 1 +
 drivers/mtd/altera_qspi.c                       | 2 +-
 drivers/mtd/renesas_rpc_hf.c                    | 1 -
 include/fwu.h                                   | 1 -
 lib/fwu_updates/fwu_v1.c                        | 1 +
 lib/fwu_updates/fwu_v2.c                        | 1 +
 13 files changed, 8 insertions(+), 6 deletions(-)
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c +1 -0
index 5b027fad0482..9acbc0689a92 100644
@@ -10,6 +10,7 @@
 #include <malloc.h>
 #include <misc.h>
 #include <mmc.h>
+#include <mtd.h>
 #include <part.h>
 #include <tee.h>
 #include <asm/arch/stm32mp1_smc.h>
board/bosch/guardian/board.c +0 -1
index 33ba7a7751ce..ebbae27c0f9a 100644
@@ -32,7 +32,6 @@
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <jffs2/load_kernel.h>
-#include <mtd.h>
 #include <nand.h>
 #include <video.h>
 #include <video_console.h>
board/dhelectronics/dh_stm32mp1/board.c +0 -1
index d30171f1fbe5..f7347bbb826f 100644
@@ -27,7 +27,6 @@
 #include <led.h>
 #include <memalign.h>
 #include <misc.h>
-#include <mtd.h>
 #include <mtd_node.h>
 #include <netdev.h>
 #include <phy.h>
board/isee/igep00x0/igep00x0.c +1 -0
index a35a7cd3b1f7..c21b083b62a2 100644
@@ -7,6 +7,7 @@
 #include <env.h>
 #include <init.h>
 #include <malloc.h>
+#include <mtd.h>
 #include <net.h>
 #include <status_led.h>
 #include <dm.h>
board/xilinx/zynqmp/zynqmp.c +1 -0
index 735ef3cd1bea..789b945d4623 100644
@@ -14,6 +14,7 @@
 #include <efi_loader.h>
 #include <init.h>
 #include <log.h>
+#include <mtd.h>
 #include <net.h>
 #include <sata.h>
 #include <ahci.h>
cmd/legacy-mtd-utils.c +0 -1
index 1a5271000bf3..34a6da019473 100644
@@ -4,7 +4,6 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/string.h>
-#include <mtd.h>
 
 static int get_part(const char *partname, int *idx, loff_t *off, loff_t *size,
 	     loff_t *maxsize, int devtype)
cmd/mtdparts.c +1 -0
index a021b2d198d1..571b79f091d7 100644
@@ -74,6 +74,7 @@
 #include <env.h>
 #include <log.h>
 #include <malloc.h>
+#include <mtd.h>
 #include <asm/global_data.h>
 #include <jffs2/load_kernel.h>
 #include <linux/list.h>
drivers/fwu-mdata/raw_mtd.c +1 -0
index 78a709f766c8..41c153038ab2 100644
@@ -8,6 +8,7 @@
 #include <fwu.h>
 #include <fwu_mdata.h>
 #include <memalign.h>
+#include <mtd.h>
 
 #include <linux/errno.h>
 #include <linux/types.h>
drivers/mtd/altera_qspi.c +1 -1
index e5c8df750b7f..46174aab3492 100644
@@ -9,10 +9,10 @@
 #include <fdt_support.h>
 #include <flash.h>
 #include <log.h>
-#include <mtd.h>
 #include <asm/global_data.h>
 #include <asm/io.h>
 #include <linux/bitops.h>
+#include <linux/mtd/mtd.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
drivers/mtd/renesas_rpc_hf.c +0 -1
index 50a6191d9c2c..9390c9e9ab34 100644
@@ -16,7 +16,6 @@
 #include <errno.h>
 #include <fdt_support.h>
 #include <flash.h>
-#include <mtd.h>
 #include <wait_bit.h>
 #include <linux/bitops.h>
 #include <mtd/cfi_flash.h>
include/fwu.h +0 -1
index 6441de370c91..77e60167fc7d 100644
@@ -9,7 +9,6 @@
 #include <blk.h>
 #include <efi.h>
 #include <fwu_mdata.h>
-#include <mtd.h>
 #include <u-boot/uuid.h>
 
 #include <linux/types.h>
lib/fwu_updates/fwu_v1.c +1 -0
index c311a8857a60..974abf216f6f 100644
@@ -3,6 +3,7 @@
  * Copyright (c) 2024, Linaro Limited
  */
 
+#include <errno.h>
 #include <fwu.h>
 #include <fwu_mdata.h>
 
lib/fwu_updates/fwu_v2.c +1 -0
index ce46904ff2ec..159315b45b98 100644
@@ -3,6 +3,7 @@
  * Copyright (c) 2024, Linaro Limited
  */
 
+#include <errno.h>
 #include <fwu.h>
 #include <fwu_mdata.h>
 #include <log.h>
Signature · 1 line
2.43.0
author
#19 lore raw

PATCH 17/17 global: Cleanup usage of "ETH_ALEN"

In reply to Tom Rini

The value of "ETH_ALEN" is defined to 6 in <linux/if_ether.h>. This file is included in <net.h>. In the places where we had ETH_ALEN but no direct include of <net.h>, add <linux/if_ether.h>. In the places where we had a custom name used, make use of ETH_ALEN instead.

---
 arch/arm/mach-tegra/dt-setup.c            | 1 +
 board/CZ.NIC/turris_omnia/turris_omnia.c  | 1 +
 board/Marvell/mvebu_armada-37xx/board.c   | 1 +
 board/Synology/common/legacy.h            | 2 ++
 board/bosch/shc/board.h                   | 5 +++--
 board/ti/common/board_detect.h            | 4 +++-
 drivers/net/mscc_eswitch/jr2_switch.c     | 1 -
 drivers/net/mscc_eswitch/luton_switch.c   | 1 -
 drivers/net/mscc_eswitch/ocelot_switch.c  | 1 -
 drivers/net/mscc_eswitch/serval_switch.c  | 1 -
 drivers/net/mscc_eswitch/servalt_switch.c | 1 -
 drivers/virtio/virtio_net.h               | 3 +--
 12 files changed, 12 insertions(+), 10 deletions(-)
arch/arm/mach-tegra/dt-setup.c +1 -0
index f4ae602d5239..7f1c3538ebeb 100644
@@ -5,6 +5,7 @@
 
 #include <fdtdec.h>
 #include <stdlib.h>
+#include <linux/if_ether.h>
 #include <asm/arch-tegra/cboot.h>
 #include <asm/arch-tegra/gpu.h>
 
board/CZ.NIC/turris_omnia/turris_omnia.c +1 -0
index b7588fa4eec9..baee5afa46d2 100644
@@ -29,6 +29,7 @@
 #include <linux/bitops.h>
 #include <linux/bitrev.h>
 #include <linux/delay.h>
+#include <linux/if_ether.h>
 #include <u-boot/crc.h>
 
 #include "../drivers/ddr/marvell/a38x/ddr3_init.h"
board/Marvell/mvebu_armada-37xx/board.c +1 -0
index df3fb6d21645..e44b713f96d7 100644
@@ -20,6 +20,7 @@
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
 #include <linux/delay.h>
+#include <linux/if_ether.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
board/Synology/common/legacy.h +2 -0
index 0a814324d097..f7ba225bd2ba 100644
@@ -8,6 +8,8 @@
 #ifndef __SYNO_LEGACY_H
 #define __SYNO_LEGACY_H
 
+#include <linux/if_ether.h>
+
 /* Marvell uboot parameters */
 #define ATAG_MV_UBOOT 0x41000403
 #define VER_NUM       0x03040400 /* 3.4.4 */
board/bosch/shc/board.h +3 -2
index a5e58186c9c1..8ff68f5a64b9 100644
@@ -14,6 +14,8 @@
 #ifndef _BOARD_H_
 #define _BOARD_H_
 
+#include <linux/if_ether.h>
+
 /* Definition to control the GPIOs (for LEDs and Reset) */
 #define GPIO_TO_PIN(bank, gpio) (32 * (bank) + (gpio))
 
@@ -146,7 +148,6 @@ static inline int board_is_series(void)
 #define RESET_MASK	(0x1 << 29)
 
 #define HDR_MAGIC	0x43485342
-#define HDR_ETH_ALEN	6
 #define HDR_NAME_LEN	8
 #define HDR_REV_LEN	8
 #define HDR_SER_LEN	16
@@ -176,7 +177,7 @@ struct  shc_eeprom {
 	u32  magic;
 	u16  version;
 	u16  lenght;
-	uint8_t mac_addr[HDR_ETH_ALEN];
+	uint8_t mac_addr[ETH_ALEN];
 };
 
 void enable_uart0_pin_mux(void);
board/ti/common/board_detect.h +3 -1
index ca1aa80f2f04..b057f3b2269b 100644
@@ -10,6 +10,8 @@
 
 /* TI EEPROM MAGIC Header identifier */
 #include <linux/bitops.h>
+#include <linux/if_ether.h>
+
 #define TI_EEPROM_HEADER_MAGIC	0xEE3355AA
 #define TI_DEAD_EEPROM_MAGIC	0xADEAD12C
 
@@ -18,7 +20,7 @@
 #define TI_EEPROM_HDR_SERIAL_LEN	12
 #define TI_EEPROM_HDR_CONFIG_LEN	32
 #define TI_EEPROM_HDR_NO_OF_MAC_ADDR	3
-#define TI_EEPROM_HDR_ETH_ALEN		6
+#define TI_EEPROM_HDR_ETH_ALEN		ETH_ALEN
 
 /**
  * struct ti_am_eeprom - This structure holds data read in from the
drivers/net/mscc_eswitch/jr2_switch.c +0 -1
index 925888e0765a..f04042091163 100644
@@ -222,7 +222,6 @@
 #define CPU_PORT		53
 #define IFH_LEN			7
 #define JR2_BUF_CELL_SZ		60
-#define ETH_ALEN		6
 #define PGID_BROADCAST		510
 #define PGID_UNICAST		511
 
drivers/net/mscc_eswitch/luton_switch.c +0 -1
index 1c584373b8bc..be78afc3f794 100644
@@ -132,7 +132,6 @@
 #define CPU_PORT		26
 #define INTERNAL_PORT_MSK	0xFFFFFF
 #define IFH_LEN			2
-#define ETH_ALEN		6
 #define PGID_BROADCAST		28
 #define PGID_UNICAST		29
 #define PGID_SRC		80
drivers/net/mscc_eswitch/ocelot_switch.c +0 -1
index 30bb4b5bad8b..b7a8b60587df 100644
@@ -126,7 +126,6 @@
 #define CPU_PORT		11
 #define INTERNAL_PORT_MSK	0x2FF
 #define IFH_LEN			4
-#define ETH_ALEN		6
 #define PGID_BROADCAST		13
 #define PGID_UNICAST		14
 #define PGID_SRC		80
drivers/net/mscc_eswitch/serval_switch.c +0 -1
index 8eab41df99ae..02f197aa3398 100644
@@ -111,7 +111,6 @@
 #define CPU_PORT		11
 #define INTERNAL_PORT_MSK	0xFF
 #define IFH_LEN			4
-#define ETH_ALEN		6
 #define PGID_BROADCAST		13
 #define PGID_UNICAST		14
 
drivers/net/mscc_eswitch/servalt_switch.c +0 -1
index 61547d7933e4..4b073c0781ef 100644
@@ -88,7 +88,6 @@
 #define MAC_VID			0
 #define CPU_PORT		11
 #define IFH_LEN			7
-#define ETH_ALEN		6
 #define PGID_BROADCAST		50
 #define PGID_UNICAST		51
 
drivers/virtio/virtio_net.h +1 -2
index c92bae526906..3adcb19aead2 100644
@@ -9,8 +9,7 @@
 #ifndef _LINUX_VIRTIO_NET_H
 #define _LINUX_VIRTIO_NET_H
 
-/* TODO: needs to be removed! */
-#define ETH_ALEN				6
+#include <linux/if_ether.h>
 
 /* The feature bitmap for virtio net */
 
Signature · 1 line
2.43.0
author
#20 lore raw
In reply to Tom Rini
Quoted 14 lines · Tom Rini

Hey all,

Related to my other series I've posted recently on cleaning up some headers, this series here is the result of at least lightly auditing the #includes used in include/[a-m]*.h. This ignores subdirectories, as at least in part I think the top-level includes we've constructed are the most likely places to have some extra transitive include paths. I'm sure there's exceptions and I'll likely audit deeper once this first pass is done. This only gets as far as "include/m*.h" because I didn't want this to get too big. This also sets aside <miiphy.h> and <phy.h>. While miiphy.h does not directly need <phy.h> there are *so* many users and I think I had half of the tree just about not building when I first tried. It might be worth further investigation, but it might just be OK as-is.

Quoted 1 line

[...]

Applied to u-boot/next, thanks!

[01/17] include/ahci.h: Audit include list

        commit: a510bc2c9a310a6204b4587c8c2c2e0962380e31
[02/17] include/arm_ffa.h: Audit include list
        commit: 6a891bb78cdc0f920bcae700af26f192421f93cd
[03/17] include/bios_emul.h: Audit include list
        commit: 377c75f8c5588126259ff82bd33eaa3090853cb8
[04/17] include/bootflow.h: Audit include list
        commit: 48703b2d6b7c87a523e794a711fe5c0d86f15093
[05/17] include/bootstd.h: Audit include list
        commit: 5bbc8b5c55102145ba06bee4cfa7276f293d9c31
[06/17] include/cadence-nand.h: Audit include list
        commit: 5d14fca77af7f2d4d950e0656329b03b9f5a2525
[07/17] include/cbfs.h: Audit include list
        commit: ef560b42ec1f5db103ca8be8c4532c55ff0151f3
[08/17] include/compiler.h: Audit include list
        commit: cad8e2033332c1693d03fbdcb1c07f788974c2ec
[09/17] include/dfu.h: Audit include list
        commit: 1585d92a05517f5f0278dccb8d0a03012960d790
[10/17] include/dw_hdmi.h: Audit include list
        commit: ddf050a5d6e86fc2c8c4ea9bd47915ed340e412f
[11/17] include/dwmmc.h: Audit include list
        commit: 8f3c64a53535b6bcc7b63a6cf9531a6dfddff5f3
[12/17] include/efi_loader.h, include/efi_tcg2.h: Audit include list
        commit: 40d5f553316eba90a893a58c12c098da74dca335
[13/17] include/fat.h: Audit include list
        commit: 43d76dc7df600b10cbf70753750bf87de098b210
[14/17] include/ide.h: Cleanup usage
        commit: d81b57a3cc881569d18014c0a8806e163066fd77
[15/17] include/mmc.h: Audit include list
        commit: 2cf46de9b6b8463033ba4f9243643d004dc9ea5a
[16/17] include/mtd.h: Cleanup usage
        commit: 2266595bf893edb07331ca8464738e0d4c82c129
[17/17] global: Cleanup usage of "ETH_ALEN"
        commit: 824f8f52a1e44f6d281d3f89f23b3e85824a34fb
Signature · 1 line
Tom