Skip to content

Commit e784930

Browse files
Johannes Thumshirnbjorn-helgaas
authored andcommitted
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>
1 parent 9f46107 commit e784930

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

drivers/pci/pcie/aer/aer_inject.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -307,20 +307,6 @@ static int pci_bus_set_aer_ops(struct pci_bus *bus)
307307
return 0;
308308
}
309309

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-
324310
static int find_aer_device_iter(struct device *device, void *data)
325311
{
326312
struct pcie_device **result = data;

include/linux/pci.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1928,6 +1928,20 @@ static inline int pci_pcie_type(const struct pci_dev *dev)
19281928
return (pcie_caps_reg(dev) & PCI_EXP_FLAGS_TYPE) >> 4;
19291929
}
19301930

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+
19311945
void pci_request_acs(void);
19321946
bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags);
19331947
bool pci_acs_path_enabled(struct pci_dev *start,

0 commit comments

Comments
 (0)