From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michal Simek Date: Mon, 2 Jan 2017 14:43:11 +0100 Subject: [U-Boot] [PATCH 2/4] i2c: i2c-cdns: Reorder timeout loop for interrupt waiting In-Reply-To: <1482878794-30009-2-git-send-email-moritz.fischer@ettus.com> References: <1482878794-30009-1-git-send-email-moritz.fischer@ettus.com> <1482878794-30009-2-git-send-email-moritz.fischer@ettus.com> Message-ID: <7258ad14-ec98-e69f-ee69-a27537bbb635@xilinx.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 27.12.2016 23:46, Moritz Fischer wrote: > 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. > > Signed-off-by: Moritz Fischer > Cc: Heiko Schocher > Cc: Michal Simek > Cc: u-boot at lists.denx.de > --- > drivers/i2c/i2c-cdns.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/i2c/i2c-cdns.c b/drivers/i2c/i2c-cdns.c > index c69e7e8..9a1b520 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 */ > Reviewed-by: Michal Simek Thanks, Michal