mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-16 09:54:35 +00:00
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
This commit is contained in:
parent
5e42985208
commit
0ec0c58643
1 changed files with 1 additions and 1 deletions
|
@ -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 */
|
||||
|
|
Loading…
Add table
Reference in a new issue