diff options
author | Oza Pawandeep <poza@codeaurora.org> | 2018-05-17 23:44:11 +0200 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2018-05-17 23:44:11 +0200 |
commit | 9f5a70f18c5893a30d6c339adc48de43c57dd7e2 (patch) | |
tree | a9883d7afecbedeffb9379bc88c9c5d06793f1ab /drivers/pci/pcie/dpc.c | |
parent | PCI/AER: Add TLP header information to tracepoint (diff) | |
download | linux-9f5a70f18c5893a30d6c339adc48de43c57dd7e2.tar.xz linux-9f5a70f18c5893a30d6c339adc48de43c57dd7e2.zip |
PCI: Add generic pcie_wait_for_link() interface
Clients such as hotplug and Downstream Port Containment (DPC) both need to
wait until a link becomes active or inactive.
Add a generic pcie_wait_link_active() interface and use it instead of
duplicating the code.
Signed-off-by: Oza Pawandeep <poza@codeaurora.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Keith Busch <keith.busch@intel.com>
Diffstat (limited to 'drivers/pci/pcie/dpc.c')
-rw-r--r-- | drivers/pci/pcie/dpc.c | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/drivers/pci/pcie/dpc.c b/drivers/pci/pcie/dpc.c index 8c57d607e603..80ec3849f8d3 100644 --- a/drivers/pci/pcie/dpc.c +++ b/drivers/pci/pcie/dpc.c @@ -68,19 +68,9 @@ static int dpc_wait_rp_inactive(struct dpc_dev *dpc) static void dpc_wait_link_inactive(struct dpc_dev *dpc) { - unsigned long timeout = jiffies + HZ; struct pci_dev *pdev = dpc->dev->port; - struct device *dev = &dpc->dev->device; - u16 lnk_status; - pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lnk_status); - while (lnk_status & PCI_EXP_LNKSTA_DLLLA && - !time_after(jiffies, timeout)) { - msleep(10); - pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lnk_status); - } - if (lnk_status & PCI_EXP_LNKSTA_DLLLA) - dev_warn(dev, "Link state not disabled for DPC event\n"); + pcie_wait_for_link(pdev, false); } static void dpc_work(struct work_struct *work) |