aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/pci/probe.c40
1 files changed, 16 insertions, 24 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 140b9deb482c..f3aabdf28f84 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1043,35 +1043,27 @@ EXPORT_SYMBOL(pci_scan_single_device);
1043 * Scan a PCI slot on the specified PCI bus for devices, adding 1043 * Scan a PCI slot on the specified PCI bus for devices, adding
1044 * discovered devices to the @bus->devices list. New devices 1044 * discovered devices to the @bus->devices list. New devices
1045 * will not have is_added set. 1045 * will not have is_added set.
1046 *
1047 * Returns the number of new devices found.
1046 */ 1048 */
1047int pci_scan_slot(struct pci_bus *bus, int devfn) 1049int pci_scan_slot(struct pci_bus *bus, int devfn)
1048{ 1050{
1049 int func, nr = 0; 1051 int fn, nr = 0;
1050 int scan_all_fns; 1052 struct pci_dev *dev;
1051
1052 scan_all_fns = pcibios_scan_all_fns(bus, devfn);
1053
1054 for (func = 0; func < 8; func++, devfn++) {
1055 struct pci_dev *dev;
1056
1057 dev = pci_scan_single_device(bus, devfn);
1058 if (dev) {
1059 nr++;
1060 1053
1061 /* 1054 dev = pci_scan_single_device(bus, devfn);
1062 * If this is a single function device, 1055 if (dev && !dev->is_added) /* new device? */
1063 * don't scan past the first function. 1056 nr++;
1064 */ 1057
1065 if (!dev->multifunction) { 1058 if ((dev && dev->multifunction) ||
1066 if (func > 0) { 1059 (!dev && pcibios_scan_all_fns(bus, devfn))) {
1067 dev->multifunction = 1; 1060 for (fn = 1; fn < 8; fn++) {
1068 } else { 1061 dev = pci_scan_single_device(bus, devfn + fn);
1069 break; 1062 if (dev) {
1070 } 1063 if (!dev->is_added)
1064 nr++;
1065 dev->multifunction = 1;
1071 } 1066 }
1072 } else {
1073 if (func == 0 && !scan_all_fns)
1074 break;
1075 } 1067 }
1076 } 1068 }
1077 1069