diff options
| author | David Gibson | 2017-11-29 09:46:26 +0100 |
|---|---|---|
| committer | Michael S. Tsirkin | 2017-12-05 18:13:45 +0100 |
| commit | cdc57472dcc2ddc440545bde26791a11b42232b6 (patch) | |
| tree | d34a294183491d58915f9004d2b5c058216dda06 /include/hw/pci | |
| parent | pci: Move bridge data structures from pci_bus.h to pci_bridge.h (diff) | |
| download | qemu-cdc57472dcc2ddc440545bde26791a11b42232b6.tar.gz qemu-cdc57472dcc2ddc440545bde26791a11b42232b6.tar.xz qemu-cdc57472dcc2ddc440545bde26791a11b42232b6.zip | |
pci: Add pci_dev_bus_num() helper
A fair proportion of the users of pci_bus_num() want to get the bus
number on a specific device, so first have to look up the bus from the
device then call it. This adds a helper to do that (since we're going
to make looking up the bus slightly more verbose).
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Diffstat (limited to 'include/hw/pci')
| -rw-r--r-- | include/hw/pci/pci.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 870ebcfd4b..e451235065 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -436,6 +436,11 @@ PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus, PCIDevice *pci_vga_init(PCIBus *bus); int pci_bus_num(PCIBus *s); +static inline int pci_dev_bus_num(const PCIDevice *dev) +{ + return pci_bus_num(dev->bus); +} + int pci_bus_numa_node(PCIBus *bus); void pci_for_each_device(PCIBus *bus, int bus_num, void (*fn)(PCIBus *bus, PCIDevice *d, void *opaque), |
