diff mbox

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

Message ID 3921243.2t7X6eKC2i@wasted.cogentembedded.com (mailing list archive)
State Awaiting Upstream
Headers show

Commit Message

Sergei Shtylyov Sept. 14, 2014, 8:20 p.m. UTC
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.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
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(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Wolfram Sang Sept. 20, 2014, 9:59 a.m. UTC | #1
On Mon, Sep 15, 2014 at 12:20:19AM +0400, Sergei Shtylyov wrote:
> 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.
> 
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> 

Applied to for-next, thanks!
diff mbox

Patch

Index: renesas/drivers/i2c/busses/i2c-rcar.c
===================================================================
--- renesas.orig/drivers/i2c/busses/i2c-rcar.c
+++ 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,