Skip to content
Snippets Groups Projects
Commit 54c5d08a authored by Heiko Schocher's avatar Heiko Schocher Committed by Tom Rini
Browse files

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: default avatarHeiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Marek Vasut <marex@denx.de>
parent 9665fa8f
No related branches found
No related tags found
No related merge requests found
......@@ -30,7 +30,7 @@ struct dm_test_pdata {
* @return 0 if OK, -ve on error
*/
struct test_ops {
int (*ping)(struct device *dev, int pingval, int *pingret);
int (*ping)(struct udevice *dev, int pingval, int *pingret);
};
/* Operations that our test driver supports */
......@@ -102,8 +102,8 @@ extern struct dm_test_state global_test_state;
* @skip_post_probe: Skip uclass post-probe processing
*/
struct dm_test_state {
struct device *root;
struct device *testdev;
struct udevice *root;
struct udevice *testdev;
int fail_count;
int force_fail_alloc;
int skip_post_probe;
......@@ -138,8 +138,8 @@ struct dm_test {
}
/* Declare ping methods for the drivers */
int test_ping(struct device *dev, int pingval, int *pingret);
int testfdt_ping(struct device *dev, int pingval, int *pingret);
int test_ping(struct udevice *dev, int pingval, int *pingret);
int testfdt_ping(struct udevice *dev, int pingval, int *pingret);
/**
* dm_check_operations() - Check that we can perform ping operations
......@@ -152,7 +152,7 @@ int testfdt_ping(struct device *dev, int pingval, int *pingret);
* @priv: Pointer to private test information
* @return 0 if OK, -ve on error
*/
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);
/**
......
......@@ -21,7 +21,7 @@
* @return the uclass pointer of a child at the given index or
* return NULL on error.
*/
int uclass_find_device(enum uclass_id id, int index, struct device **devp);
int uclass_find_device(enum uclass_id id, int index, struct udevice **devp);
/**
* uclass_bind_device() - Associate device with a uclass
......@@ -31,7 +31,7 @@ int uclass_find_device(enum uclass_id id, int index, struct device **devp);
* @dev: Pointer to the device
* #return 0 on success, -ve on error
*/
int uclass_bind_device(struct device *dev);
int uclass_bind_device(struct udevice *dev);
/**
* uclass_unbind_device() - Deassociate device with a uclass
......@@ -41,7 +41,7 @@ int uclass_bind_device(struct device *dev);
* @dev: Pointer to the device
* #return 0 on success, -ve on error
*/
int uclass_unbind_device(struct device *dev);
int uclass_unbind_device(struct udevice *dev);
/**
* uclass_post_probe_device() - Deal with a device that has just been probed
......@@ -52,7 +52,7 @@ int uclass_unbind_device(struct device *dev);
* @dev: Pointer to the device
* #return 0 on success, -ve on error
*/
int uclass_post_probe_device(struct device *dev);
int uclass_post_probe_device(struct udevice *dev);
/**
* uclass_pre_remove_device() - Handle a device which is about to be removed
......@@ -62,7 +62,7 @@ int uclass_post_probe_device(struct device *dev);
* @dev: Pointer to the device
* #return 0 on success, -ve on error
*/
int uclass_pre_remove_device(struct device *dev);
int uclass_pre_remove_device(struct udevice *dev);
/**
* uclass_find() - Find uclass by its id
......
......@@ -37,7 +37,7 @@ struct uclass {
struct list_head sibling_node;
};
struct device;
struct udevice;
/**
* struct uclass_driver - Driver for the uclass
......@@ -65,10 +65,10 @@ struct device;
struct uclass_driver {
const char *name;
enum uclass_id id;
int (*post_bind)(struct device *dev);
int (*pre_unbind)(struct device *dev);
int (*post_probe)(struct device *dev);
int (*pre_remove)(struct device *dev);
int (*post_bind)(struct udevice *dev);
int (*pre_unbind)(struct udevice *dev);
int (*post_probe)(struct udevice *dev);
int (*pre_remove)(struct udevice *dev);
int (*init)(struct uclass *class);
int (*destroy)(struct uclass *class);
int priv_auto_alloc_size;
......@@ -101,7 +101,7 @@ int uclass_get(enum uclass_id key, struct uclass **ucp);
* @ucp: Returns pointer to uclass (there is only one per for each ID)
* @return 0 if OK, -ve on error
*/
int uclass_get_device(enum uclass_id id, int index, struct device **ucp);
int uclass_get_device(enum uclass_id id, int index, struct udevice **ucp);
/**
* uclass_first_device() - Get the first device in a uclass
......@@ -110,7 +110,7 @@ int uclass_get_device(enum uclass_id id, int index, struct device **ucp);
* @devp: Returns pointer to the first device in that uclass, or NULL if none
* @return 0 if OK (found or not found), -1 on error
*/
int uclass_first_device(enum uclass_id id, struct device **devp);
int uclass_first_device(enum uclass_id id, struct udevice **devp);
/**
* uclass_next_device() - Get the next device in a uclass
......@@ -119,7 +119,7 @@ int uclass_first_device(enum uclass_id id, struct device **devp);
* to the next device in the same uclass, or NULL if none
* @return 0 if OK (found or not found), -1 on error
*/
int uclass_next_device(struct device **devp);
int uclass_next_device(struct udevice **devp);
/**
* uclass_foreach_dev() - Helper function to iteration through devices
......@@ -127,7 +127,7 @@ int uclass_next_device(struct device **devp);
* This creates a for() loop which works through the available devices in
* a uclass in order from start to end.
*
* @pos: struct device * to hold the current device. Set to NULL when there
* @pos: struct udevice * to hold the current device. Set to NULL when there
* are no more devices.
* uc: uclass to scan
*/
......
......@@ -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)
......
......@@ -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;
......
......@@ -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];
......
......@@ -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;
......
......@@ -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;
......
......@@ -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 */
......
......@@ -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]++;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment