[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a61cd3d4-ae7b-9ef3-944d-952021cca0e4@codeaurora.org>
Date: Fri, 19 Jan 2018 09:08:05 -0500
From: Sinan Kaya <okaya@...eaurora.org>
To: Oza Pawandeep <poza@...eaurora.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Philippe Ombredanne <pombredanne@...b.com>,
Thomas Gleixner <tglx@...utronix.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Kate Stewart <kstewart@...uxfoundation.org>,
linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
Dongdong Liu <liudongdong3@...wei.com>,
Keith Busch <keith.busch@...el.com>, Wei Zhang <wzhang@...com>,
Timur Tabi <timur@...eaurora.org>
Subject: Re: [PATCH v6 7/7] PCI: Unify wait for link active into generic pci
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.
Powered by blists - more mailing lists