diff options
author | Johannes Thumshirn <jthumshirn@suse.de> | 2016-11-02 18:35:51 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2016-11-23 17:23:23 -0500 |
commit | e784930bd645e7df78c66e7872fec282b0620075 (patch) | |
tree | aacbaa3ec79f78793b60c719291fdcfe55a3ac3d | |
parent | 9f46107b8ce4f9a4bd6be50e2967df506d1c1631 (diff) |
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>
-rw-r--r-- | drivers/pci/pcie/aer/aer_inject.c | 14 | ||||
-rw-r--r-- | include/linux/pci.h | 14 |
2 files changed, 14 insertions, 14 deletions
diff --git a/drivers/pci/pcie/aer/aer_inject.c b/drivers/pci/pcie/aer/aer_inject.c index db553dc22c8e..2b6a59266689 100644 --- a/drivers/pci/pcie/aer/aer_inject.c +++ b/drivers/pci/pcie/aer/aer_inject.c | |||
@@ -307,20 +307,6 @@ out: | |||
307 | return 0; | 307 | return 0; |
308 | } | 308 | } |
309 | 309 | ||
310 | static struct pci_dev *pcie_find_root_port(struct pci_dev *dev) | ||
311 | { | ||
312 | while (1) { | ||
313 | if (!pci_is_pcie(dev)) | ||
314 | break; | ||
315 | if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT) | ||
316 | return dev; | ||
317 | if (!dev->bus->self) | ||
318 | break; | ||
319 | dev = dev->bus->self; | ||
320 | } | ||
321 | return NULL; | ||
322 | } | ||
323 | |||
324 | static int find_aer_device_iter(struct device *device, void *data) | 310 | static int find_aer_device_iter(struct device *device, void *data) |
325 | { | 311 | { |
326 | struct pcie_device **result = data; | 312 | struct pcie_device **result = data; |
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) | |||
1928 | return (pcie_caps_reg(dev) & PCI_EXP_FLAGS_TYPE) >> 4; | 1928 | return (pcie_caps_reg(dev) & PCI_EXP_FLAGS_TYPE) >> 4; |
1929 | } | 1929 | } |
1930 | 1930 | ||
1931 | static inline struct pci_dev *pcie_find_root_port(struct pci_dev *dev) | ||
1932 | { | ||
1933 | while (1) { | ||
1934 | if (!pci_is_pcie(dev)) | ||
1935 | break; | ||
1936 | if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT) | ||
1937 | return dev; | ||
1938 | if (!dev->bus->self) | ||
1939 | break; | ||
1940 | dev = dev->bus->self; | ||
1941 | } | ||
1942 | return NULL; | ||
1943 | } | ||
1944 | |||
1931 | void pci_request_acs(void); | 1945 | void pci_request_acs(void); |
1932 | bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags); | 1946 | bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags); |
1933 | bool pci_acs_path_enabled(struct pci_dev *start, | 1947 | bool pci_acs_path_enabled(struct pci_dev *start, |