projects
/
GitHub
/
LineageOS
/
android_kernel_motorola_exynos9610.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
387d375
)
PCI: Read capability list as dwords, not bytes
author
Sean O. Stalley
<sean.stalley@intel.com>
Thu, 2 Apr 2015 21:10:19 +0000
(14:10 -0700)
committer
Bjorn Helgaas
<bhelgaas@google.com>
Thu, 9 Apr 2015 22:01:39 +0000
(17:01 -0500)
Reading both the capability ID and "next" pointer at the same time lets us
parse the list with half the number of config reads.
Signed-off-by: Sean O. Stalley <sean.stalley@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/pci.c
patch
|
blob
|
blame
|
history
diff --git
a/drivers/pci/pci.c
b/drivers/pci/pci.c
index 81f06e8dcc0449688e05b65504413320628b1579..3c84cc6bc75a965e64a56ecc57da29bd261d85e4 100644
(file)
--- a/
drivers/pci/pci.c
+++ b/
drivers/pci/pci.c
@@
-145,19
+145,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;
}