diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2015-06-02 23:47:17 +0200 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2015-06-10 20:52:59 +0200 |
commit | 6cbb247e85eb4449d31a8dcb9b3f0464772b1395 (patch) | |
tree | 4a73b6883501b2ec7dba50fdc377c1fc60c961c2 /drivers/pci/host/pci-dra7xx.c | |
parent | PCI: layerscape: Factor out ls_pcie_establish_link() (diff) | |
download | linux-6cbb247e85eb4449d31a8dcb9b3f0464772b1395.tar.xz linux-6cbb247e85eb4449d31a8dcb9b3f0464772b1395.zip |
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>
Diffstat (limited to 'drivers/pci/host/pci-dra7xx.c')
-rw-r--r-- | drivers/pci/host/pci-dra7xx.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/pci/host/pci-dra7xx.c b/drivers/pci/host/pci-dra7xx.c index e3d15d7875c2..80db09e47800 100644 --- a/drivers/pci/host/pci-dra7xx.c +++ b/drivers/pci/host/pci-dra7xx.c @@ -93,9 +93,9 @@ static int dra7xx_pcie_link_up(struct pcie_port *pp) static int dra7xx_pcie_establish_link(struct pcie_port *pp) { - u32 reg; - unsigned int retries = 1000; struct dra7xx_pcie *dra7xx = to_dra7xx_pcie(pp); + u32 reg; + unsigned int retries; if (dw_pcie_link_up(pp)) { dev_err(pp->dev, "link is already up\n"); @@ -106,18 +106,14 @@ static int dra7xx_pcie_establish_link(struct pcie_port *pp) reg |= LTSSM_EN; dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_DEVICE_CMD, reg); - while (retries--) { + for (retries = 0; retries < 1000; retries++) { if (dw_pcie_link_up(pp)) - break; + return 0; usleep_range(10, 20); } - if (retries == 0) { - dev_err(pp->dev, "link is not up\n"); - return -ETIMEDOUT; - } - - return 0; + dev_err(pp->dev, "link is not up\n"); + return -EINVAL; } static void dra7xx_pcie_enable_interrupts(struct pcie_port *pp) |