Skip to content

Commit

Permalink
PCI: Export pcie_find_root_port
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johannes Thumshirn authored and Bjorn Helgaas committed Nov 23, 2016
1 parent 9f46107 commit e784930
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
14 changes: 0 additions & 14 deletions drivers/pci/pcie/aer/aer_inject.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,20 +307,6 @@ static int pci_bus_set_aer_ops(struct pci_bus *bus)
return 0;
}

static 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;
}

static int find_aer_device_iter(struct device *device, void *data)
{
struct pcie_device **result = data;
Expand Down
14 changes: 14 additions & 0 deletions include/linux/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e784930

Please sign in to comment.