diff options
author | Felipe Balbi <balbi@ti.com> | 2012-09-12 16:28:03 +0530 |
---|---|---|
committer | Wolfram Sang <w.sang@pengutronix.de> | 2012-09-12 15:02:43 +0200 |
commit | 66b9298878742f08cb6e79b7c7d5632d782fd1e1 (patch) | |
tree | ae5502438160e61f9b53fce131a3987773441ba1 /drivers/i2c | |
parent | 3312d25e1abdc41be8a75a1b2c3ccaa39a14ed99 (diff) | |
download | talos-op-linux-66b9298878742f08cb6e79b7c7d5632d782fd1e1.tar.gz talos-op-linux-66b9298878742f08cb6e79b7c7d5632d782fd1e1.zip |
i2c: omap: switch over to do {} while loop
this will make sure that we execute at least once.
No functional changes otherwise.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-omap.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 2c7d7cc30e95..40451341c479 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -827,20 +827,28 @@ omap_i2c_isr(int this_irq, void *dev_id) struct omap_i2c_dev *dev = dev_id; u16 bits; u16 stat; - int err, count = 0; + int err = 0, count = 0; if (pm_runtime_suspended(dev->dev)) return IRQ_NONE; - bits = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG); - while ((stat = (omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG))) & bits) { + do { + bits = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG); + stat = omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG); + stat &= bits; + + if (!stat) { + /* my work here is done */ + return IRQ_HANDLED; + } + dev_dbg(dev->dev, "IRQ (ISR = 0x%04x)\n", stat); if (count++ == 100) { dev_warn(dev->dev, "Too much work in one IRQ\n"); - break; + omap_i2c_complete_cmd(dev, err); + return IRQ_HANDLED; } - err = 0; complete: /* * Ack the stat in one go, but [R/X]DR and [R/X]RDY should be @@ -940,7 +948,7 @@ complete: dev_err(dev->dev, "Transmit underflow\n"); dev->cmd_err |= OMAP_I2C_STAT_XUDF; } - } + } while (stat); return count ? IRQ_HANDLED : IRQ_NONE; } |