summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMoritz Fischer <moritz.fischer@ettus.com>2017-01-16 17:50:45 (GMT)
committerHeiko Schocher <hs@denx.de>2017-01-18 05:38:14 (GMT)
commit0ec0c5864365f3f222e1652aca98cfbd86bae890 (patch)
tree5cb15f8c52c292e1a23810e0224f409de3bbc7d1 /drivers
parent5e429852085119aa7e7a4437f588ae3a2424a3f6 (diff)
downloadu-boot-0ec0c5864365f3f222e1652aca98cfbd86bae890.tar.xz
i2c: i2c-cdns: Reorder timeout loop for interrupt waiting
Reorder the timeout loop such that we first check if the condition is already true, and then call udelay() so if the condition is already true, break early. Reviewed-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com> Cc: Heiko Schocher <hs@denx.de> Cc: Michal Simek <michal.simek@xilinx.com> Cc: u-boot@lists.denx.de
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/i2c-cdns.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/i2c/i2c-cdns.c b/drivers/i2c/i2c-cdns.c
index c1d6427..1c9fda8 100644
--- a/drivers/i2c/i2c-cdns.c
+++ b/drivers/i2c/i2c-cdns.c
@@ -130,10 +130,10 @@ static u32 cdns_i2c_wait(struct cdns_i2c_regs *cdns_i2c, u32 mask)
int timeout, int_status;
for (timeout = 0; timeout < 100; timeout++) {
- udelay(100);
int_status = readl(&cdns_i2c->interrupt_status);
if (int_status & mask)
break;
+ udelay(100);
}
/* Clear interrupt status flags */