diff options
author | Isaku Yamahata | 2009-10-30 13:21:24 +0100 |
---|---|---|
committer | Anthony Liguori | 2009-11-09 15:43:10 +0100 |
commit | 1074df4f29706c45c2754ec78b22c2d28504ebdf (patch) | |
tree | 7d8a0351b5d0b29d402f74216a0fb47e6544a1bf /hw/pci.c | |
parent | pci: cosmetic on pci_upadte_mappings() (diff) | |
download | qemu-1074df4f29706c45c2754ec78b22c2d28504ebdf.tar.gz qemu-1074df4f29706c45c2754ec78b22c2d28504ebdf.tar.xz qemu-1074df4f29706c45c2754ec78b22c2d28504ebdf.zip |
pci: factor out pci_for_each_device().
split out device iteration logic from pci_for_each_device().
factored out function, pci_for_each_device_under_bus() will be used later.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/pci.c')
-rw-r--r-- | hw/pci.c | 21 |
1 files changed, 14 insertions, 7 deletions
@@ -885,19 +885,26 @@ static void pci_info_device(PCIBus *bus, PCIDevice *d) } } -void pci_for_each_device(PCIBus *bus, int bus_num, - void (*fn)(PCIBus *b, PCIDevice *d)) +static void pci_for_each_device_under_bus(PCIBus *bus, + void (*fn)(PCIBus *b, PCIDevice *d)) { PCIDevice *d; int devfn; + for(devfn = 0; devfn < 256; devfn++) { + d = bus->devices[devfn]; + if (d) + fn(bus, d); + } +} + +void pci_for_each_device(PCIBus *bus, int bus_num, + void (*fn)(PCIBus *b, PCIDevice *d)) +{ bus = pci_find_bus(bus, bus_num); + if (bus) { - for(devfn = 0; devfn < 256; devfn++) { - d = bus->devices[devfn]; - if (d) - fn(bus, d); - } + pci_for_each_device_under_bus(bus, fn); } } |