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/test/dm/clk.c b/test/dm/clk.c
index 31335a5..003b789 100644
--- a/test/dm/clk.c
+++ b/test/dm/clk.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <malloc.h>
 #include <asm/clk.h>
 #include <dm/test.h>
 #include <dm/device-internal.h>
diff --git a/test/dm/dma.c b/test/dm/dma.c
index b56d177..12cba57 100644
--- a/test/dm/dma.c
+++ b/test/dm/dma.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <malloc.h>
 #include <dm/test.h>
 #include <dma.h>
 #include <test/ut.h>
diff --git a/test/dm/gpio.c b/test/dm/gpio.c
index bb4b20c..349123a 100644
--- a/test/dm/gpio.c
+++ b/test/dm/gpio.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <fdtdec.h>
 #include <dm.h>
+#include <malloc.h>
 #include <dm/root.h>
 #include <dm/test.h>
 #include <dm/util.h>
diff --git a/test/dm/mailbox.c b/test/dm/mailbox.c
index 4562d2a..e6c521b 100644
--- a/test/dm/mailbox.c
+++ b/test/dm/mailbox.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <malloc.h>
 #include <dm/test.h>
 #include <asm/mbox.h>
 #include <test/ut.h>
diff --git a/test/dm/power-domain.c b/test/dm/power-domain.c
index 4831821..8baf5d0 100644
--- a/test/dm/power-domain.c
+++ b/test/dm/power-domain.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <malloc.h>
 #include <dm/test.h>
 #include <asm/power-domain.h>
 #include <test/ut.h>
diff --git a/test/dm/reset.c b/test/dm/reset.c
index c61daed..8370820 100644
--- a/test/dm/reset.c
+++ b/test/dm/reset.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <malloc.h>
 #include <reset.h>
 #include <dm/test.h>
 #include <asm/reset.h>
diff --git a/test/dm/spmi.c b/test/dm/spmi.c
index e6a9108..668b7e1 100644
--- a/test/dm/spmi.c
+++ b/test/dm/spmi.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <fdtdec.h>
 #include <dm.h>
+#include <malloc.h>
 #include <dm/device.h>
 #include <dm/root.h>
 #include <dm/test.h>
diff --git a/test/dm/tee.c b/test/dm/tee.c
index 22f05a4..d40f13d 100644
--- a/test/dm/tee.c
+++ b/test/dm/tee.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <malloc.h>
 #include <dm/test.h>
 #include <sandboxtee.h>
 #include <tee.h>
diff --git a/test/dm/video.c b/test/dm/video.c
index 3151ebb..f72979f 100644
--- a/test/dm/video.c
+++ b/test/dm/video.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <bzlib.h>
 #include <dm.h>
+#include <malloc.h>
 #include <mapmem.h>
 #include <os.h>
 #include <video.h>