diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2013-06-06 18:48:48 +1000 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2013-07-07 23:10:57 +0300 |
commit | c473d18da1b73301c580115e527207b73dcd597f (patch) | |
tree | b38fd6fc17cfba6c05754543c9dd08c086dbcff8 /include | |
parent | 1ef7a2a2afedbba47e06af5081a8b4bf6dc1cf71 (diff) | |
download | qemu-c473d18da1b73301c580115e527207b73dcd597f.tar.gz qemu-c473d18da1b73301c580115e527207b73dcd597f.tar.bz2 qemu-c473d18da1b73301c580115e527207b73dcd597f.zip |
pci: Use helper to find device's root bus in pci_find_domain()
Currently pci_find_domain() performs two functions - it locates the PCI
root bus above the given bus, then looks up that root bus's domain number.
This patch adds a helper function to perform the first task, finding the
root bus for a given PCI device. This is then used in pci_find_domain().
This changes pci_find_domain()'s signature slightly, taking a PCIDevice
instead of a PCIBus - since all callers passed something of the form
dev->bus, this simplifies things slightly.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/hw/pci/pci.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 7b89d88106..f2bf1edbd9 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -390,7 +390,8 @@ void pci_for_each_device(PCIBus *bus, int bus_num, void (*fn)(PCIBus *bus, PCIDevice *d, void *opaque), void *opaque); PCIBus *pci_find_primary_bus(void); -int pci_find_domain(const PCIBus *bus); +PCIBus *pci_device_root_bus(const PCIDevice *d); +int pci_find_domain(const PCIDevice *dev); PCIDevice *pci_find_device(PCIBus *bus, int bus_num, uint8_t devfn); int pci_qdev_find_device(const char *id, PCIDevice **pdev); PCIBus *pci_get_bus_devfn(int *devfnp, const char *devaddr); |