summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2010-09-20 11:42:11 -0400
committerJeremy Huddleston <jeremyhu@apple.com>2011-10-15 21:18:46 -0700
commitdd72b3c1f1df57215329aa5ba9e9bb9ad0a65086 (patch)
treeca6fd906914a315ab49a54a7d86eb6863b4b6b62
parent858fbbb40d7c69540cd1fb5315cebf811c6e7b3f (diff)
linux: Use pci_device_get_parent_bridge instead of open-coding it
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> Tested-by: Jeremy Huddleston <jeremyhu@apple.com> Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Jamey Sharp <jamey@minilop.net>
-rw-r--r--hw/xfree86/os-support/bus/linuxPci.c41
1 files changed, 1 insertions, 40 deletions
diff --git a/hw/xfree86/os-support/bus/linuxPci.c b/hw/xfree86/os-support/bus/linuxPci.c
index 28bba019e..2778bba2e 100644
--- a/hw/xfree86/os-support/bus/linuxPci.c
+++ b/hw/xfree86/os-support/bus/linuxPci.c
@@ -160,45 +160,6 @@ linuxPciOpenFile(struct pci_device *dev, Bool write)
#endif
-/* This probably shouldn't be Linux-specific */
-static struct pci_device *
-get_parent_bridge(struct pci_device *dev)
-{
- struct pci_id_match bridge_match = {
- PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
- (PCI_CLASS_BRIDGE << 16) | (PCI_SUBCLASS_BRIDGE_PCI << 8),
- 0
- };
- struct pci_device *bridge;
- struct pci_device_iterator *iter;
-
- if (dev == NULL) {
- return NULL;
- }
-
- iter = pci_id_match_iterator_create(& bridge_match);
- if (iter == NULL) {
- return NULL;
- }
-
- while ((bridge = pci_device_next(iter)) != NULL) {
- if (bridge->domain == dev->domain) {
- const struct pci_bridge_info *info =
- pci_device_get_bridge_info(bridge);
-
- if (info != NULL) {
- if (info->secondary_bus == dev->bus) {
- break;
- }
- }
- }
- }
-
- pci_iterator_destroy(iter);
-
- return bridge;
-}
-
static pointer
linuxMapPci(int ScreenNum, int Flags, struct pci_device *dev,
ADDRESS Base, unsigned long Size, int mmap_ioctl)
@@ -283,7 +244,7 @@ linuxOpenLegacy(struct pci_device *dev, char *name)
return fd;
}
- dev = get_parent_bridge(dev);
+ dev = pci_device_get_parent_bridge(dev);
}
return fd;