aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-omap.c
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2012-09-12 06:58:03 -0400
committerWolfram Sang <w.sang@pengutronix.de>2012-09-12 09:02:43 -0400
commit66b9298878742f08cb6e79b7c7d5632d782fd1e1 (patch)
treeae5502438160e61f9b53fce131a3987773441ba1 /drivers/i2c/busses/i2c-omap.c
parent3312d25e1abdc41be8a75a1b2c3ccaa39a14ed99 (diff)
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/busses/i2c-omap.c')
-rw-r--r--drivers/i2c/busses/i2c-omap.c20
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)
827 struct omap_i2c_dev *dev = dev_id; 827 struct omap_i2c_dev *dev = dev_id;
828 u16 bits; 828 u16 bits;
829 u16 stat; 829 u16 stat;
830 int err, count = 0; 830 int err = 0, count = 0;
831 831
832 if (pm_runtime_suspended(dev->dev)) 832 if (pm_runtime_suspended(dev->dev))
833 return IRQ_NONE; 833 return IRQ_NONE;
834 834
835 bits = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG); 835 do {
836 while ((stat = (omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG))) & bits) { 836 bits = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG);
837 stat = omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG);
838 stat &= bits;
839
840 if (!stat) {
841 /* my work here is done */
842 return IRQ_HANDLED;
843 }
844
837 dev_dbg(dev->dev, "IRQ (ISR = 0x%04x)\n", stat); 845 dev_dbg(dev->dev, "IRQ (ISR = 0x%04x)\n", stat);
838 if (count++ == 100) { 846 if (count++ == 100) {
839 dev_warn(dev->dev, "Too much work in one IRQ\n"); 847 dev_warn(dev->dev, "Too much work in one IRQ\n");
840 break; 848 omap_i2c_complete_cmd(dev, err);
849 return IRQ_HANDLED;
841 } 850 }
842 851
843 err = 0;
844complete: 852complete:
845 /* 853 /*
846 * Ack the stat in one go, but [R/X]DR and [R/X]RDY should be 854 * Ack the stat in one go, but [R/X]DR and [R/X]RDY should be
@@ -940,7 +948,7 @@ complete:
940 dev_err(dev->dev, "Transmit underflow\n"); 948 dev_err(dev->dev, "Transmit underflow\n");
941 dev->cmd_err |= OMAP_I2C_STAT_XUDF; 949 dev->cmd_err |= OMAP_I2C_STAT_XUDF;
942 } 950 }
943 } 951 } while (stat);
944 952
945 return count ? IRQ_HANDLED : IRQ_NONE; 953 return count ? IRQ_HANDLED : IRQ_NONE;
946} 954}