i2c: rcar: check for no IRQ in rcar_i2c_irq()
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Sun, 14 Sep 2014 20:20:19 +0000 (00:20 +0400)
committerSimon Horman <horms+renesas@verge.net.au>
Fri, 5 Dec 2014 00:58:53 +0000 (09:58 +0900)
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>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
(cherry picked from commit aa5beaf62588d095398415af5d0e14c79e2478a3)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
drivers/i2c/busses/i2c-rcar.c

index c49b33e..b694cba 100644 (file)
@@ -363,6 +363,7 @@ static int rcar_i2c_irq_recv(struct rcar_i2c_priv *priv, u32 msr)
 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 -----------------*/
@@ -372,6 +373,10 @@ static irqreturn_t rcar_i2c_irq(int irq, void *ptr)
 
        /* 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) {
@@ -406,10 +411,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,