dm: core: Create a new header file for 'compat' features
At present dm/device.h includes the linux-compatible features. This
requires including linux/compat.h which in turn includes a lot of headers.
One of these is malloc.h which we thus end up including in every file in
U-Boot. Apart from the inefficiency of this, it is problematic for sandbox
which needs to use the system malloc() in some files.
Move the compatibility features into a separate header file.
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/drivers/mmc/am654_sdhci.c b/drivers/mmc/am654_sdhci.c
index 6053d3d..aad9d8b 100644
--- a/drivers/mmc/am654_sdhci.c
+++ b/drivers/mmc/am654_sdhci.c
@@ -12,6 +12,7 @@
#include <power-domain.h>
#include <regmap.h>
#include <sdhci.h>
+#include <dm/device_compat.h>
#include <linux/err.h>
/* CTL_CFG Registers */
diff --git a/drivers/mmc/arm_pl180_mmci.c b/drivers/mmc/arm_pl180_mmci.c
index ea8eb0d..d396afc 100644
--- a/drivers/mmc/arm_pl180_mmci.c
+++ b/drivers/mmc/arm_pl180_mmci.c
@@ -16,6 +16,7 @@
#include <errno.h>
#include <malloc.h>
#include <mmc.h>
+#include <dm/device_compat.h>
#include <asm/io.h>
#include <asm-generic/gpio.h>
diff --git a/drivers/mmc/bcm2835_sdhost.c b/drivers/mmc/bcm2835_sdhost.c
index 7f70aca..8cebf99 100644
--- a/drivers/mmc/bcm2835_sdhost.c
+++ b/drivers/mmc/bcm2835_sdhost.c
@@ -36,6 +36,7 @@
#include <asm/arch/msg.h>
#include <asm/arch/mbox.h>
#include <asm/unaligned.h>
+#include <dm/device_compat.h>
#include <linux/compat.h>
#include <linux/io.h>
#include <linux/iopoll.h>
diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index 112f115..ab40019 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -22,6 +22,7 @@
#include <fdt_support.h>
#include <asm/io.h>
#include <dm.h>
+#include <dm/device_compat.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c
index 7cbd6e4..4900498 100644
--- a/drivers/mmc/fsl_esdhc_imx.c
+++ b/drivers/mmc/fsl_esdhc_imx.c
@@ -19,6 +19,7 @@
#include <hwconfig.h>
#include <mmc.h>
#include <part.h>
+#include <dm/device_compat.h>
#include <linux/err.h>
#include <power/regulator.h>
#include <malloc.h>
diff --git a/drivers/mmc/jz_mmc.c b/drivers/mmc/jz_mmc.c
index cb2a7c3..8d4f886 100644
--- a/drivers/mmc/jz_mmc.c
+++ b/drivers/mmc/jz_mmc.c
@@ -12,6 +12,7 @@
#include <asm/io.h>
#include <asm/unaligned.h>
#include <errno.h>
+#include <dm/device_compat.h>
#include <mach/jz4780.h>
#include <wait_bit.h>
diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index c7a832c..0b90a97 100644
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -8,7 +8,9 @@
#include <mmc.h>
#include <dm.h>
#include <dm/device-internal.h>
+#include <dm/device_compat.h>
#include <dm/lists.h>
+#include <linux/compat.h>
#include "mmc_private.h"
int dm_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
diff --git a/drivers/mmc/msm_sdhci.c b/drivers/mmc/msm_sdhci.c
index cae42ec..da3ae2e 100644
--- a/drivers/mmc/msm_sdhci.c
+++ b/drivers/mmc/msm_sdhci.c
@@ -10,6 +10,7 @@
#include <common.h>
#include <clk.h>
#include <dm.h>
+#include <malloc.h>
#include <sdhci.h>
#include <wait_bit.h>
#include <asm/io.h>
diff --git a/drivers/mmc/mtk-sd.c b/drivers/mmc/mtk-sd.c
index d487081..bd1fb09 100644
--- a/drivers/mmc/mtk-sd.c
+++ b/drivers/mmc/mtk-sd.c
@@ -15,6 +15,7 @@
#include <mapmem.h>
#include <stdbool.h>
#include <asm/gpio.h>
+#include <dm/device_compat.h>
#include <dm/pinctrl.h>
#include <linux/bitops.h>
#include <linux/io.h>
diff --git a/drivers/mmc/renesas-sdhi.c b/drivers/mmc/renesas-sdhi.c
index e01ac31..c3b1313 100644
--- a/drivers/mmc/renesas-sdhi.c
+++ b/drivers/mmc/renesas-sdhi.c
@@ -6,8 +6,10 @@
#include <common.h>
#include <clk.h>
#include <fdtdec.h>
+#include <malloc.h>
#include <mmc.h>
#include <dm.h>
+#include <dm/device_compat.h>
#include <linux/compat.h>
#include <linux/dma-direction.h>
#include <linux/io.h>
diff --git a/drivers/mmc/sdhci-cadence.c b/drivers/mmc/sdhci-cadence.c
index 4736263..e9108da 100644
--- a/drivers/mmc/sdhci-cadence.c
+++ b/drivers/mmc/sdhci-cadence.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <dm.h>
+#include <dm/device_compat.h>
#include <linux/bitfield.h>
#include <linux/io.h>
#include <linux/iopoll.h>
diff --git a/drivers/mmc/sh_mmcif.c b/drivers/mmc/sh_mmcif.c
index c8875ce..29bbb4b 100644
--- a/drivers/mmc/sh_mmcif.c
+++ b/drivers/mmc/sh_mmcif.c
@@ -13,6 +13,7 @@
#include <clk.h>
#include <dm.h>
#include <malloc.h>
+#include <dm/device_compat.h>
#include <linux/errno.h>
#include <linux/compat.h>
#include <linux/io.h>
diff --git a/drivers/mmc/sh_sdhi.c b/drivers/mmc/sh_sdhi.c
index e38e8ab..2202158 100644
--- a/drivers/mmc/sh_sdhi.c
+++ b/drivers/mmc/sh_sdhi.c
@@ -13,6 +13,7 @@
#include <malloc.h>
#include <mmc.h>
#include <dm.h>
+#include <dm/device_compat.h>
#include <linux/errno.h>
#include <linux/compat.h>
#include <linux/io.h>
diff --git a/drivers/mmc/snps_dw_mmc.c b/drivers/mmc/snps_dw_mmc.c
index 5a413f0..c606ef0 100644
--- a/drivers/mmc/snps_dw_mmc.c
+++ b/drivers/mmc/snps_dw_mmc.c
@@ -13,6 +13,7 @@
#include <dwmmc.h>
#include <errno.h>
#include <fdtdec.h>
+#include <dm/device_compat.h>
#include <linux/libfdt.h>
#include <linux/err.h>
#include <malloc.h>
diff --git a/drivers/mmc/socfpga_dw_mmc.c b/drivers/mmc/socfpga_dw_mmc.c
index 568a3e7..786cdc7 100644
--- a/drivers/mmc/socfpga_dw_mmc.c
+++ b/drivers/mmc/socfpga_dw_mmc.c
@@ -11,6 +11,7 @@
#include <dwmmc.h>
#include <errno.h>
#include <fdtdec.h>
+#include <dm/device_compat.h>
#include <linux/libfdt.h>
#include <linux/err.h>
#include <malloc.h>
diff --git a/drivers/mmc/stm32_sdmmc2.c b/drivers/mmc/stm32_sdmmc2.c
index 0a7a2fe..6f3b2ad 100644
--- a/drivers/mmc/stm32_sdmmc2.c
+++ b/drivers/mmc/stm32_sdmmc2.c
@@ -9,6 +9,7 @@
#include <cpu_func.h>
#include <dm.h>
#include <fdtdec.h>
+#include <malloc.h>
#include <linux/libfdt.h>
#include <mmc.h>
#include <reset.h>
diff --git a/drivers/mmc/tmio-common.c b/drivers/mmc/tmio-common.c
index 5a8506d..092b740 100644
--- a/drivers/mmc/tmio-common.c
+++ b/drivers/mmc/tmio-common.c
@@ -11,6 +11,7 @@
#include <fdtdec.h>
#include <mmc.h>
#include <dm.h>
+#include <dm/device_compat.h>
#include <dm/pinctrl.h>
#include <linux/compat.h>
#include <linux/dma-direction.h>
diff --git a/drivers/mmc/uniphier-sd.c b/drivers/mmc/uniphier-sd.c
index 8f89bda..4dbe71f 100644
--- a/drivers/mmc/uniphier-sd.c
+++ b/drivers/mmc/uniphier-sd.c
@@ -7,8 +7,10 @@
#include <common.h>
#include <clk.h>
#include <fdtdec.h>
+#include <malloc.h>
#include <mmc.h>
#include <dm.h>
+#include <dm/device_compat.h>
#include <linux/compat.h>
#include <linux/dma-direction.h>
#include <linux/io.h>
diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c
index 83c32a3..24fabee 100644
--- a/drivers/mmc/zynq_sdhci.c
+++ b/drivers/mmc/zynq_sdhci.c
@@ -10,6 +10,7 @@
#include <dm.h>
#include <fdtdec.h>
#include "mmc_private.h"
+#include <dm/device_compat.h>
#include <linux/err.h>
#include <linux/libfdt.h>
#include <malloc.h>