diff options
author | Johannes Thumshirn <jthumshirn@suse.de> | 2016-11-02 23:35:51 +0100 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2016-11-23 23:23:23 +0100 |
commit | e784930bd645e7df78c66e7872fec282b0620075 (patch) | |
tree | aacbaa3ec79f78793b60c719291fdcfe55a3ac3d /include | |
parent | PCI: designware-plat: Update author email (diff) | |
download | linux-e784930bd645e7df78c66e7872fec282b0620075.tar.xz linux-e784930bd645e7df78c66e7872fec282b0620075.zip |
PCI: Export pcie_find_root_port
Export pcie_find_root_port() so we can use it outside of PCIe-AER error
injection.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/pci.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h index 0e49f70dbd9b..a38772a85588 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1928,6 +1928,20 @@ static inline int pci_pcie_type(const struct pci_dev *dev) return (pcie_caps_reg(dev) & PCI_EXP_FLAGS_TYPE) >> 4; } +static inline struct pci_dev *pcie_find_root_port(struct pci_dev *dev) +{ + while (1) { + if (!pci_is_pcie(dev)) + break; + if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT) + return dev; + if (!dev->bus->self) + break; + dev = dev->bus->self; + } + return NULL; +} + void pci_request_acs(void); bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags); bool pci_acs_path_enabled(struct pci_dev *start, |