lkml.org 
[lkml]   [2018]   [Apr]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v13 5/6] PCI: Unify wait for link active into generic PCI
On 2018-04-10 04:55, Keith Busch wrote:
> On Mon, Apr 09, 2018 at 10:41:53AM -0400, Oza Pawandeep wrote:
>> +/**
>> + * pcie_wait_for_link - Wait for link till it's active/inactive
>> + * @pdev: Bridge device
>> + * @active: waiting for active or inactive ?
>> + *
>> + * Use this to wait till link becomes active or inactive.
>> + */
>> +bool pcie_wait_for_link(struct pci_dev *pdev, bool active)
>> +{
>> + int timeout = 1000;
>> + bool ret;
>> + u16 lnk_status;
>> +
>> + for (;;) {
>> + pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lnk_status);
>> + ret = !!(lnk_status & PCI_EXP_LNKSTA_DLLLA);
>> + if (ret == active)
>> + return true;
>> + if (timeout <= 0)
>> + break;
>> + timeout -= 10;
>> + }
>
> This is missing an msleep(10) at each iteration.

will take care.

>
>> +
>> + pci_info(pdev, "Data Link Layer Link Active not %s in 1000 msec\n",
>> + active ? "set" : "cleared");
>> +
>> + return false;
>> +}

\
 
 \ /
  Last update: 2018-04-12 10:41    [W:0.061 / U:0.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site