Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 66b92988 authored by Felipe Balbi's avatar Felipe Balbi Committed by Wolfram Sang
Browse files

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: default avatarFelipe Balbi <balbi@ti.com>
Signed-off-by: default avatarShubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: default avatarWolfram Sang <w.sang@pengutronix.de>
parent 3312d25e
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -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;

	do {
		bits = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG);
	while ((stat = (omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG))) & bits) {
		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;
}