Commit ab5bd055 authored by AngeloGioacchino Del Regno's avatar AngeloGioacchino Del Regno Committed by Andi Shyti
Browse files

i2c: mt65xx: Avoid double initialization of restart_flag in isr



In the mtk_i2c_irq() handler, variable restart_flag is initialized
to zero and then reassigned with I2C_RS_TRANSFER if and only if
auto_restart is enabled.

Avoid a double initialization of this variable by transferring the
auto_restart check to the restart_flag declaration.

This commit brings no functional changes.

Signed-off-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: default avatarAndi Shyti <andi.shyti@kernel.org>
parent 1dc8baa4
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -1306,12 +1306,9 @@ static int mtk_i2c_transfer(struct i2c_adapter *adap,
static irqreturn_t mtk_i2c_irq(int irqno, void *dev_id)
{
	struct mtk_i2c *i2c = dev_id;
	u16 restart_flag = 0;
	u16 restart_flag = i2c->auto_restart ? I2C_RS_TRANSFER : 0;
	u16 intr_stat;

	if (i2c->auto_restart)
		restart_flag = I2C_RS_TRANSFER;

	intr_stat = mtk_i2c_readw(i2c, OFFSET_INTR_STAT);
	mtk_i2c_writew(i2c, intr_stat, OFFSET_INTR_STAT);