From dd72b3c1f1df57215329aa5ba9e9bb9ad0a65086 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Mon, 20 Sep 2010 11:42:11 -0400 Subject: [PATCH] linux: Use pci_device_get_parent_bridge instead of open-coding it Reviewed-by: Jeremy Huddleston Tested-by: Jeremy Huddleston Signed-off-by: Adam Jackson Reviewed-by: Jamey Sharp --- hw/xfree86/os-support/bus/linuxPci.c | 41 +--------------------------- 1 file changed, 1 insertion(+), 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;