[PATCH] PCMCIA bug fix

From: Andrey Ulanov
Date: Tue Jun 29 2004 - 10:33:37 EST


I tested with one of ieee1394+usb2.0 PCMCIA adapters. Worked fine.
Without this patch only first device (ieee1394 controller) was
detected.

Please apply.
--
with best regards, Andrey Ulanov.
--- linux/drivers/pcmcia/cardbus.c.pcmcia 2004-06-29 18:37:27.000000000 +0400
+++ linux/drivers/pcmcia/cardbus.c 2004-06-29 18:39:37.000000000 +0400
@@ -435,12 +435,12 @@
pci_readb(&tmp, PCI_HEADER_TYPE, &hdr);
fn = 1;
if (hdr & 0x80) {
- do {
- tmp.devfn = fn;
+ for (i = 0; i < 8; i++) {
+ tmp.devfn = i;
if (pci_readw(&tmp, PCI_VENDOR_ID, &v) || !v || v == 0xffff)
- break;
+ continue;
fn++;
- } while (fn < 8);
+ };
}
s->functions = fn;

@@ -450,11 +450,17 @@
memset(c, 0, fn * sizeof(struct cb_config_t));

irq = s->cap.pci_irq;
- for (i = 0; i < fn; i++) {
- struct pci_dev *dev = &c[i].dev;
+ for (i = 0, fn = 0; i < 8; i++) {
+ struct pci_dev *dev = &c[fn].dev;
u8 irq_pin;
int r;

+ tmp.devfn = i;
+ if(pci_readw(&tmp, PCI_VENDOR_ID, &v) || !v || v == 0xffff)
+ continue;
+
+ fn++;
+
dev->bus = bus;
dev->sysdata = bus->sysdata;
dev->devfn = i;