aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci.c
diff options
context:
space:
mode:
authorKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>2009-11-11 00:30:56 -0500
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-11-24 18:25:12 -0500
commit06a1cbafb253c4c60d6a54a994887f5fbceabcc0 (patch)
treee534c369ab1878a5d86996c29d629d1f5d8f9f75 /drivers/pci/pci.c
parentd7b7e60526d54da4c94afe5f137714cee7d05c41 (diff)
PCI: use pci_pcie_cap() in pci core
Use pcie_cap() instead of pci_find_capability() to get PCIe capability offset in PCI core code. This avoids unnecessary search in PCI configuration space. Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r--drivers/pci/pci.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index e3145f020271..bbc82f08d1c1 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -741,8 +741,8 @@ static int pci_save_pcie_state(struct pci_dev *dev)
741 u16 *cap; 741 u16 *cap;
742 u16 flags; 742 u16 flags;
743 743
744 pos = pci_find_capability(dev, PCI_CAP_ID_EXP); 744 pos = pci_pcie_cap(dev);
745 if (pos <= 0) 745 if (!pos)
746 return 0; 746 return 0;
747 747
748 save_state = pci_find_saved_cap(dev, PCI_CAP_ID_EXP); 748 save_state = pci_find_saved_cap(dev, PCI_CAP_ID_EXP);
@@ -1535,7 +1535,7 @@ void pci_enable_ari(struct pci_dev *dev)
1535 if (!bridge || !bridge->is_pcie) 1535 if (!bridge || !bridge->is_pcie)
1536 return; 1536 return;
1537 1537
1538 pos = pci_find_capability(bridge, PCI_CAP_ID_EXP); 1538 pos = pci_pcie_cap(bridge);
1539 if (!pos) 1539 if (!pos)
1540 return; 1540 return;
1541 1541
@@ -2140,7 +2140,7 @@ static int pcie_flr(struct pci_dev *dev, int probe)
2140 u32 cap; 2140 u32 cap;
2141 u16 status; 2141 u16 status;
2142 2142
2143 pos = pci_find_capability(dev, PCI_CAP_ID_EXP); 2143 pos = pci_pcie_cap(dev);
2144 if (!pos) 2144 if (!pos)
2145 return -ENOTTY; 2145 return -ENOTTY;
2146 2146
@@ -2489,7 +2489,7 @@ int pcie_get_readrq(struct pci_dev *dev)
2489 int ret, cap; 2489 int ret, cap;
2490 u16 ctl; 2490 u16 ctl;
2491 2491
2492 cap = pci_find_capability(dev, PCI_CAP_ID_EXP); 2492 cap = pci_pcie_cap(dev);
2493 if (!cap) 2493 if (!cap)
2494 return -EINVAL; 2494 return -EINVAL;
2495 2495
@@ -2519,7 +2519,7 @@ int pcie_set_readrq(struct pci_dev *dev, int rq)
2519 2519
2520 v = (ffs(rq) - 8) << 12; 2520 v = (ffs(rq) - 8) << 12;
2521 2521
2522 cap = pci_find_capability(dev, PCI_CAP_ID_EXP); 2522 cap = pci_pcie_cap(dev);
2523 if (!cap) 2523 if (!cap)
2524 goto out; 2524 goto out;
2525 2525