From: Trent Piepho Date: Fri, 20 Mar 2009 20:56:00 +0000 (-0600) Subject: PCI: don't scan existing devices X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=90bdb3117f4209baa6d712b126f0e7791b24dc3f;p=linux-2.6-omap-h63xx.git PCI: don't scan existing devices 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 Signed-off-by: Alex Chiang Signed-off-by: Jesse Barnes --- diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 943c49a7842..140b9deb482 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -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;