summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHeiko Schocher <hs@denx.de>2014-05-22 12:43:05 +0200
committerTom Rini <trini@ti.com>2014-05-27 10:21:32 -0400
commit54c5d08a09e631f88738db54c75395c6457c2157 (patch)
tree989241d18408f19062618bc380ef5948154f2334 /test
parent9665fa8f9e1488209d5e01d0792c243e0a220c5a (diff)
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>
Diffstat (limited to 'test')
-rw-r--r--test/dm/cmd_dm.c10
-rw-r--r--test/dm/core.c32
-rw-r--r--test/dm/gpio.c2
-rw-r--r--test/dm/test-driver.c20
-rw-r--r--test/dm/test-fdt.c10
-rw-r--r--test/dm/test-main.c2
-rw-r--r--test/dm/test-uclass.c15
7 files changed, 46 insertions, 45 deletions
diff --git a/test/dm/cmd_dm.c b/test/dm/cmd_dm.c
index a03fe20f0d3..083f15c31d1 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 @@ static int display_succ(struct device *in, char *buf)
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 dm_dump(struct device *dev)
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 @@ static int do_dm_dump_uclass(cmd_tbl_t *cmdtp, int flag, int argc,
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 14a57c3106d..be3646b968b 100644
--- a/test/dm/core.c
+++ b/test/dm/core.c
@@ -60,7 +60,7 @@ static struct driver_info driver_info_manual = {
/* 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 @@ DM_TEST(dm_test_autobind, 0);
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 @@ DM_TEST(dm_test_autoprobe, DM_TESTF_SCAN_PDATA);
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 @@ DM_TEST(dm_test_platdata, DM_TESTF_SCAN_PDATA);
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 @@ DM_TEST(dm_test_lifecycle, DM_TESTF_SCAN_PDATA | DM_TESTF_PROBE_TEST);
/* 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 @@ static int dm_test_ordering(struct dm_test_state *dms)
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 @@ int dm_check_operations(struct dm_test_state *dms, struct device *dev,
/* 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 @@ DM_TEST(dm_test_operations, DM_TESTF_SCAN_PDATA);
/* 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 @@ static int dm_test_leak(struct dm_test_state *dms)
for (i = 0; i < 2; i++) {
struct mallinfo start, end;
- struct device *dev;
+ struct udevice *dev;
int ret;
int id;
@@ -435,10 +435,10 @@ DM_TEST(dm_test_uclass, 0);
* 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 create_children(struct dm_test_state *dms, struct device *parent,
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 bf632bca54e..2b2b0b51fa7 100644
--- a/test/dm/gpio.c
+++ b/test/dm/gpio.c
@@ -17,7 +17,7 @@ static int dm_test_gpio(struct dm_test_state *dms)
{
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 c4be8a12d71..0f1a37b36e5 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 @@ static const struct test_ops test_ops = {
.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 @@ static int test_bind(struct device *dev)
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 @@ static int test_probe(struct device *dev)
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 @@ static int test_remove(struct device *dev)
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 @@ U_BOOT_DRIVER(test2_drv) = {
.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 @@ static const struct test_ops test_manual_ops = {
.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 @@ static int test_manual_probe(struct device *dev)
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 e1d982fd7d1..6eccf111279 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 @@ static const struct test_ops test_ops = {
.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 @@ static int testfdt_ofdata_to_platdata(struct device *dev)
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 @@ U_BOOT_DRIVER(testfdt_drv) = {
};
/* 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 @@ UCLASS_DRIVER(testfdt) = {
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 828ed46f8e7..fbdae688e09 100644
--- a/test/dm/test-main.c
+++ b/test/dm/test-main.c
@@ -32,7 +32,7 @@ static int dm_test_init(struct dm_test_state *dms)
/* 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 8b564b89d98..017e097928c 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 @@ int test_ping(struct device *dev, int pingval, int *pingret)
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 @@ static int test_post_probe(struct device *dev)
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]++;