Skip to contentSkip to conversation

i2c-rcar: check for no IRQ in rcar_i2c_irq()

PATCH Applied Sergei Shtylyov 2 participants 2 messages Sep 14, 2014 – Sep 20, 2014 1 message not in the archive

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c-rcar: check for no IRQ in rcar_i2c_irq()

Check if the ICMSR register (masked with the ICMIER register) evaluates to 0 in the driver's interrupt handler and return IRQ_NONE in that case, like many other drivers do.

---
The patch is against Wolfram Sang's 'linux.git' repo's 'i2c/for-next' branch plus 3 cleanup patches just re-posted.

 drivers/i2c/busses/i2c-rcar.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-rcar.c +7 -1
Index: renesas/drivers/i2c/busses/i2c-rcar.c
===================================================================
@@ -361,6 +361,7 @@ static void rcar_i2c_irq_recv(struct rca
 static irqreturn_t rcar_i2c_irq(int irq, void *ptr)
 {
 	struct rcar_i2c_priv *priv = ptr;
+	irqreturn_t result = IRQ_HANDLED;
 	u32 msr;
 
 	/*-------------- spin lock -----------------*/
@@ -370,6 +371,10 @@ static irqreturn_t rcar_i2c_irq(int irq,
 
 	/* Only handle interrupts that are currently enabled */
 	msr &= rcar_i2c_read(priv, ICMIER);
+	if (!msr) {
+		result = IRQ_NONE;
+		goto exit;
+	}
 
 	/* Arbitration lost */
 	if (msr & MAL) {
@@ -404,10 +409,11 @@ out:
 		wake_up(&priv->wait);
 	}
 
+exit:
 	spin_unlock(&priv->lock);
 	/*-------------- spin unlock -----------------*/
 
-	return IRQ_HANDLED;
+	return result;
 }
 
 static int rcar_i2c_master_xfer(struct i2c_adapter *adap,

A message that is not in the archive (sent off-list or not yet received): 3921243.2t7X6eKC2i-gHKXc3Y1Z8zGSmamagVegGFoWSdPRAKMAL8bYrjMMd8@public.gmane.org