device: add child traversal helper function

Add a function, dev_bus_each_child(), which walks through all the
children for a given bus of a device. This helper allows one to
walk through all the children of a given device's bus.

BUG=b:111808427,b:111743717
TEST=built

Change-Id: Iedceb0d19c05b7abd5a48f8dc30f85461bef5ec6
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/27636
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Justin TerAvest <teravest@chromium.org>
This commit is contained in:
Aaron Durbin
2018-07-25 08:49:19 -06:00
parent 8c2852420c
commit a0dabd1848
2 changed files with 27 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
#ifndef DEVICE_H
#define DEVICE_H
/*
@@ -275,6 +276,8 @@ DEVTREE_CONST struct device *dev_find_next_pci_device(
DEVTREE_CONST struct device *dev_find_slot_on_smbus(unsigned int bus,
unsigned int addr);
DEVTREE_CONST struct device *dev_find_slot_pnp(u16 port, u16 device);
DEVTREE_CONST struct device *dev_bus_each_child(const struct bus *parent,
DEVTREE_CONST struct device *prev_child);
void scan_smbus(struct device *bus);
void scan_generic_bus(struct device *bus);