dm: core: Add a way to iterate through children, probing each
It is sometimes useful to process all children, making sure they are probed first. Add functions to help with this and a macro to make it more convenient. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -792,6 +792,28 @@ int device_find_child_by_name(const struct udevice *parent, const char *name,
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
int device_first_child_err(struct udevice *parent, struct udevice **devp)
|
||||
{
|
||||
struct udevice *dev;
|
||||
|
||||
device_find_first_child(parent, &dev);
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
|
||||
return device_get_device_tail(dev, 0, devp);
|
||||
}
|
||||
|
||||
int device_next_child_err(struct udevice **devp)
|
||||
{
|
||||
struct udevice *dev = *devp;
|
||||
|
||||
device_find_next_child(&dev);
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
|
||||
return device_get_device_tail(dev, 0, devp);
|
||||
}
|
||||
|
||||
int device_first_child_ofdata_err(struct udevice *parent, struct udevice **devp)
|
||||
{
|
||||
struct udevice *dev;
|
||||
|
||||
Reference in New Issue
Block a user