summaryrefslogtreecommitdiffstats
path: root/drivers/pci/host/pcie-spear13xx.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2015-06-02 23:47:17 +0200
committerBjorn Helgaas <bhelgaas@google.com>2015-06-10 20:52:59 +0200
commit6cbb247e85eb4449d31a8dcb9b3f0464772b1395 (patch)
tree4a73b6883501b2ec7dba50fdc377c1fc60c961c2 /drivers/pci/host/pcie-spear13xx.c
parentPCI: layerscape: Factor out ls_pcie_establish_link() (diff)
downloadlinux-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/pcie-spear13xx.c')
-rw-r--r--drivers/pci/host/pcie-spear13xx.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/pci/host/pcie-spear13xx.c b/drivers/pci/host/pcie-spear13xx.c
index 020d78890719..dfec4281bd50 100644
--- a/drivers/pci/host/pcie-spear13xx.c
+++ b/drivers/pci/host/pcie-spear13xx.c
@@ -146,10 +146,10 @@ struct pcie_app_reg {
static int spear13xx_pcie_establish_link(struct pcie_port *pp)
{
u32 val;
- int count = 0;
struct spear13xx_pcie *spear13xx_pcie = to_spear13xx_pcie(pp);
struct pcie_app_reg *app_reg = spear13xx_pcie->app_base;
u32 exp_cap_off = EXP_CAP_ID_OFFSET;
+ unsigned int retries;
if (dw_pcie_link_up(pp)) {
dev_err(pp->dev, "link already up\n");
@@ -201,17 +201,16 @@ static int spear13xx_pcie_establish_link(struct pcie_port *pp)
&app_reg->app_ctrl_0);
/* check if the link is up or not */
- while (!dw_pcie_link_up(pp)) {
- mdelay(100);
- count++;
- if (count == 10) {
- dev_err(pp->dev, "link Fail\n");
- return -EINVAL;
+ for (retries = 0; retries < 10; retries++) {
+ if (dw_pcie_link_up(pp)) {
+ dev_info(pp->dev, "link up\n");
+ return 0;
}
+ mdelay(100);
}
- dev_info(pp->dev, "link up\n");
- return 0;
+ dev_err(pp->dev, "link Fail\n");
+ return -EINVAL;
}
static irqreturn_t spear13xx_pcie_irq_handler(int irq, void *arg)