diff options
author | Tom Rini <trini@konsulko.com> | 2020-08-03 22:20:22 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-08-03 22:20:22 -0400 |
commit | d6faedca7670a0b4862cace2f3189998cbec87d8 (patch) | |
tree | 387ca6154bbfb29b7ff30946cac70036146c5cb6 | |
parent | 68941e3b2c217907a49aa66af8bb65729b913397 (diff) | |
parent | 23552ba142860205c4ddec414417cdc251f8cb79 (diff) | |
download | u-boot-WIP/03Aug2020.tar.gz |
Merge branch '2020-08-01-misc-cleanups'WIP/03Aug2020
- Further cleanup of common.h and dm.h usage in headers
137 files changed, 255 insertions, 138 deletions
diff --git a/arch/arm/include/asm/arch-mediatek/reset.h b/arch/arm/include/asm/arch-mediatek/reset.h index 9704666d24..4ba0bad94e 100644 --- a/arch/arm/include/asm/arch-mediatek/reset.h +++ b/arch/arm/include/asm/arch-mediatek/reset.h @@ -6,7 +6,7 @@ #ifndef __MEDIATEK_RESET_H #define __MEDIATEK_RESET_H -#include <dm.h> +struct udevice; int mediatek_reset_bind(struct udevice *pdev, u32 regofs, u32 num_regs); diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c index 694c26d35f..fe8d5947cc 100644 --- a/arch/arm/mach-imx/cpu.c +++ b/arch/arm/mach-imx/cpu.c @@ -8,6 +8,7 @@ #include <bootm.h> #include <common.h> +#include <dm.h> #include <init.h> #include <log.h> #include <net.h> diff --git a/arch/arm/mach-k3/sysfw-loader.c b/arch/arm/mach-k3/sysfw-loader.c index 513be09c68..96be069ee8 100644 --- a/arch/arm/mach-k3/sysfw-loader.c +++ b/arch/arm/mach-k3/sysfw-loader.c @@ -7,6 +7,7 @@ */ #include <common.h> +#include <dm.h> #include <image.h> #include <log.h> #include <spl.h> diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c index 70940f01f3..8aad4be467 100644 --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c @@ -5,6 +5,7 @@ #include <common.h> #include <console.h> +#include <dm.h> #include <dfu.h> #include <malloc.h> #include <serial.h> diff --git a/arch/mips/mach-mscc/include/mach/jr2/jr2.h b/arch/mips/mach-mscc/include/mach/jr2/jr2.h index 67244f63fa..3a779e7035 100644 --- a/arch/mips/mach-mscc/include/mach/jr2/jr2.h +++ b/arch/mips/mach-mscc/include/mach/jr2/jr2.h @@ -8,9 +8,6 @@ #ifndef _MSCC_JR2_H_ #define _MSCC_JR2_H_ -#include <linux/bitops.h> -#include <dm.h> - /* * Target offset base(s) */ diff --git a/arch/mips/mach-mscc/include/mach/luton/luton.h b/arch/mips/mach-mscc/include/mach/luton/luton.h index 19f02ede66..dda665fc15 100644 --- a/arch/mips/mach-mscc/include/mach/luton/luton.h +++ b/arch/mips/mach-mscc/include/mach/luton/luton.h @@ -8,9 +8,6 @@ #ifndef _MSCC_OCELOT_H_ #define _MSCC_OCELOT_H_ -#include <linux/bitops.h> -#include <dm.h> - /* * Target offset base(s) */ diff --git a/arch/mips/mach-mscc/include/mach/ocelot/ocelot.h b/arch/mips/mach-mscc/include/mach/ocelot/ocelot.h index 2cb2135d37..72b07c33cd 100644 --- a/arch/mips/mach-mscc/include/mach/ocelot/ocelot.h +++ b/arch/mips/mach-mscc/include/mach/ocelot/ocelot.h @@ -8,9 +8,6 @@ #ifndef _MSCC_OCELOT_H_ #define _MSCC_OCELOT_H_ -#include <linux/bitops.h> -#include <dm.h> - /* * Target offset base(s) */ diff --git a/arch/mips/mach-mscc/include/mach/serval/serval.h b/arch/mips/mach-mscc/include/mach/serval/serval.h index 763d18fe62..a78c6e59bb 100644 --- a/arch/mips/mach-mscc/include/mach/serval/serval.h +++ b/arch/mips/mach-mscc/include/mach/serval/serval.h @@ -8,9 +8,6 @@ #ifndef _MSCC_SERVAL_H_ #define _MSCC_SERVAL_H_ -#include <linux/bitops.h> -#include <dm.h> - /* * Target offset base(s) */ diff --git a/arch/mips/mach-mscc/include/mach/servalt/servalt.h b/arch/mips/mach-mscc/include/mach/servalt/servalt.h index 9015bc7dad..4d7d0886dd 100644 --- a/arch/mips/mach-mscc/include/mach/servalt/servalt.h +++ b/arch/mips/mach-mscc/include/mach/servalt/servalt.h @@ -8,9 +8,6 @@ #ifndef _MSCC_SERVALT_H_ #define _MSCC_SERVALT_H_ -#include <linux/bitops.h> -#include <dm.h> - /* * Target offset base(s) */ diff --git a/arch/x86/cpu/ivybridge/sdram.c b/arch/x86/cpu/ivybridge/sdram.c index 99bc48021e..dd6b8753de 100644 --- a/arch/x86/cpu/ivybridge/sdram.c +++ b/arch/x86/cpu/ivybridge/sdram.c @@ -10,6 +10,7 @@ */ #include <common.h> +#include <dm.h> #include <errno.h> #include <fdtdec.h> #include <init.h> diff --git a/board/atmel/common/board.c b/board/atmel/common/board.c index c41706c400..eee5c357bd 100644 --- a/board/atmel/common/board.c +++ b/board/atmel/common/board.c @@ -5,6 +5,7 @@ */ #include <common.h> +#include <dm.h> #include <env.h> #include <w1.h> #include <w1-eeprom.h> diff --git a/board/liebherr/display5/display5.c b/board/liebherr/display5/display5.c index ada7cf5eb7..5f44714301 100644 --- a/board/liebherr/display5/display5.c +++ b/board/liebherr/display5/display5.c @@ -27,7 +27,6 @@ #include <i2c.h> #include <linux/delay.h> -#include <dm.h> #include <dm/platform_data/serial_mxc.h> #include <dm/platdata.h> diff --git a/board/mscc/servalt/servalt.c b/board/mscc/servalt/servalt.c index d0e6016b9a..879f5de506 100644 --- a/board/mscc/servalt/servalt.c +++ b/board/mscc/servalt/servalt.c @@ -9,6 +9,8 @@ #include <asm/io.h> #include <led.h> +DECLARE_GLOBAL_DATA_PTR; + enum { BOARD_TYPE_PCB116 = 0xAABBCE00, }; diff --git a/board/st/common/stm32mp_dfu.c b/board/st/common/stm32mp_dfu.c index 0cda9196f9..38eb0f27c9 100644 --- a/board/st/common/stm32mp_dfu.c +++ b/board/st/common/stm32mp_dfu.c @@ -5,6 +5,7 @@ #include <common.h> #include <blk.h> +#include <dm.h> #include <dfu.h> #include <env.h> #include <memalign.h> diff --git a/cmd/demo.c b/cmd/demo.c index 9da06f5e4d..f923533f79 100644 --- a/cmd/demo.c +++ b/cmd/demo.c @@ -8,6 +8,7 @@ #include <common.h> #include <command.h> +#include <dm.h> #include <dm-demo.h> #include <mapmem.h> #include <asm/io.h> diff --git a/cmd/mdio.c b/cmd/mdio.c index c48bb51237..cfa45ad12a 100644 --- a/cmd/mdio.c +++ b/cmd/mdio.c @@ -10,6 +10,7 @@ #include <common.h> #include <command.h> +#include <dm.h> #include <miiphy.h> #include <phy.h> @@ -10,6 +10,7 @@ #include <common.h> #include <command.h> +#include <dm.h> #include <miiphy.h> typedef struct _MII_field_desc_t { @@ -6,6 +6,7 @@ */ #include <common.h> #include <command.h> +#include <dm.h> #include <w1.h> #include <w1-eeprom.h> #include <dm/device-internal.h> diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 72c7165dc2..10605f1bab 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -1529,6 +1529,16 @@ config TPL_SPI_FLASH_SUPPORT Enable support for using SPI flash in TPL. See SPL_SPI_FLASH_SUPPORT for details. +config TPL_SPI_FLASH_TINY + bool "Enable low footprint TPL SPI Flash support" + depends on TPL_SPI_FLASH_SUPPORT && !SPI_FLASH_BAR + default y if SPI_FLASH + help + Enable lightweight TPL SPI Flash support that supports just reading + data/images from flash. No support to write/erase flash. Enable + this if you have TPL size limitations and don't need full-fledged + SPI flash support. + config TPL_SPI_LOAD bool "Support loading from SPI flash" depends on TPL_SPI_FLASH_SUPPORT diff --git a/drivers/adc/stm32-adc-core.c b/drivers/adc/stm32-adc-core.c index 31bbb6f9d6..f20c46fb36 100644 --- a/drivers/adc/stm32-adc-core.c +++ b/drivers/adc/stm32-adc-core.c @@ -7,6 +7,7 @@ */ #include <common.h> +#include <dm.h> #include <asm/io.h> #include <dm/device_compat.h> #include <linux/bitops.h> diff --git a/drivers/adc/stm32-adc-core.h b/drivers/adc/stm32-adc-core.h index ba0e10e6cc..05968dbcc8 100644 --- a/drivers/adc/stm32-adc-core.h +++ b/drivers/adc/stm32-adc-core.h @@ -26,9 +26,9 @@ #define STM32_ADC_MAX_ADCS 3 #define STM32_ADCX_COMN_OFFSET 0x300 -#include <common.h> #include <clk.h> -#include <dm.h> + +struct udevice; /** * struct stm32_adc_common - stm32 ADC driver common data (for all instances) diff --git a/drivers/adc/stm32-adc.c b/drivers/adc/stm32-adc.c index b12f894a9b..3f0ed48846 100644 --- a/drivers/adc/stm32-adc.c +++ b/drivers/adc/stm32-adc.c @@ -8,6 +8,7 @@ #include <common.h> #include <adc.h> +#include <dm.h> #include <asm/io.h> #include <dm/device_compat.h> #include <linux/bitops.h> diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index 15656f5973..934cd5787a 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -25,6 +25,11 @@ static inline const struct clk_ops *clk_dev_ops(struct udevice *dev) return (const struct clk_ops *)dev->driver->ops; } +struct clk *dev_get_clk_ptr(struct udevice *dev) +{ + return (struct clk *)dev_get_uclass_priv(dev); +} + #if CONFIG_IS_ENABLED(OF_CONTROL) # if CONFIG_IS_ENABLED(OF_PLATDATA) int clk_get_by_driver_info(struct udevice *dev, struct phandle_1_arg *cells, diff --git a/drivers/clk/kendryte/bypass.c b/drivers/clk/kendryte/bypass.c index d1fd28175b..5f1986f2cb 100644 --- a/drivers/clk/kendryte/bypass.c +++ b/drivers/clk/kendryte/bypass.c @@ -4,12 +4,15 @@ */ #define LOG_CATEGORY UCLASS_CLK -#include <kendryte/bypass.h> +#include <common.h> +#include <clk.h> #include <clk-uclass.h> +#include <dm.h> +#include <log.h> +#include <kendryte/bypass.h> #include <linux/clk-provider.h> #include <linux/err.h> -#include <log.h> #define CLK_K210_BYPASS "k210_clk_bypass" diff --git a/drivers/clk/kendryte/pll.c b/drivers/clk/kendryte/pll.c index 19e358856a..ab6d75d585 100644 --- a/drivers/clk/kendryte/pll.c +++ b/drivers/clk/kendryte/pll.c @@ -3,18 +3,20 @@ * Copyright (C) 2019-20 Sean Anderson <seanga2@gmail.com> */ #define LOG_CATEGORY UCLASS_CLK -#include <kendryte/pll.h> -#include <asm/io.h> +#include <common.h> +#include <dm.h> /* For DIV_ROUND_DOWN_ULL, defined in linux/kernel.h */ #include <div64.h> +#include <log.h> +#include <serial.h> +#include <asm/io.h> #include <dt-bindings/clock/k210-sysctl.h> +#include <kendryte/pll.h> #include <linux/bitfield.h> #include <linux/clk-provider.h> #include <linux/delay.h> #include <linux/err.h> -#include <log.h> -#include <serial.h> #define CLK_K210_PLL "k210_clk_pll" diff --git a/drivers/fpga/socfpga_arria10.c b/drivers/fpga/socfpga_arria10.c index dfd3cbb461..44e1ac54c3 100644 --- a/drivers/fpga/socfpga_arria10.c +++ b/drivers/fpga/socfpga_arria10.c @@ -13,6 +13,7 @@ #include <altera.h> #include <asm/arch/pinmux.h> #include <common.h> +#include <dm.h> #include <dm/ofnode.h> #include <errno.h> #include <fs_loader.h> diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index f4eb655f6e..ff871f8252 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c @@ -15,7 +15,6 @@ #include <malloc.h> #include <mmc.h> #include <sdhci.h> -#include <dm.h> #include <asm/cache.h> #include <linux/bitops.h> #include <linux/delay.h> diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand_compat.c b/drivers/mtd/nand/raw/brcmnand/brcmnand_compat.c index c58679834e..a6acf556bc 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand_compat.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand_compat.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+ #include <common.h> +#include <dm.h> #include <malloc.h> #include <dm/devres.h> #include "brcmnand_compat.h" diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand_compat.h b/drivers/mtd/nand/raw/brcmnand/brcmnand_compat.h index 6f9bec7085..52711d4978 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand_compat.h +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand_compat.h @@ -3,8 +3,8 @@ #ifndef __BRCMNAND_COMPAT_H #define __BRCMNAND_COMPAT_H -#include <clk.h> -#include <dm.h> +struct clk; +struct udevice; char *devm_kasprintf(struct udevice *dev, gfp_t gfp, const char *fmt, ...); diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile index 952fd1e45a..99cc418552 100644 --- a/drivers/mtd/spi/Makefile +++ b/drivers/mtd/spi/Makefile @@ -8,7 +8,7 @@ spi-nor-y := sf_probe.o spi-nor-ids.o ifdef CONFIG_SPL_BUILD obj-$(CONFIG_SPL_SPI_BOOT) += fsl_espi_spl.o -ifeq ($(CONFIG_SPL_SPI_FLASH_TINY),y) +ifeq ($(CONFIG_$(SPL_TPL_)SPI_FLASH_TINY),y) spi-nor-y += spi-nor-tiny.o else spi-nor-y += spi-nor-core.o diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c index 475f6c31db..b959e3453a 100644 --- a/drivers/mtd/spi/sf_probe.c +++ b/drivers/mtd/spi/sf_probe.c @@ -119,7 +119,7 @@ static int spi_flash_std_erase(struct udevice *dev, u32 offset, size_t len) struct erase_info instr; if (offset % mtd->erasesize || len % mtd->erasesize) { - printf("SF: Erase offset/length not multiple of erase size\n"); + debug("SF: Erase offset/length not multiple of erase size\n"); return -EINVAL; } diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index fdcd830ce4..0113e70037 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -2470,7 +2470,7 @@ static int spi_nor_init(struct spi_nor *nor) * designer) that this is bad. */ if (nor->flags & SNOR_F_BROKEN_RESET) - printf("enabling reset hack; may not recover from unexpected reboots\n"); + debug("enabling reset hack; may not recover from unexpected reboots\n"); set_4byte(nor, nor->info, 1); } diff --git a/drivers/mtd/spi/spi-nor-tiny.c b/drivers/mtd/spi/spi-nor-tiny.c index 9f676c649d..fa26ea33c8 100644 --- a/drivers/mtd/spi/spi-nor-tiny.c +++ b/drivers/mtd/spi/spi-nor-tiny.c @@ -377,7 +377,7 @@ static const struct flash_info *spi_nor_read_id(struct spi_nor *nor) } dev_dbg(nor->dev, "unrecognized JEDEC id bytes: %02x, %02x, %02x\n", id[0], id[1], id[2]); - return ERR_PTR(-ENODEV); + return ERR_PTR(-EMEDIUMTYPE); } static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len, @@ -733,7 +733,7 @@ int spi_nor_scan(struct spi_nor *nor) info = spi_nor_read_id(nor); if (IS_ERR_OR_NULL(info)) - return -ENOENT; + return PTR_ERR(info); /* Parse the Serial Flash Discoverable Parameters table. */ ret = spi_nor_init_params(nor, info, ¶ms); if (ret) diff --git a/drivers/net/pcnet.c b/drivers/net/pcnet.c index 559560860b..ad5ac6618f 100644 --- a/drivers/net/pcnet.c +++ b/drivers/net/pcnet.c @@ -10,7 +10,6 @@ #include <cpu_func.h> #include <dm.h> #include <log.h> -#include <dm.h> #include <malloc.h> #include <memalign.h> #include <net.h> diff --git a/drivers/pci/pcie_layerscape.h b/drivers/pci/pcie_layerscape.h index 593798e3e3..0124e8e051 100644 --- a/drivers/pci/pcie_layerscape.h +++ b/drivers/pci/pcie_layerscape.h @@ -8,7 +8,7 @@ #ifndef _PCIE_LAYERSCAPE_H_ #define _PCIE_LAYERSCAPE_H_ #include <pci.h> -#include <dm.h> + #include <linux/sizes.h> #ifndef CONFIG_SYS_PCI_MEMORY_BUS diff --git a/drivers/pci/pcie_layerscape_fixup.c b/drivers/pci/pcie_layerscape_fixup.c index 94de4edaf4..8315b0b590 100644 --- a/drivers/pci/pcie_layerscape_fixup.c +++ b/drivers/pci/pcie_layerscape_fixup.c @@ -6,6 +6,7 @@ */ #include <common.h> +#include <dm.h> #include <init.h> #include <log.h> #include <pci.h> diff --git a/drivers/pci/pcie_layerscape_gen4.h b/drivers/pci/pcie_layerscape_gen4.h index d298a2b810..483eb538b5 100644 --- a/drivers/pci/pcie_layerscape_gen4.h +++ b/drivers/pci/pcie_layerscape_gen4.h @@ -9,7 +9,6 @@ #ifndef _PCIE_LAYERSCAPE_GEN4_H_ #define _PCIE_LAYERSCAPE_GEN4_H_ #include <pci.h> -#include <dm.h> #include <linux/bitops.h> #ifndef CONFIG_SYS_PCI_MEMORY_SIZE diff --git a/drivers/pci/pcie_layerscape_gen4_fixup.c b/drivers/pci/pcie_layerscape_gen4_fixup.c index 375ce45839..148b5d17ed 100644 --- a/drivers/pci/pcie_layerscape_gen4_fixup.c +++ b/drivers/pci/pcie_layerscape_gen4_fixup.c @@ -8,6 +8,7 @@ */ #include <common.h> +#include <dm.h> #include <log.h> #include <pci.h> #include <asm/arch/fsl_serdes.h> diff --git a/drivers/power/regulator/fixed.c b/drivers/power/regulator/fixed.c index b5f7aec353..2fa6c7e6b2 100644 --- a/drivers/power/regulator/fixed.c +++ b/drivers/power/regulator/fixed.c @@ -5,7 +5,6 @@ * Przemyslaw Marczak <p.marczak@samsung.com> */ -#include "regulator_common.h" #include <common.h> #include <errno.h> #include <dm.h> @@ -13,6 +12,8 @@ #include <power/pmic.h> #include <power/regulator.h> +#include "regulator_common.h" + static int fixed_regulator_ofdata_to_platdata(struct udevice *dev) { struct dm_regulator_uclass_platdata *uc_pdata; diff --git a/drivers/power/regulator/gpio-regulator.c b/drivers/power/regulator/gpio-regulator.c index cf3fbae79d..947f812d09 100644 --- a/drivers/power/regulator/gpio-regulator.c +++ b/drivers/power/regulator/gpio-regulator.c @@ -4,7 +4,6 @@ * Keerthy <j-keerthy@ti.com> */ -#include "regulator_common.h" #include <common.h> #include <fdtdec.h> #include <errno.h> @@ -15,6 +14,8 @@ #include <power/pmic.h> #include <power/regulator.h> +#include "regulator_common.h" + #define GPIO_REGULATOR_MAX_STATES 2 DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/power/regulator/regulator_common.c b/drivers/power/regulator/regulator_common.c index 4cfcc31298..13906b9c6e 100644 --- a/drivers/power/regulator/regulator_common.c +++ b/drivers/power/regulator/regulator_common.c @@ -4,12 +4,14 @@ * Sven Schwermer <sven.svenschwermer@disruptive-technologies.com> */ -#include "regulator_common.h" #include <common.h> +#include <dm.h> #include <log.h> #include <linux/delay.h> #include <power/regulator.h> +#include "regulator_common.h" + int regulator_common_ofdata_to_platdata(struct udevice *dev, struct regulator_common_platdata *dev_pdata, const char *enable_gpio_name) { diff --git a/drivers/power/regulator/regulator_common.h b/drivers/power/regulator/regulator_common.h index 18a525880a..bf80439c78 100644 --- a/drivers/power/regulator/regulator_common.h +++ b/drivers/power/regulator/regulator_common.h @@ -7,9 +7,7 @@ #ifndef _REGULATOR_COMMON_H #define _REGULATOR_COMMON_H -#include <common.h> #include <asm/gpio.h> -#include <dm.h> struct regulator_common_platdata { struct gpio_desc gpio; /* GPIO for regulator enable control */ diff --git a/drivers/ram/k3-am654-ddrss.c b/drivers/ram/k3-am654-ddrss.c index 8bbd8cfa83..21e5a65529 100644 --- a/drivers/ram/k3-am654-ddrss.c +++ b/drivers/ram/k3-am654-ddrss.c @@ -13,7 +13,6 @@ #include <ram.h> #include <asm/io.h> #include <power-domain.h> -#include <dm.h> #include <asm/arch/sys_proto.h> #include <dm/device_compat.h> #include <power/regulator.h> diff --git a/drivers/spi/mscc_bb_spi.c b/drivers/spi/mscc_bb_spi.c index 0454410ee9..e77447b655 100644 --- a/drivers/spi/mscc_bb_spi.c +++ b/drivers/spi/mscc_bb_spi.c @@ -11,7 +11,6 @@ #include <log.h> #include <malloc.h> #include <spi.h> -#include <dm.h> #include <asm/gpio.h> #include <asm/io.h> #include <linux/bitops.h> diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c index d344701aeb..c095ae9505 100644 --- a/drivers/spi/spi-mem.c +++ b/drivers/spi/spi-mem.c @@ -13,9 +13,14 @@ #include <linux/pm_runtime.h> #include "internals.h" #else -#include <dm/device_compat.h> +#include <common.h> +#include <dm.h> +#include <errno.h> +#include <malloc.h> +#include <spi.h> #include <spi.h> #include <spi-mem.h> +#include <dm/device_compat.h> #endif #ifndef __UBOOT__ diff --git a/drivers/spi/spi-sifive.c b/drivers/spi/spi-sifive.c index 0e0ce25abb..c7345d9042 100644 --- a/drivers/spi/spi-sifive.c +++ b/drivers/spi/spi-sifive.c @@ -10,6 +10,7 @@ #include <dm.h> #include <dm/device_compat.h> #include <malloc.h> +#include <spi.h> #include <spi-mem.h> #include <wait_bit.h> #include <asm/io.h> diff --git a/drivers/spi/stm32_qspi.c b/drivers/spi/stm32_qspi.c index 001f0703e3..a53b941410 100644 --- a/drivers/spi/stm32_qspi.c +++ b/drivers/spi/stm32_qspi.c @@ -9,8 +9,10 @@ #include <common.h> #include <clk.h> +#include <dm.h> #include <log.h> #include <reset.h> +#include <spi.h> #include <spi-mem.h> #include <dm/device_compat.h> #include <linux/bitops.h> diff --git a/drivers/ufs/cdns-platform.c b/drivers/ufs/cdns-platform.c index 1a7bb7bed8..bad1bf7de5 100644 --- a/drivers/ufs/cdns-platform.c +++ b/drivers/ufs/cdns-platform.c @@ -9,6 +9,7 @@ #include <common.h> #include <dm.h> #include <ufs.h> +#include <asm/io.h> #include <dm/device_compat.h> #include <linux/bitops.h> #include <linux/err.h> diff --git a/drivers/ufs/ufs.c b/drivers/ufs/ufs.c index 87b4e5fc56..92b7e9fd7c 100644 --- a/drivers/ufs/ufs.c +++ b/drivers/ufs/ufs.c @@ -19,9 +19,10 @@ #include <malloc.h> #include <hexdump.h> #include <scsi.h> +#include <asm/io.h> +#include <asm/dma-mapping.h> #include <linux/bitops.h> #include <linux/delay.h> - #include <linux/dma-mapping.h> #include "ufs.h" diff --git a/drivers/ufs/ufs.h b/drivers/ufs/ufs.h index e0bde93776..069888fdd9 100644 --- a/drivers/ufs/ufs.h +++ b/drivers/ufs/ufs.h @@ -2,11 +2,10 @@ #ifndef __UFS_H #define __UFS_H -#include <asm/io.h> -#include <dm.h> - #include "unipro.h" +struct udevice; + #define UFS_CDB_SIZE 16 #define UPIU_TRANSACTION_UIC_CMD 0x1F #define UIC_CMD_SIZE (sizeof(u32) * 4) diff --git a/drivers/usb/musb-new/musb_uboot.c b/drivers/usb/musb-new/musb_uboot.c index 988071a61d..8ac2f0a78a 100644 --- a/drivers/usb/musb-new/musb_uboot.c +++ b/drivers/usb/musb-new/musb_uboot.c @@ -1,5 +1,6 @@ #include <common.h> #include <console.h> +#include <dm.h> #include <malloc.h> #include <watchdog.h> #include <linux/delay.h> @@ -452,3 +453,39 @@ struct musb *musb_register(struct musb_hdrc_platform_data *plat, void *bdata, return *musbp; } + +#if CONFIG_IS_ENABLED(DM_USB) +struct usb_device *usb_dev_get_parent(struct usb_device *udev) +{ + struct udevice *parent = udev->dev->parent; + + /* + * When called from usb-uclass.c: usb_scan_device() udev->dev points + * to the parent udevice, not the actual udevice belonging to the + * udev as the device is not instantiated yet. + * + * If dev is an usb-bus, then we are called from usb_scan_device() for + * an usb-device plugged directly into the root port, return NULL. + */ + if (device_get_uclass_id(udev->dev) == UCLASS_USB) + return NULL; + + /* + * If these 2 are not the same we are being called from + * usb_scan_device() and udev itself is the parent. + */ + if (dev_get_parent_priv(udev->dev) != udev) + return udev; + + /* We are being called normally, use the parent pointer */ + if (device_get_uclass_id(parent) == UCLASS_USB_HUB) + return dev_get_parent_priv(parent); + + return NULL; +} +#else +struct usb_device *usb_dev_get_parent(struct usb_device *udev) +{ + return udev->parent; +} +#endif diff --git a/drivers/usb/musb-new/pic32.c b/drivers/usb/musb-new/pic32.c index 74a841af46..2fbe9bebf1 100644 --- a/drivers/usb/musb-new/pic32.c +++ b/drivers/usb/musb-new/pic32.c @@ -10,6 +10,7 @@ */ #include <common.h> +#include <dm.h> #include <dm/device_compat.h> #include <linux/bitops.h> #include <linux/delay.h> diff --git a/drivers/usb/musb-new/usb-compat.h b/drivers/usb/musb-new/usb-compat.h index f2c18ad3a2..1c66c4fe36 100644 --- a/drivers/usb/musb-new/usb-compat.h +++ b/drivers/usb/musb-new/usb-compat.h @@ -1,9 +1,10 @@ #ifndef __USB_COMPAT_H__ #define __USB_COMPAT_H__ -#include <dm.h> #include "usb.h" +struct udevice; + struct usb_hcd { void *hcd_priv; }; @@ -67,40 +68,12 @@ static inline int usb_hcd_unmap_urb_for_dma(struct usb_hcd *hcd, return 0; } -#if CONFIG_IS_ENABLED(DM_USB) -static inline struct usb_device *usb_dev_get_parent(struct usb_device *udev) -{ - struct udevice *parent = udev->dev->parent; - - /* - * When called from usb-uclass.c: usb_scan_device() udev->dev points - * to the parent udevice, not the actual udevice belonging to the - * udev as the device is not instantiated yet. - * - * If dev is an usb-bus, then we are called from usb_scan_device() for - * an usb-device plugged directly into the root port, return NULL. - */ - if (device_get_uclass_id(udev->dev) == UCLASS_USB) - return NULL; - - /* - * If these 2 are not the same we are being called from - * usb_scan_device() and udev itself is the parent. - */ - if (dev_get_parent_priv(udev->dev) != udev) - return udev; - - /* We are being called normally, use the parent pointer */ - if (device_get_uclass_id(parent) == UCLASS_USB_HUB) - return dev_get_parent_priv(parent); - - return NULL; -} -#else -static inline struct usb_device *usb_dev_get_parent(struct usb_device *dev) -{ - return dev->parent; -} -#endif +/** + * usb_dev_get_parent() - Get the parent of a USB device + * + * @udev: USB struct containing information about the device + * @return associated device for which udev == dev_get_parent_priv(dev) + */ +struct usb_device *usb_dev_get_parent(struct usb_device *udev); #endif /* __USB_COMPAT_H__ */ diff --git a/include/dm-demo.h b/include/dm-demo.h index c9a82c7e52..7b6d0d80ff 100644 --- a/include/dm-demo.h +++ b/include/dm-demo.h @@ -6,8 +6,6 @@ #ifndef __DM_DEMO_H #define __DM_DEMO_H -#include <dm.h> - /** * struct dm_demo_pdata - configuration data for demo instance * diff --git a/include/dm.h b/include/dm.h index 2e1afda440..a1b84169e6 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_ diff --git a/include/dm/read.h b/include/dm/read.h index b1a6108544..487ec9e9c9 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -11,6 +11,7 @@ #include <linux/errno.h> +#include <dm/device.h> #include <dm/fdtaddr.h> #include <dm/ofnode.h> #include <dm/uclass.h> diff --git a/include/dm/test.h b/include/dm/test.h index d39686cde2..2c92d41278 100644 --- a/include/dm/test.h +++ b/include/dm/test.h @@ -6,9 +6,6 @@ #ifndef __DM_TEST_H #define __DM_TEST_H -#include <dm.h> -#include <test/test.h> - /** * struct dm_test_cdata - configuration data for test instance * diff --git a/include/efi_driver.h b/include/efi_driver.h index 840483a416..2b62219c5b 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 <common.h> -#include <dm.h> #include <efi_loader.h> /* diff --git a/include/eth_phy.h b/include/eth_phy.h index 19c496551b..be6c881527 100644 --- a/include/eth_phy.h +++ b/include/eth_phy.h @@ -6,9 +6,10 @@ #ifndef _eth_phy_h_ #define _eth_phy_h_ -#include <dm.h> #include <phy.h> +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); diff --git a/include/fs_loader.h b/include/fs_loader.h index b728c06fcf..1b3c58086f 100644 --- a/include/fs_loader.h +++ b/include/fs_loader.h @@ -6,7 +6,7 @@ #ifndef _FS_LOADER_H_ #define _FS_LOADER_H_ -#include <dm.h> +struct udevice; /** * struct phandle_part - A place for storing phandle of node and its partition diff --git a/include/kendryte/bypass.h b/include/kendryte/bypass.h index a081cbd12f..ab85bbcbfc 100644 --- a/include/kendryte/bypass.h +++ b/include/kendryte/bypass.h @@ -5,7 +5,7 @@ #ifndef K210_BYPASS_H #define K210_BYPASS_H -#include <clk.h> +struct clk; struct k210_bypass { struct clk clk; diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 8a20743ad8..79dce8f0ad 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 <dm.h> #include <linux/bitops.h> #include <linux/err.h> #include <clk-uclass.h> #include <linux/err.h> +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 */ diff --git a/include/phy.h b/include/phy.h index fedd146091..1dbbf65111 100644 --- a/include/phy.h +++ b/include/phy.h @@ -9,14 +9,17 @@ #ifndef _PHY_H #define _PHY_H -#include <dm.h> +#include <log.h> +#include <phy_interface.h> +#include <dm/ofnode.h> +#include <dm/read.h> #include <linux/errno.h> #include <linux/list.h> #include <linux/mii.h> #include <linux/ethtool.h> #include <linux/mdio.h> -#include <log.h> -#include <phy_interface.h> + +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 882e4af8ff..841ade311e 100644 --- a/include/phy_interface.h +++ b/include/phy_interface.h @@ -10,6 +10,8 @@ #ifndef _PHY_INTERFACE_H #define _PHY_INTERFACE_H +#include <string.h> + typedef enum { PHY_INTERFACE_MODE_MII, PHY_INTERFACE_MODE_GMII, diff --git a/include/spi-mem.h b/include/spi-mem.h index 893f7bd733..ca0f55c8fd 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 <common.h> -#include <dm.h> -#include <errno.h> -#include <spi.h> +struct udevice; #define SPI_MEM_OP_CMD(__opcode, __buswidth) \ { \ diff --git a/include/spi.h b/include/spi.h index 98ba9e796d..ef8c1f6692 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 */ }; /** diff --git a/include/spi_flash.h b/include/spi_flash.h index b336619487..85cae32cc7 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -9,10 +9,11 @@ #ifndef _SPI_FLASH_H_ #define _SPI_FLASH_H_ -#include <dm.h> /* Because we dereference struct udevice here */ #include <linux/types.h> #include <linux/mtd/spi-nor.h> +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 diff --git a/include/test/ut.h b/include/test/ut.h index 99bbb1230c..6ab2f8830d 100644 --- a/include/test/ut.h +++ b/include/test/ut.h @@ -11,6 +11,7 @@ #include <command.h> #include <hexdump.h> #include <linux/err.h> +#include <test/test.h> struct unit_test_state; diff --git a/include/thermal.h b/include/thermal.h index 11d75256e0..52a3317fd5 100644 --- a/include/thermal.h +++ b/include/thermal.h @@ -7,7 +7,7 @@ #ifndef _THERMAL_H_ #define _THERMAL_H_ -#include <dm.h> +struct udevice; int thermal_get_temp(struct udevice *dev, int *temp); diff --git a/include/w1.h b/include/w1.h index b958b1c92c..77f439e587 100644 --- a/include/w1.h +++ b/include/w1.h @@ -8,7 +8,7 @@ #ifndef __W1_H #define __W1_H -#include <dm.h> +struct udevice; #define W1_FAMILY_DS24B33 0x23 #define W1_FAMILY_DS2431 0x2d diff --git a/include/wdt.h b/include/wdt.h index d2ccfbc62e..bc242c2eb2 100644 --- a/include/wdt.h +++ b/include/wdt.h @@ -6,9 +6,7 @@ #ifndef _WDT_H_ #define _WDT_H_ -#include <dm.h> -#include <log.h> -#include <dm/read.h> +struct udevice; /* * Implement a simple watchdog uclass. Watchdog is basically a timer that diff --git a/lib/efi_driver/efi_block_device.c b/lib/efi_driver/efi_block_device.c index e7d8745ad8..0e72a68bce 100644 --- a/lib/efi_driver/efi_block_device.c +++ b/lib/efi_driver/efi_block_device.c @@ -30,6 +30,7 @@ #include <common.h> #include <blk.h> +#include <dm.h> #include <efi_driver.h> #include <malloc.h> #include <dm/device-internal.h> diff --git a/lib/efi_driver/efi_uclass.c b/lib/efi_driver/efi_uclass.c index 04e4e45734..0cf74b0361 100644 --- a/lib/efi_driver/efi_uclass.c +++ b/lib/efi_driver/efi_uclass.c @@ -17,6 +17,8 @@ * controllers. */ +#include <common.h> +#include <dm.h> #include <efi_driver.h> #include <log.h> #include <malloc.h> diff --git a/net/eth_legacy.c b/net/eth_legacy.c index 340469ba3a..992d1880bf 100644 --- a/net/eth_legacy.c +++ b/net/eth_legacy.c @@ -8,6 +8,7 @@ #include <common.h> #include <bootstage.h> #include <command.h> +#include <dm.h> #include <env.h> #include <log.h> #include <net.h> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 238f12cb46..3932362dba 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2322,7 +2322,7 @@ sub get_raw_comment { # Checks specific to U-Boot sub u_boot_line { - my ($realfile, $line, $herecurr) = @_; + my ($realfile, $line, $rawline, $herecurr) = @_; # ask for a test if a new uclass ID is added if ($realfile =~ /uclass-id.h/ && $line =~ /^\+/) { @@ -2353,6 +2353,12 @@ sub u_boot_line { ERROR("DEFINE_CONFIG_CMD", "All commands are managed by Kconfig\n" . $herecurr); } + + # Don't put common.h and dm.h in header files + if ($realfile =~ /\.h$/ && $rawline =~ /^\+#include\s*<(common|dm)\.h>*/) { + ERROR("BARRED_INCLUDE_IN_HDR", + "Avoid including common.h and dm.h in header files\n" . $herecurr); + } } sub process { @@ -3296,7 +3302,7 @@ sub process { } if ($u_boot) { - u_boot_line($realfile, $line, $herecurr); + u_boot_line($realfile, $line, $rawline, $herecurr); } # check we are in a valid source file C or perl if not then ignore this hunk diff --git a/test/dm/adc.c b/test/dm/adc.c index da7bd4bf1f..7fa1d48dd9 100644 --- a/test/dm/adc.c +++ b/test/dm/adc.c @@ -17,6 +17,7 @@ #include <power/regulator.h> #include <power/sandbox_pmic.h> #include <sandbox-adc.h> +#include <test/test.h> #include <test/ut.h> static int dm_test_adc_bind(struct unit_test_state *uts) diff --git a/test/dm/audio.c b/test/dm/audio.c index 77c3a3625b..4bb86e3214 100644 --- a/test/dm/audio.c +++ b/test/dm/audio.c @@ -8,6 +8,7 @@ #include <audio_codec.h> #include <dm.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> #include <asm/test.h> diff --git a/test/dm/axi.c b/test/dm/axi.c index e1155a51dd..5b1bbab0b8 100644 --- a/test/dm/axi.c +++ b/test/dm/axi.c @@ -8,9 +8,10 @@ #include <axi.h> #include <dm.h> #include <log.h> +#include <asm/axi.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> -#include <asm/axi.h> /* Test that sandbox AXI works correctly */ static int dm_test_axi_base(struct unit_test_state *uts) diff --git a/test/dm/blk.c b/test/dm/blk.c index 94b2855b8e..80d671e561 100644 --- a/test/dm/blk.c +++ b/test/dm/blk.c @@ -9,6 +9,7 @@ #include <usb.h> #include <asm/state.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/test/dm/board.c b/test/dm/board.c index 5472c65fad..ff50d6c38b 100644 --- a/test/dm/board.c +++ b/test/dm/board.c @@ -9,6 +9,7 @@ #include <log.h> #include <dm/test.h> #include <board.h> +#include <test/test.h> #include <test/ut.h> #include "../../drivers/board/sandbox.h" diff --git a/test/dm/bootcount.c b/test/dm/bootcount.c index be0c278907..9fd3751ef7 100644 --- a/test/dm/bootcount.c +++ b/test/dm/bootcount.c @@ -9,6 +9,7 @@ #include <log.h> #include <asm/test.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> static int dm_test_bootcount(struct unit_test_state *uts) diff --git a/test/dm/bus.c b/test/dm/bus.c index 73eb3aede3..0707267361 100644 --- a/test/dm/bus.c +++ b/test/dm/bus.c @@ -14,6 +14,7 @@ #include <dm/test.h> #include <dm/uclass-internal.h> #include <dm/util.h> +#include <test/test.h> #include <test/ut.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/test/dm/clk.c b/test/dm/clk.c index 48fc3dd714..7a39760f25 100644 --- a/test/dm/clk.c +++ b/test/dm/clk.c @@ -12,6 +12,7 @@ #include <dm/test.h> #include <dm/device-internal.h> #include <linux/err.h> +#include <test/test.h> #include <test/ut.h> /* Base test of the clk uclass */ diff --git a/test/dm/clk_ccf.c b/test/dm/clk_ccf.c index ae3a4d8a76..da2292a51a 100644 --- a/test/dm/clk_ccf.c +++ b/test/dm/clk_ccf.c @@ -11,6 +11,7 @@ #include <dm/test.h> #include <dm/uclass.h> #include <linux/err.h> +#include <test/test.h> #include <test/ut.h> #include <sandbox-clk.h> diff --git a/test/dm/core.c b/test/dm/core.c index d20c48443f..9b73ec3aa6 100644 --- a/test/dm/core.c +++ b/test/dm/core.c @@ -16,6 +16,7 @@ #include <dm/util.h> #include <dm/test.h> #include <dm/uclass-internal.h> +#include <test/test.h> #include <test/ut.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/test/dm/cpu.c b/test/dm/cpu.c index 46683d884a..0a75c91087 100644 --- a/test/dm/cpu.c +++ b/test/dm/cpu.c @@ -10,6 +10,7 @@ #include <dm/test.h> #include <dm/uclass-internal.h> #include <cpu.h> +#include <test/test.h> #include <test/ut.h> static int dm_test_cpu(struct unit_test_state *uts) diff --git a/test/dm/dma.c b/test/dm/dma.c index 317ed4fe8c..1cdc813619 100644 --- a/test/dm/dma.c +++ b/test/dm/dma.c @@ -11,6 +11,7 @@ #include <malloc.h> #include <dm/test.h> #include <dma.h> +#include <test/test.h> #include <test/ut.h> static int dm_test_dma_m2m(struct unit_test_state *uts) diff --git a/test/dm/dsi_host.c b/test/dm/dsi_host.c index 59fcd5558f..97917a17c1 100644 --- a/test/dm/dsi_host.c +++ b/test/dm/dsi_host.c @@ -10,6 +10,7 @@ #include <asm/state.h> #include <asm/test.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> static int dm_test_dsi_host_phy_init(void *priv_data) diff --git a/test/dm/eth.c b/test/dm/eth.c index b58c9640a2..1a3eb1839c 100644 --- a/test/dm/eth.c +++ b/test/dm/eth.c @@ -13,10 +13,11 @@ #include <log.h> #include <malloc.h> #include <net.h> +#include <asm/eth.h> #include <dm/test.h> #include <dm/device-internal.h> #include <dm/uclass-internal.h> -#include <asm/eth.h> +#include <test/test.h> #include <test/ut.h> #define DM_TEST_ETH_NUM 4 diff --git a/test/dm/firmware.c b/test/dm/firmware.c index 60fdcbb33f..2b4f49af80 100644 --- a/test/dm/firmware.c +++ b/test/dm/firmware.c @@ -8,6 +8,7 @@ #include <syscon.h> #include <asm/test.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> /* Base test of firmware probe */ diff --git a/test/dm/gpio.c b/test/dm/gpio.c index b7ee8fc3ca..f3c467e9ac 100644 --- a/test/dm/gpio.c +++ b/test/dm/gpio.c @@ -9,10 +9,11 @@ #include <log.h> #include <malloc.h> #include <acpi/acpi_device.h> +#include <asm/gpio.h> #include <dm/root.h> #include <dm/test.h> #include <dm/util.h> -#include <asm/gpio.h> +#include <test/test.h> #include <test/ut.h> /* Test that sandbox GPIOs work correctly */ diff --git a/test/dm/hwspinlock.c b/test/dm/hwspinlock.c index 09ec38b4f3..49c52bcd63 100644 --- a/test/dm/hwspinlock.c +++ b/test/dm/hwspinlock.c @@ -9,6 +9,7 @@ #include <asm/state.h> #include <asm/test.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> /* Test that hwspinlock driver functions are called */ diff --git a/test/dm/i2c.c b/test/dm/i2c.c index 2025c4216d..25b2c7c617 100644 --- a/test/dm/i2c.c +++ b/test/dm/i2c.c @@ -16,6 +16,7 @@ #include <dm/uclass-internal.h> #include <dm/util.h> #include <hexdump.h> +#include <test/test.h> #include <test/ut.h> static const int busnum; diff --git a/test/dm/i2s.c b/test/dm/i2s.c index 49ebc3523c..7a017be064 100644 --- a/test/dm/i2s.c +++ b/test/dm/i2s.c @@ -7,9 +7,10 @@ #include <common.h> #include <dm.h> #include <i2s.h> +#include <asm/test.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> -#include <asm/test.h> /* Basic test of the i2s codec uclass */ static int dm_test_i2s(struct unit_test_state *uts) diff --git a/test/dm/led.c b/test/dm/led.c index 00de7b3997..3d5ad9363b 100644 --- a/test/dm/led.c +++ b/test/dm/led.c @@ -8,6 +8,7 @@ #include <led.h> #include <asm/gpio.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> /* Base test of the led uclass */ diff --git a/test/dm/mailbox.c b/test/dm/mailbox.c index e6c521b8b5..e9c8ab1a95 100644 --- a/test/dm/mailbox.c +++ b/test/dm/mailbox.c @@ -8,6 +8,7 @@ #include <malloc.h> #include <dm/test.h> #include <asm/mbox.h> +#include <test/test.h> #include <test/ut.h> static int dm_test_mailbox(struct unit_test_state *uts) diff --git a/test/dm/mdio.c b/test/dm/mdio.c index ba1b54f27e..758bbb2cc5 100644 --- a/test/dm/mdio.c +++ b/test/dm/mdio.c @@ -7,10 +7,11 @@ #include <common.h> #include <dm.h> #include <log.h> -#include <dm/test.h> +#include <miiphy.h> #include <misc.h> +#include <dm/test.h> +#include <test/test.h> #include <test/ut.h> -#include <miiphy.h> /* macros copied over from mdio_sandbox.c */ #define SANDBOX_PHY_ADDR 5 diff --git a/test/dm/mdio_mux.c b/test/dm/mdio_mux.c index f962e09dbc..0b3f85a53b 100644 --- a/test/dm/mdio_mux.c +++ b/test/dm/mdio_mux.c @@ -6,10 +6,11 @@ #include <common.h> #include <dm.h> -#include <dm/test.h> +#include <miiphy.h> #include <misc.h> +#include <dm/test.h> +#include <test/test.h> #include <test/ut.h> -#include <miiphy.h> /* macros copied over from mdio_sandbox.c */ #define SANDBOX_PHY_ADDR 5 diff --git a/test/dm/misc.c b/test/dm/misc.c index 26fd6acecb..641070972d 100644 --- a/test/dm/misc.c +++ b/test/dm/misc.c @@ -8,6 +8,7 @@ #include <dm.h> #include <dm/test.h> #include <misc.h> +#include <test/test.h> #include <test/ut.h> static int dm_test_misc(struct unit_test_state *uts) diff --git a/test/dm/mmc.c b/test/dm/mmc.c index 49402b9c90..8e1fd3fe51 100644 --- a/test/dm/mmc.c +++ b/test/dm/mmc.c @@ -8,6 +8,7 @@ #include <mmc.h> #include <part.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> /* diff --git a/test/dm/nop.c b/test/dm/nop.c index 2df29f3d15..8b3b646892 100644 --- a/test/dm/nop.c +++ b/test/dm/nop.c @@ -13,6 +13,7 @@ #include <dm/device.h> #include <dm/test.h> #include <misc.h> +#include <test/test.h> #include <test/ut.h> static int noptest_bind(struct udevice *parent) diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c index 1114f34cbf..e01acc4fe9 100644 --- a/test/dm/ofnode.c +++ b/test/dm/ofnode.c @@ -5,6 +5,7 @@ #include <log.h> #include <dm/of_extra.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> static int dm_test_ofnode_compatible(struct unit_test_state *uts) diff --git a/test/dm/osd.c b/test/dm/osd.c index 5739dfa0b8..8784867ecb 100644 --- a/test/dm/osd.c +++ b/test/dm/osd.c @@ -7,10 +7,11 @@ #include <common.h> #include <display_options.h> #include <dm.h> -#include <dm/test.h> -#include <test/ut.h> #include <video_osd.h> #include <asm/test.h> +#include <dm/test.h> +#include <test/test.h> +#include <test/ut.h> #include "../../drivers/video/sandbox_osd.h" diff --git a/test/dm/panel.c b/test/dm/panel.c index 7e4ebd6d81..410e8f3907 100644 --- a/test/dm/panel.c +++ b/test/dm/panel.c @@ -14,8 +14,9 @@ #include <asm/gpio.h> #include <asm/test.h> #include <dm/test.h> -#include <test/ut.h> #include <power/regulator.h> +#include <test/test.h> +#include <test/ut.h> /* Basic test of the panel uclass */ static int dm_test_panel(struct unit_test_state *uts) diff --git a/test/dm/pch.c b/test/dm/pch.c index 54e33d187b..bf17a31ccf 100644 --- a/test/dm/pch.c +++ b/test/dm/pch.c @@ -8,6 +8,7 @@ #include <pch.h> #include <asm/test.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> /* Test that sandbox PCH works correctly */ diff --git a/test/dm/pci.c b/test/dm/pci.c index 39e82b3699..a492fc0355 100644 --- a/test/dm/pci.c +++ b/test/dm/pci.c @@ -8,6 +8,7 @@ #include <asm/io.h> #include <asm/test.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> /* Test that sandbox PCI works correctly */ diff --git a/test/dm/pci_ep.c b/test/dm/pci_ep.c index 101f861751..a29d00eebe 100644 --- a/test/dm/pci_ep.c +++ b/test/dm/pci_ep.c @@ -5,12 +5,13 @@ #include <common.h> #include <dm.h> +#include <hexdump.h> +#include <pci_ep.h> #include <asm/io.h> #include <asm/test.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> -#include <hexdump.h> -#include <pci_ep.h> /* Test that sandbox PCI EP works correctly */ static int dm_test_pci_ep_base(struct unit_test_state *uts) diff --git a/test/dm/phy.c b/test/dm/phy.c index 99f0119557..1a59899327 100644 --- a/test/dm/phy.c +++ b/test/dm/phy.c @@ -9,6 +9,7 @@ #include <generic-phy.h> #include <log.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> /* Base test of the phy uclass */ diff --git a/test/dm/pmic.c b/test/dm/pmic.c index b582329a9c..8c2766aeac 100644 --- a/test/dm/pmic.c +++ b/test/dm/pmic.c @@ -10,16 +10,17 @@ #include <errno.h> #include <dm.h> #include <fdtdec.h> +#include <fsl_pmic.h> #include <malloc.h> #include <dm/device-internal.h> #include <dm/root.h> -#include <dm/util.h> #include <dm/test.h> #include <dm/uclass-internal.h> +#include <dm/util.h> #include <power/pmic.h> #include <power/sandbox_pmic.h> +#include <test/test.h> #include <test/ut.h> -#include <fsl_pmic.h> /* Test PMIC get method */ diff --git a/test/dm/power-domain.c b/test/dm/power-domain.c index 8baf5d09d1..52f88c5a36 100644 --- a/test/dm/power-domain.c +++ b/test/dm/power-domain.c @@ -8,6 +8,7 @@ #include <malloc.h> #include <dm/test.h> #include <asm/power-domain.h> +#include <test/test.h> #include <test/ut.h> /* This must match the specifier for power-domains in the DT node */ diff --git a/test/dm/pwm.c b/test/dm/pwm.c index b52ee21a69..8cc911e1ad 100644 --- a/test/dm/pwm.c +++ b/test/dm/pwm.c @@ -7,6 +7,7 @@ #include <dm.h> #include <pwm.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> /* Basic test of the pwm uclass */ diff --git a/test/dm/ram.c b/test/dm/ram.c index 3efdb6b80b..2456466b56 100644 --- a/test/dm/ram.c +++ b/test/dm/ram.c @@ -7,6 +7,7 @@ #include <dm.h> #include <ram.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/test/dm/regmap.c b/test/dm/regmap.c index 809494d585..42cc4cb0c0 100644 --- a/test/dm/regmap.c +++ b/test/dm/regmap.c @@ -12,6 +12,7 @@ #include <asm/test.h> #include <dm/test.h> #include <linux/err.h> +#include <test/test.h> #include <test/ut.h> /* Base test of register maps */ diff --git a/test/dm/regulator.c b/test/dm/regulator.c index ca916eeebb..f412ec20c5 100644 --- a/test/dm/regulator.c +++ b/test/dm/regulator.c @@ -20,6 +20,7 @@ #include <power/pmic.h> #include <power/regulator.h> #include <power/sandbox_pmic.h> +#include <test/test.h> #include <test/ut.h> enum { diff --git a/test/dm/remoteproc.c b/test/dm/remoteproc.c index 9511c7dd6f..c6bf2c4c46 100644 --- a/test/dm/remoteproc.c +++ b/test/dm/remoteproc.c @@ -10,7 +10,9 @@ #include <remoteproc.h> #include <asm/io.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> + /** * dm_test_remoteproc_base() - test the operations after initializations * @uts: unit test state diff --git a/test/dm/reset.c b/test/dm/reset.c index 871d6400a0..8232807264 100644 --- a/test/dm/reset.c +++ b/test/dm/reset.c @@ -10,6 +10,7 @@ #include <reset.h> #include <dm/test.h> #include <asm/reset.h> +#include <test/test.h> #include <test/ut.h> /* This must match the specifier for mbox-names="test" in the DT node */ diff --git a/test/dm/rtc.c b/test/dm/rtc.c index dd037a6e17..42a9195b73 100644 --- a/test/dm/rtc.c +++ b/test/dm/rtc.c @@ -14,6 +14,7 @@ #include <asm/rtc.h> #include <asm/test.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> /* Simple RTC sanity check */ diff --git a/test/dm/serial.c b/test/dm/serial.c index 6237693cb8..a1b122ec1d 100644 --- a/test/dm/serial.c +++ b/test/dm/serial.c @@ -8,6 +8,7 @@ #include <serial.h> #include <dm.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> static int dm_test_serial(struct unit_test_state *uts) diff --git a/test/dm/sf.c b/test/dm/sf.c index 9e7dead684..0f2808fca4 100644 --- a/test/dm/sf.c +++ b/test/dm/sf.c @@ -15,6 +15,7 @@ #include <asm/test.h> #include <dm/test.h> #include <dm/util.h> +#include <test/test.h> #include <test/ut.h> /* Simple test of sandbox SPI flash */ diff --git a/test/dm/smem.c b/test/dm/smem.c index 4099a5f66c..21dd96e409 100644 --- a/test/dm/smem.c +++ b/test/dm/smem.c @@ -7,6 +7,7 @@ #include <dm.h> #include <smem.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> /* Basic test of the smem uclass */ diff --git a/test/dm/sound.c b/test/dm/sound.c index aa5368f05b..9cb9961058 100644 --- a/test/dm/sound.c +++ b/test/dm/sound.c @@ -9,6 +9,7 @@ #include <sound.h> #include <dm/test.h> #include <test/ut.h> +#include <test/test.h> #include <asm/test.h> /* Basic test of the sound codec uclass */ diff --git a/test/dm/spi.c b/test/dm/spi.c index ff2cddd245..10b89e7acf 100644 --- a/test/dm/spi.c +++ b/test/dm/spi.c @@ -13,6 +13,7 @@ #include <dm/test.h> #include <dm/uclass-internal.h> #include <dm/util.h> +#include <test/test.h> #include <test/ut.h> /* Test that we can find buses and chip-selects */ diff --git a/test/dm/spmi.c b/test/dm/spmi.c index 668b7e133f..4aae1f166d 100644 --- a/test/dm/spmi.c +++ b/test/dm/spmi.c @@ -14,6 +14,7 @@ #include <power/pmic.h> #include <spmi/spmi.h> #include <asm/gpio.h> +#include <test/test.h> #include <test/ut.h> /* Test if bus childs got probed propperly*/ diff --git a/test/dm/syscon.c b/test/dm/syscon.c index 06a1c69ac5..b2d0ade95e 100644 --- a/test/dm/syscon.c +++ b/test/dm/syscon.c @@ -11,6 +11,7 @@ #include <asm/test.h> #include <dm/test.h> #include <linux/err.h> +#include <test/test.h> #include <test/ut.h> /* Base test of system controllers */ diff --git a/test/dm/sysreset.c b/test/dm/sysreset.c index 5b2358ef67..e5cd18cd82 100644 --- a/test/dm/sysreset.c +++ b/test/dm/sysreset.c @@ -9,6 +9,7 @@ #include <asm/state.h> #include <asm/test.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> /* Test that we can use particular sysreset devices */ diff --git a/test/dm/tee.c b/test/dm/tee.c index 632e9960b0..fec9551fb2 100644 --- a/test/dm/tee.c +++ b/test/dm/tee.c @@ -10,6 +10,7 @@ #include <dm/test.h> #include <sandboxtee.h> #include <tee.h> +#include <test/test.h> #include <test/ut.h> #include <tee/optee_ta_avb.h> diff --git a/test/dm/test-driver.c b/test/dm/test-driver.c index ba85fa313e..08bdf01194 100644 --- a/test/dm/test-driver.c +++ b/test/dm/test-driver.c @@ -11,9 +11,10 @@ #include <errno.h> #include <log.h> #include <malloc.h> +#include <asm/io.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> -#include <asm/io.h> int dm_testdrv_op_count[DM_TEST_OP_COUNT]; static struct unit_test_state *uts = &global_dm_test_state; diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c index 8ef7c7a88e..c64ac405ed 100644 --- a/test/dm/test-fdt.c +++ b/test/dm/test-fdt.c @@ -18,6 +18,7 @@ #include <dm/util.h> #include <dm/lists.h> #include <dm/of_access.h> +#include <test/test.h> #include <test/ut.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/test/dm/test-main.c b/test/dm/test-main.c index 53e5ca321f..6d197d0d61 100644 --- a/test/dm/test-main.c +++ b/test/dm/test-main.c @@ -14,6 +14,8 @@ #include <dm/test.h> #include <dm/root.h> #include <dm/uclass-internal.h> +#include <test/test.h> +#include <test/test.h> #include <test/ut.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/test/dm/test-uclass.c b/test/dm/test-uclass.c index b6d629a285..760731b066 100644 --- a/test/dm/test-uclass.c +++ b/test/dm/test-uclass.c @@ -14,6 +14,7 @@ #include <asm/io.h> #include <dm/test.h> #include <linux/list.h> +#include <test/test.h> #include <test/ut.h> static struct unit_test_state *uts = &global_dm_test_state; diff --git a/test/dm/timer.c b/test/dm/timer.c index 9367dab5d5..4aa5eeac75 100644 --- a/test/dm/timer.c +++ b/test/dm/timer.c @@ -7,6 +7,7 @@ #include <dm.h> #include <timer.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> /* diff --git a/test/dm/usb.c b/test/dm/usb.c index b273a515ef..6cbb66c82b 100644 --- a/test/dm/usb.c +++ b/test/dm/usb.c @@ -14,6 +14,7 @@ #include <dm/device-internal.h> #include <dm/test.h> #include <dm/uclass-internal.h> +#include <test/test.h> #include <test/ut.h> struct keyboard_test_data { diff --git a/test/dm/video.c b/test/dm/video.c index 19f78b6239..9523a0173d 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -15,6 +15,7 @@ #include <video_console.h> #include <dm/test.h> #include <dm/uclass-internal.h> +#include <test/test.h> #include <test/ut.h> /* diff --git a/test/dm/virtio.c b/test/dm/virtio.c index 4a0c0b23b8..6361cd5333 100644 --- a/test/dm/virtio.c +++ b/test/dm/virtio.c @@ -9,9 +9,10 @@ #include <virtio.h> #include <virtio_ring.h> #include <dm/device-internal.h> -#include <dm/uclass-internal.h> #include <dm/root.h> #include <dm/test.h> +#include <dm/uclass-internal.h> +#include <test/test.h> #include <test/ut.h> /* Basic test of the virtio uclass */ diff --git a/test/dm/wdt.c b/test/dm/wdt.c index 1d31ec55c6..c704098b24 100644 --- a/test/dm/wdt.c +++ b/test/dm/wdt.c @@ -9,6 +9,7 @@ #include <asm/state.h> #include <asm/test.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> /* Test that watchdog driver functions are called */ diff --git a/test/lib/lmb.c b/test/lib/lmb.c index a0fe0f6b33..a344987509 100644 --- a/test/lib/lmb.c +++ b/test/lib/lmb.c @@ -4,10 +4,12 @@ */ #include <common.h> +#include <dm.h> #include <lmb.h> #include <log.h> #include <malloc.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> static int check_lmb(struct unit_test_state *uts, struct lmb *lmb, diff --git a/tools/patman/test_checkpatch.py b/tools/patman/test_checkpatch.py index c9580adb54..792196e689 100644 --- a/tools/patman/test_checkpatch.py +++ b/tools/patman/test_checkpatch.py @@ -373,19 +373,19 @@ index 0000000..2234c87 self.checkSingleMessage(pm, 'NEW_UCLASS') def testLivetree(self): - """Test for Use the livetree API""" + """Test for using the livetree API""" pm = PatchMaker() pm.add_line('common/main.c', 'fdtdec_do_something()') self.checkSingleMessage(pm, 'LIVETREE') def testNewCommand(self): - """Test for Use the livetree API""" + """Test for adding a new command""" pm = PatchMaker() pm.add_line('common/main.c', 'do_wibble(struct cmd_tbl *cmd_tbl)') self.checkSingleMessage(pm, 'CMD_TEST') - def testNewCommand(self): - """Test for Use the livetree API""" + def testPreferIf(self): + """Test for using #ifdef""" pm = PatchMaker() pm.add_line('common/main.c', '#ifdef CONFIG_YELLOW') pm.add_line('common/init.h', '#ifdef CONFIG_YELLOW') @@ -393,11 +393,18 @@ index 0000000..2234c87 self.checkSingleMessage(pm, "PREFER_IF") def testCommandUseDefconfig(self): - """Test for Use the livetree API""" + """Test for enabling/disabling commands using preprocesor""" pm = PatchMaker() pm.add_line('common/main.c', '#undef CONFIG_CMD_WHICH') self.checkSingleMessage(pm, 'DEFINE_CONFIG_CMD', 'error') + def testBarredIncludeInHdr(self): + """Test for using a barred include in a header file""" + pm = PatchMaker() + #pm.add_line('include/myfile.h', '#include <common.h>') + pm.add_line('include/myfile.h', '#include <dm.h>') + self.checkSingleMessage(pm, 'BARRED_INCLUDE_IN_HDR', 'error') + if __name__ == "__main__": unittest.main() |