[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH V6 30/32] pci: factor out pci_for_each_device().
From: |
Isaku Yamahata |
Subject: |
[Qemu-devel] [PATCH V6 30/32] pci: factor out pci_for_each_device(). |
Date: |
Fri, 30 Oct 2009 21:21:24 +0900 |
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 <address@hidden>
---
hw/pci.c | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/hw/pci.c b/hw/pci.c
index b43f6c6..d565f6e 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -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);
}
}
--
1.6.0.2
- [Qemu-devel] [PATCH V6 13/32] pci_host: consolidate pci config address access., (continued)
- [Qemu-devel] [PATCH V6 13/32] pci_host: consolidate pci config address access., Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 23/32] vmstate: introduce VMSTATE_BUFFER_UNSAFE_INFO., Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 24/32] pci: pcie host and mmcfg support., Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 07/32] pci/bridge: clean up of pci_bridge_initfn(), Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 31/32] pci: implement pci bridge filtering., Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 25/32] pci: add helper functions to check ranges overlap., Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 08/32] pci: clean up pci_init_wmask(), Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 28/32] pci: initialize pci config headers depending it pci header type., Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 32/32] pci/monitor: print out bridge's filtering values and so on., Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 20/32] pci: factor out the conversion logic from io port address into pci device., Isaku Yamahata, 2009/10/30
- [Qemu-devel] [PATCH V6 30/32] pci: factor out pci_for_each_device().,
Isaku Yamahata <=
- [Qemu-devel] [PATCH V6 19/32] pci: make pci configuration transaction more accurate., Isaku Yamahata, 2009/10/30