From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:34102) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SD2cz-00054v-G8 for qemu-devel@nongnu.org; Wed, 28 Mar 2012 19:50:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SD03B-0004QK-By for qemu-devel@nongnu.org; Wed, 28 Mar 2012 17:05:06 -0400 Received: from acsinet15.oracle.com ([141.146.126.227]:21211) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SD03B-0004Q2-3b for qemu-devel@nongnu.org; Wed, 28 Mar 2012 17:05:01 -0400 Date: Wed, 28 Mar 2012 17:00:18 -0400 From: Konrad Rzeszutek Wilk Message-ID: <20120328210018.GA3360@phenom.dumpdata.com> References: <1332934907-24080-1-git-send-email-anthony.perard@citrix.com> <1332934907-24080-5-git-send-email-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1332934907-24080-5-git-send-email-anthony.perard@citrix.com> Subject: Re: [Qemu-devel] [Xen-devel] [PATCH V10 4/8] pci.c: Add opaque argument to pci_for_each_device. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony PERARD Cc: Xen Devel , QEMU-devel , Stefano Stabellini , "Michael S . Tsirkin" On Wed, Mar 28, 2012 at 12:41:43PM +0100, Anthony PERARD wrote: What is purpose of it? Can you give more details please? > Signed-off-by: Anthony PERARD > Acked-by: Stefano Stabellini > --- > hw/pci.c | 11 +++++++---- > hw/pci.h | 4 +++- > hw/xen_platform.c | 8 ++++---- > 3 files changed, 14 insertions(+), 9 deletions(-) > > diff --git a/hw/pci.c b/hw/pci.c > index 77001fa..49f1bf0 100644 > --- a/hw/pci.c > +++ b/hw/pci.c > @@ -1123,7 +1123,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; > @@ -1131,18 +1133,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(bus, bus_num); > > if (bus) { > - pci_for_each_device_under_bus(bus, fn); > + pci_for_each_device_under_bus(bus, fn, opaque); > } > } > > diff --git a/hw/pci.h b/hw/pci.h > index 4f19fdb..2827fd1 100644 > --- a/hw/pci.h > +++ b/hw/pci.h > @@ -296,7 +296,9 @@ PCIDevice *pci_nic_init(NICInfo *nd, const char *default_model, > PCIDevice *pci_nic_init_nofail(NICInfo *nd, const char *default_model, > const char *default_devaddr); > int pci_bus_num(PCIBus *s); > -void pci_for_each_device(PCIBus *bus, int bus_num, void (*fn)(PCIBus *bus, PCIDevice *d)); > +void pci_for_each_device(PCIBus *bus, int bus_num, > + void (*fn)(PCIBus *bus, PCIDevice *d, void *opaque), > + void *opaque); > PCIBus *pci_find_root_bus(int domain); > int pci_find_domain(const PCIBus *bus); > PCIBus *pci_find_bus(PCIBus *bus, int bus_num); > diff --git a/hw/xen_platform.c b/hw/xen_platform.c > index 5a7c4cc..88ff5e8 100644 > --- a/hw/xen_platform.c > +++ b/hw/xen_platform.c > @@ -83,7 +83,7 @@ static void log_writeb(PCIXenPlatformState *s, char val) > #define UNPLUG_ALL_NICS 2 > #define UNPLUG_AUX_IDE_DISKS 4 > > -static void unplug_nic(PCIBus *b, PCIDevice *d) > +static void unplug_nic(PCIBus *b, PCIDevice *d, void *o) > { > if (pci_get_word(d->config + PCI_CLASS_DEVICE) == > PCI_CLASS_NETWORK_ETHERNET) { > @@ -93,10 +93,10 @@ static void unplug_nic(PCIBus *b, PCIDevice *d) > > static void pci_unplug_nics(PCIBus *bus) > { > - pci_for_each_device(bus, 0, unplug_nic); > + pci_for_each_device(bus, 0, unplug_nic, NULL); > } > > -static void unplug_disks(PCIBus *b, PCIDevice *d) > +static void unplug_disks(PCIBus *b, PCIDevice *d, void *o) > { > if (pci_get_word(d->config + PCI_CLASS_DEVICE) == > PCI_CLASS_STORAGE_IDE) { > @@ -106,7 +106,7 @@ static void unplug_disks(PCIBus *b, PCIDevice *d) > > static void pci_unplug_disks(PCIBus *bus) > { > - pci_for_each_device(bus, 0, unplug_disks); > + pci_for_each_device(bus, 0, unplug_disks, NULL); > } > > static void platform_fixed_ioport_writew(void *opaque, uint32_t addr, uint32_t val) > -- > Anthony PERARD > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel