core: device: skip bind device already there

With kernel dtb support, there have two dtb and some device may the same,
skip it if already in the list, node in u-boot dtb will be used.

Change-Id: Ic9f8b73e3708a03416a9dc4ab6c72fa0184a6fdb
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
This commit is contained in:
Kever Yang 2018-02-07 11:44:27 +08:00
parent 01236d99d8
commit 89f947ecb4
1 changed files with 9 additions and 0 deletions

View File

@ -48,6 +48,15 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
return ret;
}
list_for_each_entry(dev, &uc->dev_head, uclass_node) {
if (!strcmp(name, dev->name)){
debug("%s do not bind dev already in list %s\n",
__func__, name);
dev->node = node;
return 0;
}
}
dev = calloc(1, sizeof(struct udevice));
if (!dev)
return -ENOMEM;