PCI: designware: Wait for link to come up with consistent style

All the DesignWare-based host drivers loop waiting for the link to come up,
but they do it several ways that are needlessly different.

Wait for the link to come up in a consistent style across all the
DesignWare drivers.  No functional change.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Pratyush Anand <pratyush.anand@gmail.com>
This commit is contained in:
Bjorn Helgaas
2015-06-02 16:47:17 -05:00
parent 1d3f9bac71
commit 6cbb247e85
6 changed files with 51 additions and 66 deletions

View File

@@ -64,18 +64,16 @@ static int ls_pcie_link_up(struct pcie_port *pp)
static int ls_pcie_establish_link(struct pcie_port *pp)
{
int count = 0;
unsigned int retries;
while (!dw_pcie_link_up(pp)) {
for (retries = 0; retries < 200; retries++) {
if (dw_pcie_link_up(pp))
return 0;
usleep_range(100, 1000);
count++;
if (count >= 200) {
dev_err(pp->dev, "phy link never came up\n");
return -EINVAL;
}
}
return 0;
dev_err(pp->dev, "phy link never came up\n");
return -EINVAL;
}
static void ls_pcie_host_init(struct pcie_port *pp)