diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/core/device.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/core/device.c b/drivers/core/device.c index b7f59fcde34..c948d8dbbc8 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -792,6 +792,42 @@ int device_find_child_by_name(const struct udevice *parent, const char *name, return -ENODEV; } +int device_first_child_ofdata_err(struct udevice *parent, struct udevice **devp) +{ + struct udevice *dev; + int ret; + + device_find_first_child(parent, &dev); + if (!dev) + return -ENODEV; + + ret = device_ofdata_to_platdata(dev); + if (ret) + return ret; + + *devp = dev; + + return 0; +} + +int device_next_child_ofdata_err(struct udevice **devp) +{ + struct udevice *dev = *devp; + int ret; + + device_find_next_child(&dev); + if (!dev) + return -ENODEV; + + ret = device_ofdata_to_platdata(dev); + if (ret) + return ret; + + *devp = dev; + + return 0; +} + struct udevice *dev_get_parent(const struct udevice *child) { return child->parent; |