lkml.org 
[lkml]   [2018]   [Jan]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v6 7/7] PCI: Unify wait for link active into generic pci
From
Date
On 1/19/2018 6:10 AM, Oza Pawandeep wrote:
> +check_link:
> + pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lnk_status);
> + ret = !!(lnk_status & PCI_EXP_LNKSTA_DLLLA);
> +
> + if (ret == active) {
> + dev_printk(KERN_DEBUG, &pdev->dev,
> + "%s: lnk_status = %x\n", __func__, lnk_status);
> + return true;
> + }
> +
> + while (timeout > 0) {
> + msleep(10);
> + timeout -= 10;
> + goto check_link;
> + }


this is weird.

I think following is a simpler approach.

pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lnk_status);
ret = !!(lnk_status & PCI_EXP_LNKSTA_DLLLA);

while ((ret != active) && (timeout > 0)) {
msleep(10);
timeout -= 10;

pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lnk_status);
ret = !!(lnk_status & PCI_EXP_LNKSTA_DLLLA);
}


--
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.

\
 
 \ /
  Last update: 2018-01-19 15:08    [W:1.023 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site