aboutsummaryrefslogtreecommitdiff
path: root/drivers/pci/pci.c
diff options
context:
space:
mode:
authorKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>2009-11-11 14:30:56 +0900
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-11-24 15:25:12 -0800
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 e3145f02027..bbc82f08d1c 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)
u16 *cap;
u16 flags;
- pos = pci_find_capability(dev, PCI_CAP_ID_EXP);
- if (pos <= 0)
+ pos = pci_pcie_cap(dev);
+ if (!pos)
return 0;
save_state = pci_find_saved_cap(dev, PCI_CAP_ID_EXP);
@@ -1535,7 +1535,7 @@ void pci_enable_ari(struct pci_dev *dev)
if (!bridge || !bridge->is_pcie)
return;
- pos = pci_find_capability(bridge, PCI_CAP_ID_EXP);
+ pos = pci_pcie_cap(bridge);
if (!pos)
return;
@@ -2140,7 +2140,7 @@ static int pcie_flr(struct pci_dev *dev, int probe)
u32 cap;
u16 status;
- pos = pci_find_capability(dev, PCI_CAP_ID_EXP);
+ pos = pci_pcie_cap(dev);
if (!pos)
return -ENOTTY;
@@ -2489,7 +2489,7 @@ int pcie_get_readrq(struct pci_dev *dev)
int ret, cap;
u16 ctl;
- cap = pci_find_capability(dev, PCI_CAP_ID_EXP);
+ cap = pci_pcie_cap(dev);
if (!cap)
return -EINVAL;
@@ -2519,7 +2519,7 @@ int pcie_set_readrq(struct pci_dev *dev, int rq)
v = (ffs(rq) - 8) << 12;
- cap = pci_find_capability(dev, PCI_CAP_ID_EXP);
+ cap = pci_pcie_cap(dev);
if (!cap)
goto out;