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/mailbox/k3-sec-proxy.c b/drivers/mailbox/k3-sec-proxy.c
index 1194c6f..a560209 100644
--- a/drivers/mailbox/k3-sec-proxy.c
+++ b/drivers/mailbox/k3-sec-proxy.c
@@ -7,7 +7,9 @@
*/
#include <common.h>
+#include <malloc.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
#include <linux/types.h>
#include <linux/bitops.h>
#include <linux/soc/ti/k3-sec-proxy.h>
diff --git a/drivers/mailbox/mailbox-uclass.c b/drivers/mailbox/mailbox-uclass.c
index a6d2d1f..291f5c2 100644
--- a/drivers/mailbox/mailbox-uclass.c
+++ b/drivers/mailbox/mailbox-uclass.c
@@ -7,6 +7,7 @@
#include <dm.h>
#include <mailbox.h>
#include <mailbox-uclass.h>
+#include <malloc.h>
#include <time.h>
static inline struct mbox_ops *mbox_dev_ops(struct udevice *dev)
diff --git a/drivers/mailbox/sandbox-mbox-test.c b/drivers/mailbox/sandbox-mbox-test.c
index ba1bb1c..faca8fc 100644
--- a/drivers/mailbox/sandbox-mbox-test.c
+++ b/drivers/mailbox/sandbox-mbox-test.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <dm.h>
#include <mailbox.h>
+#include <malloc.h>
#include <asm/io.h>
struct sandbox_mbox_test {
diff --git a/drivers/mailbox/sandbox-mbox.c b/drivers/mailbox/sandbox-mbox.c
index 442ca63..25e23eb 100644
--- a/drivers/mailbox/sandbox-mbox.c
+++ b/drivers/mailbox/sandbox-mbox.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <dm.h>
#include <mailbox-uclass.h>
+#include <malloc.h>
#include <asm/io.h>
#include <asm/mbox.h>
diff --git a/drivers/mailbox/stm32-ipcc.c b/drivers/mailbox/stm32-ipcc.c
index d4035a8..13e642a 100644
--- a/drivers/mailbox/stm32-ipcc.c
+++ b/drivers/mailbox/stm32-ipcc.c
@@ -7,7 +7,9 @@
#include <clk.h>
#include <dm.h>
#include <mailbox-uclass.h>
+#include <malloc.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
/*
* IPCC has one set of registers per CPU
diff --git a/drivers/mailbox/tegra-hsp.c b/drivers/mailbox/tegra-hsp.c
index c463e6a..60f6a38 100644
--- a/drivers/mailbox/tegra-hsp.c
+++ b/drivers/mailbox/tegra-hsp.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
+#include <malloc.h>
#include <asm/io.h>
#include <dm.h>
#include <mailbox-uclass.h>
diff --git a/drivers/mailbox/zynqmp-ipi.c b/drivers/mailbox/zynqmp-ipi.c
index c181a7b..17b4654 100644
--- a/drivers/mailbox/zynqmp-ipi.c
+++ b/drivers/mailbox/zynqmp-ipi.c
@@ -9,6 +9,7 @@
#include <asm/io.h>
#include <dm.h>
#include <mailbox-uclass.h>
+#include <dm/device_compat.h>
#include <mach/sys_proto.h>
#include <linux/ioport.h>
#include <linux/io.h>