qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH RFC] pci: use current bus # for pci_for_each_device
@ 2013-04-21  8:39 Michael S. Tsirkin
  0 siblings, 0 replies; only message in thread
From: Michael S. Tsirkin @ 2013-04-21  8:39 UTC (permalink / raw)
  To: qemu-devel, anthony.perard

I see two types of users of pci_for_each_device: some pass in bus #
directly, some pass in 0.  I am guessing that those passing 0 really
want the root, so the right thing is likely to
use the bus number directly.
Could some Xen folks comment on whether the following
patch breaks anything?
If not I'll apply it, and will add another patch removing
bus_nr from pci_for_each_device completely, on top.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

---

Untested patch below.

diff --git a/hw/xen/xen_platform.c b/hw/xen/xen_platform.c
index b6c6793..7d2ca63 100644
--- a/hw/xen/xen_platform.c
+++ b/hw/xen/xen_platform.c
@@ -94,7 +94,7 @@ static void unplug_nic(PCIBus *b, PCIDevice *d, void *o)
 
 static void pci_unplug_nics(PCIBus *bus)
 {
-    pci_for_each_device(bus, 0, unplug_nic, NULL);
+    pci_for_each_device(bus, pci_bus_num(bus), unplug_nic, NULL);
 }
 
 static void unplug_disks(PCIBus *b, PCIDevice *d, void *o)
@@ -109,7 +109,7 @@ static void unplug_disks(PCIBus *b, PCIDevice *d, void *o)
 
 static void pci_unplug_disks(PCIBus *bus)
 {
-    pci_for_each_device(bus, 0, unplug_disks, NULL);
+    pci_for_each_device(bus, pci_bus_num(bus), unplug_disks, NULL);
 }
 
 static void platform_fixed_ioport_writew(void *opaque, uint32_t addr, uint32_t val)

-- 
MST

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-04-21  8:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-21  8:39 [Qemu-devel] [PATCH RFC] pci: use current bus # for pci_for_each_device Michael S. Tsirkin

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).