dm: rename device struct to udevice

using UBI and DM together leads in compiler error, as
both define a "struct device", so rename "struct device"
in include/dm/device.h to "struct udevice", as we use
linux code (MTD/UBI/UBIFS some USB code,...) and cannot
change the linux "struct device"

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Marek Vasut <marex@denx.de>
diff --git a/test/dm/cmd_dm.c b/test/dm/cmd_dm.c
index a03fe20..083f15c 100644
--- a/test/dm/cmd_dm.c
+++ b/test/dm/cmd_dm.c
@@ -16,12 +16,12 @@
 #include <dm/test.h>
 #include <dm/uclass-internal.h>
 
-static int display_succ(struct device *in, char *buf)
+static int display_succ(struct udevice *in, char *buf)
 {
 	int len;
 	int ip = 0;
 	char local[16];
-	struct device *pos, *n, *prev = NULL;
+	struct udevice *pos, *n, *prev = NULL;
 
 	printf("%s- %s @ %08x", buf, in->name, map_to_sysmem(in));
 	if (in->flags & DM_FLAG_ACTIVATED)
@@ -49,7 +49,7 @@
 	return 0;
 }
 
-static int dm_dump(struct device *dev)
+static int dm_dump(struct udevice *dev)
 {
 	if (!dev)
 		return -EINVAL;
@@ -59,7 +59,7 @@
 static int do_dm_dump_all(cmd_tbl_t *cmdtp, int flag, int argc,
 			  char * const argv[])
 {
-	struct device *root;
+	struct udevice *root;
 
 	root = dm_root();
 	printf("ROOT %08x\n", map_to_sysmem(root));
@@ -74,7 +74,7 @@
 	int id;
 
 	for (id = 0; id < UCLASS_COUNT; id++) {
-		struct device *dev;
+		struct udevice *dev;
 
 		ret = uclass_get(id, &uc);
 		if (ret)
diff --git a/test/dm/core.c b/test/dm/core.c
index 14a57c3..be3646b 100644
--- a/test/dm/core.c
+++ b/test/dm/core.c
@@ -60,7 +60,7 @@
 /* Test that binding with platdata occurs correctly */
 static int dm_test_autobind(struct dm_test_state *dms)
 {
-	struct device *dev;
+	struct udevice *dev;
 
 	/*
 	 * We should have a single class (UCLASS_ROOT) and a single root
@@ -95,7 +95,7 @@
 static int dm_test_autoprobe(struct dm_test_state *dms)
 {
 	int expected_base_add;
-	struct device *dev;
+	struct udevice *dev;
 	struct uclass *uc;
 	int i;
 
@@ -157,7 +157,7 @@
 static int dm_test_platdata(struct dm_test_state *dms)
 {
 	const struct dm_test_pdata *pdata;
-	struct device *dev;
+	struct udevice *dev;
 	int i;
 
 	for (i = 0; i < 3; i++) {
@@ -175,7 +175,7 @@
 static int dm_test_lifecycle(struct dm_test_state *dms)
 {
 	int op_count[DM_TEST_OP_COUNT];
-	struct device *dev, *test_dev;
+	struct udevice *dev, *test_dev;
 	int pingret;
 	int ret;
 
@@ -229,7 +229,7 @@
 /* Test that we can bind/unbind and the lists update correctly */
 static int dm_test_ordering(struct dm_test_state *dms)
 {
-	struct device *dev, *dev_penultimate, *dev_last, *test_dev;
+	struct udevice *dev, *dev_penultimate, *dev_last, *test_dev;
 	int pingret;
 
 	ut_assertok(device_bind_by_name(dms->root, &driver_info_manual,
@@ -281,7 +281,7 @@
 DM_TEST(dm_test_ordering, DM_TESTF_SCAN_PDATA);
 
 /* Check that we can perform operations on a device (do a ping) */
-int dm_check_operations(struct dm_test_state *dms, struct device *dev,
+int dm_check_operations(struct dm_test_state *dms, struct udevice *dev,
 			uint32_t base, struct dm_test_priv *priv)
 {
 	int expected;
@@ -311,7 +311,7 @@
 /* Check that we can perform operations on devices */
 static int dm_test_operations(struct dm_test_state *dms)
 {
-	struct device *dev;
+	struct udevice *dev;
 	int i;
 
 	/*
@@ -341,7 +341,7 @@
 /* Remove all drivers and check that things work */
 static int dm_test_remove(struct dm_test_state *dms)
 {
-	struct device *dev;
+	struct udevice *dev;
 	int i;
 
 	for (i = 0; i < 3; i++) {
@@ -367,7 +367,7 @@
 
 	for (i = 0; i < 2; i++) {
 		struct mallinfo start, end;
-		struct device *dev;
+		struct udevice *dev;
 		int ret;
 		int id;
 
@@ -435,10 +435,10 @@
  *		this array.
  * @return 0 if OK, -ve on error
  */
-static int create_children(struct dm_test_state *dms, struct device *parent,
-			   int count, int key, struct device *child[])
+static int create_children(struct dm_test_state *dms, struct udevice *parent,
+			   int count, int key, struct udevice *child[])
 {
-	struct device *dev;
+	struct udevice *dev;
 	int i;
 
 	for (i = 0; i < count; i++) {
@@ -460,10 +460,10 @@
 
 static int dm_test_children(struct dm_test_state *dms)
 {
-	struct device *top[NODE_COUNT];
-	struct device *child[NODE_COUNT];
-	struct device *grandchild[NODE_COUNT];
-	struct device *dev;
+	struct udevice *top[NODE_COUNT];
+	struct udevice *child[NODE_COUNT];
+	struct udevice *grandchild[NODE_COUNT];
+	struct udevice *dev;
 	int total;
 	int ret;
 	int i;
diff --git a/test/dm/gpio.c b/test/dm/gpio.c
index bf632bc..2b2b0b5 100644
--- a/test/dm/gpio.c
+++ b/test/dm/gpio.c
@@ -17,7 +17,7 @@
 {
 	unsigned int offset, gpio;
 	struct dm_gpio_ops *ops;
-	struct device *dev;
+	struct udevice *dev;
 	const char *name;
 	int offset_count;
 	char buf[80];
diff --git a/test/dm/test-driver.c b/test/dm/test-driver.c
index c4be8a1..0f1a37b 100644
--- a/test/dm/test-driver.c
+++ b/test/dm/test-driver.c
@@ -18,7 +18,7 @@
 int dm_testdrv_op_count[DM_TEST_OP_COUNT];
 static struct dm_test_state *dms = &global_test_state;
 
-static int testdrv_ping(struct device *dev, int pingval, int *pingret)
+static int testdrv_ping(struct udevice *dev, int pingval, int *pingret)
 {
 	const struct dm_test_pdata *pdata = dev_get_platdata(dev);
 	struct dm_test_priv *priv = dev_get_priv(dev);
@@ -33,7 +33,7 @@
 	.ping = testdrv_ping,
 };
 
-static int test_bind(struct device *dev)
+static int test_bind(struct udevice *dev)
 {
 	/* Private data should not be allocated */
 	ut_assert(!dev_get_priv(dev));
@@ -42,7 +42,7 @@
 	return 0;
 }
 
-static int test_probe(struct device *dev)
+static int test_probe(struct udevice *dev)
 {
 	struct dm_test_priv *priv = dev_get_priv(dev);
 
@@ -54,7 +54,7 @@
 	return 0;
 }
 
-static int test_remove(struct device *dev)
+static int test_remove(struct udevice *dev)
 {
 	/* Private data should still be allocated */
 	ut_assert(dev_get_priv(dev));
@@ -63,7 +63,7 @@
 	return 0;
 }
 
-static int test_unbind(struct device *dev)
+static int test_unbind(struct udevice *dev)
 {
 	/* Private data should not be allocated */
 	ut_assert(!dev->priv);
@@ -94,7 +94,7 @@
 	.priv_auto_alloc_size = sizeof(struct dm_test_priv),
 };
 
-static int test_manual_drv_ping(struct device *dev, int pingval, int *pingret)
+static int test_manual_drv_ping(struct udevice *dev, int pingval, int *pingret)
 {
 	*pingret = pingval + 2;
 
@@ -105,14 +105,14 @@
 	.ping = test_manual_drv_ping,
 };
 
-static int test_manual_bind(struct device *dev)
+static int test_manual_bind(struct udevice *dev)
 {
 	dm_testdrv_op_count[DM_TEST_OP_BIND]++;
 
 	return 0;
 }
 
-static int test_manual_probe(struct device *dev)
+static int test_manual_probe(struct udevice *dev)
 {
 	dm_testdrv_op_count[DM_TEST_OP_PROBE]++;
 	if (!dms->force_fail_alloc)
@@ -123,13 +123,13 @@
 	return 0;
 }
 
-static int test_manual_remove(struct device *dev)
+static int test_manual_remove(struct udevice *dev)
 {
 	dm_testdrv_op_count[DM_TEST_OP_REMOVE]++;
 	return 0;
 }
 
-static int test_manual_unbind(struct device *dev)
+static int test_manual_unbind(struct udevice *dev)
 {
 	dm_testdrv_op_count[DM_TEST_OP_UNBIND]++;
 	return 0;
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c
index e1d982f..6eccf11 100644
--- a/test/dm/test-fdt.c
+++ b/test/dm/test-fdt.c
@@ -18,7 +18,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static int testfdt_drv_ping(struct device *dev, int pingval, int *pingret)
+static int testfdt_drv_ping(struct udevice *dev, int pingval, int *pingret)
 {
 	const struct dm_test_pdata *pdata = dev->platdata;
 	struct dm_test_priv *priv = dev_get_priv(dev);
@@ -33,7 +33,7 @@
 	.ping = testfdt_drv_ping,
 };
 
-static int testfdt_ofdata_to_platdata(struct device *dev)
+static int testfdt_ofdata_to_platdata(struct udevice *dev)
 {
 	struct dm_test_pdata *pdata = dev_get_platdata(dev);
 
@@ -44,7 +44,7 @@
 	return 0;
 }
 
-static int testfdt_drv_probe(struct device *dev)
+static int testfdt_drv_probe(struct udevice *dev)
 {
 	struct dm_test_priv *priv = dev_get_priv(dev);
 
@@ -75,7 +75,7 @@
 };
 
 /* From here is the testfdt uclass code */
-int testfdt_ping(struct device *dev, int pingval, int *pingret)
+int testfdt_ping(struct udevice *dev, int pingval, int *pingret)
 {
 	const struct test_ops *ops = device_get_ops(dev);
 
@@ -94,7 +94,7 @@
 static int dm_test_fdt(struct dm_test_state *dms)
 {
 	const int num_drivers = 3;
-	struct device *dev;
+	struct udevice *dev;
 	struct uclass *uc;
 	int ret;
 	int i;
diff --git a/test/dm/test-main.c b/test/dm/test-main.c
index 828ed46..fbdae68 100644
--- a/test/dm/test-main.c
+++ b/test/dm/test-main.c
@@ -32,7 +32,7 @@
 /* Ensure all the test devices are probed */
 static int do_autoprobe(struct dm_test_state *dms)
 {
-	struct device *dev;
+	struct udevice *dev;
 	int ret;
 
 	/* Scanning the uclass is enough to probe all the devices */
diff --git a/test/dm/test-uclass.c b/test/dm/test-uclass.c
index 8b564b8..017e097 100644
--- a/test/dm/test-uclass.c
+++ b/test/dm/test-uclass.c
@@ -18,7 +18,7 @@
 
 static struct dm_test_state *dms = &global_test_state;
 
-int test_ping(struct device *dev, int pingval, int *pingret)
+int test_ping(struct udevice *dev, int pingval, int *pingret)
 {
 	const struct test_ops *ops = device_get_ops(dev);
 
@@ -28,24 +28,25 @@
 	return ops->ping(dev, pingval, pingret);
 }
 
-static int test_post_bind(struct device *dev)
+static int test_post_bind(struct udevice *dev)
 {
 	dm_testdrv_op_count[DM_TEST_OP_POST_BIND]++;
 
 	return 0;
 }
 
-static int test_pre_unbind(struct device *dev)
+static int test_pre_unbind(struct udevice *dev)
 {
 	dm_testdrv_op_count[DM_TEST_OP_PRE_UNBIND]++;
 
 	return 0;
 }
 
-static int test_post_probe(struct device *dev)
+static int test_post_probe(struct udevice *dev)
 {
-	struct device *prev = list_entry(dev->uclass_node.prev, struct device,
-					 uclass_node);
+	struct udevice *prev = list_entry(dev->uclass_node.prev,
+					    struct udevice, uclass_node);
+
 	struct dm_test_uclass_perdev_priv *priv = dev->uclass_priv;
 	struct uclass *uc = dev->uclass;
 
@@ -68,7 +69,7 @@
 	return 0;
 }
 
-static int test_pre_remove(struct device *dev)
+static int test_pre_remove(struct udevice *dev)
 {
 	dm_testdrv_op_count[DM_TEST_OP_PRE_REMOVE]++;