From 7aa8cbb9211a7c93d37b79502915df5757d2fb17 Mon Sep 17 00:00:00 2001 From: Anthony PERARD Date: Thu, 21 Jun 2012 15:35:28 +0000 Subject: pci.c: Add opaque argument to pci_for_each_device. The purpose is to have a more generic pci_for_each_device by passing an extra argument to the function called on every device. This patch will be used in a next patch. Signed-off-by: Anthony PERARD Acked-by: Stefano Stabellini Acked-by: Michael S. Tsirkin Reviewed-by: Konrad Rzeszutek Wilk --- hw/pci.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'hw/pci.c') diff --git a/hw/pci.c b/hw/pci.c index bdfb3d6540..5c75f16781 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -1144,7 +1144,9 @@ static const pci_class_desc pci_class_descriptions[] = }; static void pci_for_each_device_under_bus(PCIBus *bus, - void (*fn)(PCIBus *b, PCIDevice *d)) + void (*fn)(PCIBus *b, PCIDevice *d, + void *opaque), + void *opaque) { PCIDevice *d; int devfn; @@ -1152,18 +1154,19 @@ static void pci_for_each_device_under_bus(PCIBus *bus, for(devfn = 0; devfn < ARRAY_SIZE(bus->devices); devfn++) { d = bus->devices[devfn]; if (d) { - fn(bus, d); + fn(bus, d, opaque); } } } void pci_for_each_device(PCIBus *bus, int bus_num, - void (*fn)(PCIBus *b, PCIDevice *d)) + void (*fn)(PCIBus *b, PCIDevice *d, void *opaque), + void *opaque) { bus = pci_find_bus_nr(bus, bus_num); if (bus) { - pci_for_each_device_under_bus(bus, fn); + pci_for_each_device_under_bus(bus, fn, opaque); } } -- cgit 1.4.1