aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>2009-11-11 00:29:54 -0500
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-11-24 18:25:11 -0500
commitd7b7e60526d54da4c94afe5f137714cee7d05c41 (patch)
treee8cdf8d2e60c274848e860501234ebb958ab0ae9 /include
parent8c8def26bfaa704db67d515da3eb92cf26067548 (diff)
PCI: introduce pci_pcie_cap()
Introduce pci_pcie_cap() API that returns saved PCIe capability offset (currently it is saved in 'pcie_cap' field in the struct PCI dev). Using pci_pcie_cap() instead of pci_find_capability() 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 'include')
-rw-r--r--include/linux/pci.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 233b3a092035..15f37f102dd3 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1301,5 +1301,21 @@ extern void pci_hp_create_module_link(struct pci_slot *pci_slot);
1301extern void pci_hp_remove_module_link(struct pci_slot *pci_slot); 1301extern void pci_hp_remove_module_link(struct pci_slot *pci_slot);
1302#endif 1302#endif
1303 1303
1304/**
1305 * pci_pcie_cap - get the saved PCIe capability offset
1306 * @dev: PCI device
1307 *
1308 * PCIe capability offset is calculated at PCI device initialization
1309 * time and saved in the data structure. This function returns saved
1310 * PCIe capability offset. Using this instead of pci_find_capability()
1311 * reduces unnecessary search in the PCI configuration space. If you
1312 * need to calculate PCIe capability offset from raw device for some
1313 * reasons, please use pci_find_capability() instead.
1314 */
1315static inline int pci_pcie_cap(struct pci_dev *dev)
1316{
1317 return dev->pcie_cap;
1318}
1319
1304#endif /* __KERNEL__ */ 1320#endif /* __KERNEL__ */
1305#endif /* LINUX_PCI_H */ 1321#endif /* LINUX_PCI_H */