Skip to content

Commit 4827d63

Browse files
westeribjorn-helgaas
authored andcommitted
PCI/PM: Add pcie_wait_for_link_delay()
Add pcie_wait_for_link_delay(). Similar to pcie_wait_for_link() but allows passing custom activation delay in milliseconds. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mika Westerberg <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Rafael J. Wysocki <[email protected]>
1 parent 327ccbb commit 4827d63

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

drivers/pci/pci.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4586,14 +4586,17 @@ static int pci_pm_reset(struct pci_dev *dev, int probe)
45864586

45874587
return pci_dev_wait(dev, "PM D3hot->D0", PCIE_RESET_READY_POLL_MS);
45884588
}
4589+
45894590
/**
4590-
* pcie_wait_for_link - Wait until link is active or inactive
4591+
* pcie_wait_for_link_delay - Wait until link is active or inactive
45914592
* @pdev: Bridge device
45924593
* @active: waiting for active or inactive?
4594+
* @delay: Delay to wait after link has become active (in ms)
45934595
*
45944596
* Use this to wait till link becomes active or inactive.
45954597
*/
4596-
bool pcie_wait_for_link(struct pci_dev *pdev, bool active)
4598+
static bool pcie_wait_for_link_delay(struct pci_dev *pdev, bool active,
4599+
int delay)
45974600
{
45984601
int timeout = 1000;
45994602
bool ret;
@@ -4630,13 +4633,25 @@ bool pcie_wait_for_link(struct pci_dev *pdev, bool active)
46304633
timeout -= 10;
46314634
}
46324635
if (active && ret)
4633-
msleep(100);
4636+
msleep(delay);
46344637
else if (ret != active)
46354638
pci_info(pdev, "Data Link Layer Link Active not %s in 1000 msec\n",
46364639
active ? "set" : "cleared");
46374640
return ret == active;
46384641
}
46394642

4643+
/**
4644+
* pcie_wait_for_link - Wait until link is active or inactive
4645+
* @pdev: Bridge device
4646+
* @active: waiting for active or inactive?
4647+
*
4648+
* Use this to wait till link becomes active or inactive.
4649+
*/
4650+
bool pcie_wait_for_link(struct pci_dev *pdev, bool active)
4651+
{
4652+
return pcie_wait_for_link_delay(pdev, active, 100);
4653+
}
4654+
46404655
void pci_reset_secondary_bus(struct pci_dev *dev)
46414656
{
46424657
u16 ctrl;

0 commit comments

Comments
 (0)