]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
PCI: don't scan existing devices
authorTrent Piepho <xyzzy@speakeasy.org>
Fri, 20 Mar 2009 20:56:00 +0000 (14:56 -0600)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Fri, 20 Mar 2009 21:56:45 +0000 (14:56 -0700)
pci_scan_single_device is supposed to add newly discovered
devices to pci_bus->devices, but doesn't check to see if the
device has already been added. This can cause problems if we ever
want to use this interface to rescan the PCI bus.

If the device is already added, just return it.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Alex Chiang <achiang@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
drivers/pci/probe.c

index 943c49a7842c3cca6803e5f05822c18d72e1184a..140b9deb482c5cc06c7a3b44721d27aa4fa692aa 100644 (file)
@@ -1019,6 +1019,12 @@ struct pci_dev *__ref pci_scan_single_device(struct pci_bus *bus, int devfn)
 {
        struct pci_dev *dev;
 
+       dev = pci_get_slot(bus, devfn);
+       if (dev) {
+               pci_dev_put(dev);
+               return dev;
+       }
+
        dev = pci_scan_device(bus, devfn);
        if (!dev)
                return NULL;