From: Anthony PERARD <anthony.perard@citrix.com>
To: QEMU-devel <qemu-devel@nongnu.org>
Cc: Anthony PERARD <anthony.perard@citrix.com>,
Xen Devel <xen-devel@lists.xensource.com>,
"Michael S . Tsirkin" <mst@redhat.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [Qemu-devel] [PATCH V10 4/8] pci.c: Add opaque argument to pci_for_each_device.
Date: Wed, 28 Mar 2012 12:41:43 +0100 [thread overview]
Message-ID: <1332934907-24080-5-git-send-email-anthony.perard@citrix.com> (raw)
In-Reply-To: <1332934907-24080-1-git-send-email-anthony.perard@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
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
next prev parent reply other threads:[~2012-03-28 11:42 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-28 11:41 [Qemu-devel] [PATCH V10 0/8] Xen PCI Passthrough Anthony PERARD
2012-03-28 11:41 ` [Qemu-devel] [PATCH V10 1/8] pci_ids: Add INTEL_82599_SFP_VF id Anthony PERARD
2012-03-28 18:53 ` [Qemu-devel] [Xen-devel] " Konrad Rzeszutek Wilk
2012-03-30 14:24 ` Anthony PERARD
2012-03-28 11:41 ` [Qemu-devel] [PATCH V10 2/8] configure: Introduce --enable-xen-pci-passthrough Anthony PERARD
2012-03-28 18:52 ` [Qemu-devel] [Xen-devel] " Konrad Rzeszutek Wilk
2012-03-28 21:02 ` Anthony Liguori
2012-03-28 21:07 ` Konrad Rzeszutek Wilk
2012-03-28 11:41 ` [Qemu-devel] [PATCH V10 3/8] Introduce XenHostPCIDevice to access a pci device on the host Anthony PERARD
2012-03-28 18:52 ` [Qemu-devel] [Xen-devel] " Konrad Rzeszutek Wilk
2012-03-30 14:21 ` Anthony PERARD
2012-03-30 14:39 ` Konrad Rzeszutek Wilk
2012-03-28 11:41 ` Anthony PERARD [this message]
2012-03-28 21:00 ` [Qemu-devel] [Xen-devel] [PATCH V10 4/8] pci.c: Add opaque argument to pci_for_each_device Konrad Rzeszutek Wilk
2012-03-30 14:36 ` Anthony PERARD
2012-03-28 11:41 ` [Qemu-devel] [PATCH V10 5/8] Introduce Xen PCI Passthrough, qdevice (1/3) Anthony PERARD
2012-03-28 11:41 ` [Qemu-devel] [PATCH V10 6/8] Introduce Xen PCI Passthrough, PCI config space helpers (2/3) Anthony PERARD
2012-03-28 11:41 ` [Qemu-devel] [PATCH V10 7/8] Introduce apic-msidef.h Anthony PERARD
2012-03-28 11:41 ` [Qemu-devel] [PATCH V10 8/8] Introduce Xen PCI Passthrough, MSI (3/3) Anthony PERARD
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1332934907-24080-5-git-send-email-anthony.perard@citrix.com \
--to=anthony.perard@citrix.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).