dm: core: Add device_foreach_child()

We have a 'safe' version of this function but sometimes it is not needed.
Add a normal version too and update a few places that can use it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
Simon Glass
2019-09-25 08:55:56 -06:00
committed by Bin Meng
parent 4805a7af8e
commit e5f7390458
3 changed files with 13 additions and 4 deletions

View File

@@ -679,6 +679,15 @@ static inline bool device_is_on_pci_bus(struct udevice *dev)
#define device_foreach_child_safe(pos, next, parent) \
list_for_each_entry_safe(pos, next, &parent->child_head, sibling_node)
/**
* device_foreach_child() - iterate through child devices
*
* @pos: struct udevice * for the current device
* @parent: parent device to scan
*/
#define device_foreach_child(pos, parent) \
list_for_each_entry(pos, &parent->child_head, sibling_node)
/**
* dm_scan_fdt_dev() - Bind child device in a the device tree
*