patch-2.1.91 linux/drivers/pci/pci.c

Next file: linux/drivers/scsi/53c7xx.c
Previous file: linux/drivers/nubus/nubus.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.90/linux/drivers/pci/pci.c linux/drivers/pci/pci.c
@@ -71,7 +71,7 @@
 unsigned int pci_scan_bus(struct pci_bus *bus, unsigned long *mem_startp)
 {
 	unsigned int devfn, l, max, class;
-	unsigned char cmd, irq, tmp, hdr_type = 0;
+	unsigned char cmd, irq, tmp, hdr_type, is_multi = 0;
 	struct pci_dev *dev;
 	struct pci_bus *child;
 	int reg;
@@ -82,12 +82,13 @@
 
 	max = bus->secondary;
 	for (devfn = 0; devfn < 0xff; ++devfn) {
-		if (PCI_FUNC(devfn) == 0) {
-			pcibios_read_config_byte(bus->number, devfn, PCI_HEADER_TYPE, &hdr_type);
-		} else if (!(hdr_type & 0x80)) {
+		if (PCI_FUNC(devfn) && !is_multi) {
 			/* not a multi-function device */
 			continue;
 		}
+		pcibios_read_config_byte(bus->number, devfn, PCI_HEADER_TYPE, &hdr_type);
+		if (!PCI_FUNC(devfn))
+			is_multi = hdr_type & 0x80;
 
 		pcibios_read_config_dword(bus->number, devfn, PCI_VENDOR_ID, &l);
 		/* some broken boards return 0 if a slot is empty: */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov