diff options
author | Simon Glass <sjg@chromium.org> | 2019-09-25 08:55:56 -0600 |
---|---|---|
committer | Bin Meng <bmeng.cn@gmail.com> | 2019-10-08 13:57:39 +0800 |
commit | e5f739045890eef2e97488c9c2a7d036ab908e58 (patch) | |
tree | a35da1bad47f5795ad8a66b644e0de06f6ba7618 /include/dm | |
parent | 4805a7af8ebd4c604e1e32355927ec5035685121 (diff) |
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>
Diffstat (limited to 'include/dm')
-rw-r--r-- | include/dm/device.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/dm/device.h b/include/dm/device.h index 27a6d7b9fd..d1210429e9 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -680,6 +680,15 @@ static inline bool device_is_on_pci_bus(struct udevice *dev) 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 * * This handles device which have sub-nodes in the device tree. It scans all |