qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org, anthony.perard@citrix.com
Subject: [Qemu-devel] [PATCH RFC] pci: use current bus # for pci_for_each_device
Date: Sun, 21 Apr 2013 11:39:42 +0300	[thread overview]
Message-ID: <20130421083942.GA24418@redhat.com> (raw)

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

                 reply	other threads:[~2013-04-21  8:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20130421083942.GA24418@redhat.com \
    --to=mst@redhat.com \
    --cc=anthony.perard@citrix.com \
    --cc=qemu-devel@nongnu.org \
    /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).