]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/pci/pci.c
Merge branch 'pci/misc' into next
[karo-tx-linux.git] / drivers / pci / pci.c
index 061fdce8f8e1906f3527bfbdee1678e8da5722c3..acc4b6ef78c4380273b1af144838582dde57f80a 100644 (file)
@@ -146,19 +146,22 @@ static int __pci_find_next_cap_ttl(struct pci_bus *bus, unsigned int devfn,
                                   u8 pos, int cap, int *ttl)
 {
        u8 id;
+       u16 ent;
+
+       pci_bus_read_config_byte(bus, devfn, pos, &pos);
 
        while ((*ttl)--) {
-               pci_bus_read_config_byte(bus, devfn, pos, &pos);
                if (pos < 0x40)
                        break;
                pos &= ~3;
-               pci_bus_read_config_byte(bus, devfn, pos + PCI_CAP_LIST_ID,
-                                        &id);
+               pci_bus_read_config_word(bus, devfn, pos, &ent);
+
+               id = ent & 0xff;
                if (id == 0xff)
                        break;
                if (id == cap)
                        return pos;
-               pos += PCI_CAP_LIST_NEXT;
+               pos = (ent >> 8);
        }
        return 0;
 }