summaryrefslogtreecommitdiff
path: root/drivers/pci/pci.c
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@orcam.me.uk>2023-06-11 18:19:57 +0100
committerBjorn Helgaas <bhelgaas@google.com>2023-06-20 10:58:53 -0500
commit7604bc294c19fe70fb7d9091731a950b16249c51 (patch)
tree4c9a39cb4c25e80551da6553de35e9460ca2479b /drivers/pci/pci.c
parent680e9c47a2293bcc6a67a6f13f3b23d4c456885b (diff)
PCI: Use pcie_wait_for_link_status() in pcie_wait_for_link_delay()
Remove a DLLLA status bit polling loop from pcie_wait_for_link_delay() and call almost identical code in pcie_wait_for_link_status() instead. This reduces the lower bound on the polling interval from 10ms to 1ms, possibly increasing the CPU load on the system in favour to reducing the wait time. Link: https://lore.kernel.org/r/alpine.DEB.2.21.2306111611170.64925@angie.orcam.me.uk Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r--drivers/pci/pci.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index d576f7fa86cd..62c3a8bc83b3 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4928,16 +4928,14 @@ bool pcie_retrain_link(struct pci_dev *pdev, bool use_lt)
static bool pcie_wait_for_link_delay(struct pci_dev *pdev, bool active,
int delay)
{
- int timeout = PCIE_LINK_RETRAIN_TIMEOUT_MS;
bool ret;
- u16 lnk_status;
/*
* Some controllers might not implement link active reporting. In this
* case, we wait for 1000 ms + any delay requested by the caller.
*/
if (!pdev->link_active_reporting) {
- msleep(timeout + delay);
+ msleep(PCIE_LINK_RETRAIN_TIMEOUT_MS + delay);
return true;
}
@@ -4952,20 +4950,11 @@ static bool pcie_wait_for_link_delay(struct pci_dev *pdev, bool active,
*/
if (active)
msleep(20);
- for (;;) {
- pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lnk_status);
- ret = !!(lnk_status & PCI_EXP_LNKSTA_DLLLA);
- if (ret == active)
- break;
- if (timeout <= 0)
- break;
- msleep(10);
- timeout -= 10;
- }
+ ret = pcie_wait_for_link_status(pdev, false, active);
if (active && ret)
msleep(delay);
- return ret == active;
+ return ret;
}
/**