From defce58181e962f9c9979091ac4726cfcded63e7 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 19 Jul 2020 10:15:33 -0600 Subject: wdt: Drop dm.h header file This header file should not be included in other header files. Remove it and use a forward declaration instead. Also remove the other headers that are not needed, since the inline code was removed in a recent commit: b4d9452c4 ("watchdog: move initr_watchdog() to wdt-uclass.c") Signed-off-by: Simon Glass --- include/wdt.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'include') diff --git a/include/wdt.h b/include/wdt.h index d2ccfbc62ef..bc242c2eb26 100644 --- a/include/wdt.h +++ b/include/wdt.h @@ -6,9 +6,7 @@ #ifndef _WDT_H_ #define _WDT_H_ -#include -#include -#include +struct udevice; /* * Implement a simple watchdog uclass. Watchdog is basically a timer that -- cgit v1.2.3 From 340fd10e7b235681fe5996a89cc84dfcd5afafbd Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 19 Jul 2020 10:15:34 -0600 Subject: mtd: spi-mem: Drop dm.h header file This header file should not be included in other header files. Remove it and use a forward declaration instead. Signed-off-by: Simon Glass --- include/spi-mem.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'include') diff --git a/include/spi-mem.h b/include/spi-mem.h index 893f7bd7337..ca0f55c8fdf 100644 --- a/include/spi-mem.h +++ b/include/spi-mem.h @@ -11,10 +11,7 @@ #ifndef __UBOOT_SPI_MEM_H #define __UBOOT_SPI_MEM_H -#include -#include -#include -#include +struct udevice; #define SPI_MEM_OP_CMD(__opcode, __buswidth) \ { \ -- cgit v1.2.3 From 54234592df3324cdb6013d8c94013a2982dd660e Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 19 Jul 2020 10:15:35 -0600 Subject: mtd: spi: Drop SPI_XFER_MMAP* These two defines are no-longer supported. Drop them. Signed-off-by: Simon Glass --- include/spi.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include') diff --git a/include/spi.h b/include/spi.h index 98ba9e796d5..ef8c1f6692e 100644 --- a/include/spi.h +++ b/include/spi.h @@ -146,8 +146,6 @@ struct spi_slave { #define SPI_XFER_BEGIN BIT(0) /* Assert CS before transfer */ #define SPI_XFER_END BIT(1) /* Deassert CS after transfer */ #define SPI_XFER_ONCE (SPI_XFER_BEGIN | SPI_XFER_END) -#define SPI_XFER_MMAP BIT(2) /* Memory Mapped start */ -#define SPI_XFER_MMAP_END BIT(3) /* Memory Mapped End */ }; /** -- cgit v1.2.3 From 82a7697b5ab3327d76cba884e10ac603aadac68c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 19 Jul 2020 10:15:36 -0600 Subject: dm: core: Drop dm.h header file from dm-demo.h This header file should not be included in other header files. Remove it and add it to the cmd file instead. Signed-off-by: Simon Glass --- include/dm-demo.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include') diff --git a/include/dm-demo.h b/include/dm-demo.h index c9a82c7e52c..7b6d0d80ff8 100644 --- a/include/dm-demo.h +++ b/include/dm-demo.h @@ -6,8 +6,6 @@ #ifndef __DM_DEMO_H #define __DM_DEMO_H -#include - /** * struct dm_demo_pdata - configuration data for demo instance * -- cgit v1.2.3 From 0e1fad4382fbceb630d09e7009afe1b1b31a64d6 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 19 Jul 2020 10:15:37 -0600 Subject: dm: core: Drop header files from dm/test.h These header file should not be included in other header files. Remove them and add to each individual file. Add test/test.h to test/ui.h since that is a reasonable place. Signed-off-by: Simon Glass --- include/dm/test.h | 3 --- include/test/ut.h | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'include') diff --git a/include/dm/test.h b/include/dm/test.h index d39686cde28..2c92d412781 100644 --- a/include/dm/test.h +++ b/include/dm/test.h @@ -6,9 +6,6 @@ #ifndef __DM_TEST_H #define __DM_TEST_H -#include -#include - /** * struct dm_test_cdata - configuration data for test instance * diff --git a/include/test/ut.h b/include/test/ut.h index 99bbb1230c7..6ab2f8830df 100644 --- a/include/test/ut.h +++ b/include/test/ut.h @@ -11,6 +11,7 @@ #include #include #include +#include struct unit_test_state; -- cgit v1.2.3 From c2848cc2c35ccaedb10f23c3ee2a46ffdcc0de0c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 19 Jul 2020 10:15:38 -0600 Subject: fs: fs-loader: Drop dm.h header file This header file should not be included in other header files. Remove it and use a forward declaration instead. Signed-off-by: Simon Glass --- include/fs_loader.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/fs_loader.h b/include/fs_loader.h index b728c06fcff..1b3c58086f5 100644 --- a/include/fs_loader.h +++ b/include/fs_loader.h @@ -6,7 +6,7 @@ #ifndef _FS_LOADER_H_ #define _FS_LOADER_H_ -#include +struct udevice; /** * struct phandle_part - A place for storing phandle of node and its partition -- cgit v1.2.3 From 2a64ada78cba32196a4f49bd000a501fa2c96647 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 19 Jul 2020 10:15:39 -0600 Subject: net: Drop dm.h header file from phy.h This header file should not be included in other header files. Remove it and use other headers and C inclusions instead. Signed-off-by: Simon Glass --- include/dm/read.h | 1 + include/phy.h | 9 ++++++--- include/phy_interface.h | 2 ++ 3 files changed, 9 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/dm/read.h b/include/dm/read.h index b1a61085440..487ec9e9c93 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -11,6 +11,7 @@ #include +#include #include #include #include diff --git a/include/phy.h b/include/phy.h index fedd1460919..1dbbf651113 100644 --- a/include/phy.h +++ b/include/phy.h @@ -9,14 +9,17 @@ #ifndef _PHY_H #define _PHY_H -#include +#include +#include +#include +#include #include #include #include #include #include -#include -#include + +struct udevice; #define PHY_FIXED_ID 0xa5a55a5a #define PHY_NCSI_ID 0xbeefcafe diff --git a/include/phy_interface.h b/include/phy_interface.h index 882e4af8ffd..841ade311ef 100644 --- a/include/phy_interface.h +++ b/include/phy_interface.h @@ -10,6 +10,8 @@ #ifndef _PHY_INTERFACE_H #define _PHY_INTERFACE_H +#include + typedef enum { PHY_INTERFACE_MODE_MII, PHY_INTERFACE_MODE_GMII, -- cgit v1.2.3 From a00867b47a4be848c400f74b97479193a41d327c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 19 Jul 2020 10:15:40 -0600 Subject: sf: Drop dm.h header file from spi_flash.h This header file should not be included in other header files. Remove it and use a forward declaration instead. Signed-off-by: Simon Glass --- include/spi_flash.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/spi_flash.h b/include/spi_flash.h index b3366194876..85cae32cc73 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -9,10 +9,11 @@ #ifndef _SPI_FLASH_H_ #define _SPI_FLASH_H_ -#include /* Because we dereference struct udevice here */ #include #include +struct udevice; + /* by default ENV use the same parameters than SF command */ #ifndef CONFIG_ENV_SPI_BUS # define CONFIG_ENV_SPI_BUS CONFIG_SF_DEFAULT_BUS -- cgit v1.2.3 From 055efe5690eaab99301151878deab9a382c6e65e Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 19 Jul 2020 10:15:41 -0600 Subject: thermal: Drop dm.h header file This header file should not be included in other header files. Remove it and use a forward declaration instead. Signed-off-by: Simon Glass --- include/thermal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/thermal.h b/include/thermal.h index 11d75256e08..52a3317fd54 100644 --- a/include/thermal.h +++ b/include/thermal.h @@ -7,7 +7,7 @@ #ifndef _THERMAL_H_ #define _THERMAL_H_ -#include +struct udevice; int thermal_get_temp(struct udevice *dev, int *temp); -- cgit v1.2.3 From 411e9eb88c0cf2b99f3dcaa9b300c0e52ee751f3 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 19 Jul 2020 10:15:42 -0600 Subject: w1: Drop dm.h header file This header file should not be included in other header files. Remove it and use a forward declaration instead. Signed-off-by: Simon Glass --- include/w1.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/w1.h b/include/w1.h index b958b1c92c2..77f439e587f 100644 --- a/include/w1.h +++ b/include/w1.h @@ -8,7 +8,7 @@ #ifndef __W1_H #define __W1_H -#include +struct udevice; #define W1_FAMILY_DS24B33 0x23 #define W1_FAMILY_DS2431 0x2d -- cgit v1.2.3 From e1e10f29f9b5739b39b08b0c0040ec0cb315f3d7 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 19 Jul 2020 10:15:43 -0600 Subject: efi: Tidy up header includes Two files relies on efi_driver.h to include common.h and dm.h which is incorrect. The former should always be included in a non-host C file and the latter should be included if driver model is used. Signed-off-by: Simon Glass --- include/efi_driver.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include') diff --git a/include/efi_driver.h b/include/efi_driver.h index 840483a416a..2b62219c5bf 100644 --- a/include/efi_driver.h +++ b/include/efi_driver.h @@ -8,8 +8,6 @@ #ifndef _EFI_DRIVER_H #define _EFI_DRIVER_H 1 -#include -#include #include /* -- cgit v1.2.3 From fb989e0c6ce019466f24fbd529890d89a21c8472 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 19 Jul 2020 10:15:56 -0600 Subject: clk: Drop dm.h header file in clk-provider.h This header file should not be included in other header files. Remove it and use a forward declaration and un-inlining of dev_get_clk_ptr() instead. Fix up the kendryte header files to avoid build errors. Signed-off-by: Simon Glass Reviewed-by: Sean Anderson --- include/kendryte/bypass.h | 2 +- include/linux/clk-provider.h | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/kendryte/bypass.h b/include/kendryte/bypass.h index a081cbd12ff..ab85bbcbfca 100644 --- a/include/kendryte/bypass.h +++ b/include/kendryte/bypass.h @@ -5,7 +5,7 @@ #ifndef K210_BYPASS_H #define K210_BYPASS_H -#include +struct clk; struct k210_bypass { struct clk clk; diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 8a20743ad84..79dce8f0ad6 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -9,12 +9,13 @@ #ifndef __LINUX_CLK_PROVIDER_H #define __LINUX_CLK_PROVIDER_H -#include #include #include #include #include +struct udevice; + static inline void clk_dm(ulong id, struct clk *clk) { if (!IS_ERR(clk)) @@ -188,8 +189,5 @@ struct clk *clk_register_mux(struct device *dev, const char *name, const char *clk_hw_get_name(const struct clk *hw); ulong clk_generic_get_rate(struct clk *clk); -static inline struct clk *dev_get_clk_ptr(struct udevice *dev) -{ - return (struct clk *)dev_get_uclass_priv(dev); -} +struct clk *dev_get_clk_ptr(struct udevice *dev); #endif /* __LINUX_CLK_PROVIDER_H */ -- cgit v1.2.3 From f125e3cc1217c630dab1673c2ca181cc754b434b Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 19 Jul 2020 10:15:57 -0600 Subject: net: Drop dm.h header file in eth_phy.h This header file should not be included in other header files. Remove it and use a forward declaration instead. Signed-off-by: Simon Glass --- include/eth_phy.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/eth_phy.h b/include/eth_phy.h index 19c496551b4..be6c8815270 100644 --- a/include/eth_phy.h +++ b/include/eth_phy.h @@ -6,9 +6,10 @@ #ifndef _eth_phy_h_ #define _eth_phy_h_ -#include #include +struct udevice; + int eth_phy_binds_nodes(struct udevice *eth_dev); int eth_phy_set_mdio_bus(struct udevice *eth_dev, struct mii_dev *mdio_bus); struct mii_dev *eth_phy_get_mdio_bus(struct udevice *eth_dev); -- cgit v1.2.3 From a0558aca55c16a7f561656cb11bf172ef414bcec Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 19 Jul 2020 10:15:59 -0600 Subject: dm: core: Guard against including dm.h in header files Header files generally should not include header files just for a struct, since forward declarations work just as well and reduce overhead. Add a warning for dm.h being included, since this has crept into U-Boot. Signed-off-by: Simon Glass --- include/dm.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/dm.h b/include/dm.h index 2e1afda4402..a1b84169e64 100644 --- a/include/dm.h +++ b/include/dm.h @@ -3,6 +3,10 @@ * Copyright (c) 2013 Google, Inc */ +#ifdef _DM_H_ +#warning "Suspect dm.h is included from a header file - please fix" +#endif + #ifndef _DM_H_ #define _DM_H_ -- cgit v1.2.3