i2c: rcar: check master irqs before slave irqs
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Thu, 3 Sep 2015 20:20:11 +0000 (22:20 +0200)
committerWolfram Sang <wsa@the-dreams.de>
Fri, 9 Oct 2015 21:31:34 +0000 (22:31 +0100)
Due to broken HW design, master IRQs are more timing critical, so give
them precedence over slave IRQ.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-rcar.c

index dcf9fc77cec7c4b693b087a924c4b437fd8100e2..06bd8c45c6af9d02c1c7a5e159c306e63935f495 100644 (file)
@@ -435,19 +435,17 @@ static bool rcar_i2c_slave_irq(struct rcar_i2c_priv *priv)
 static irqreturn_t rcar_i2c_irq(int irq, void *ptr)
 {
        struct rcar_i2c_priv *priv = ptr;
-       irqreturn_t result = IRQ_HANDLED;
        u32 msr;
 
-       if (rcar_i2c_slave_irq(priv))
-               goto exit;
-
        msr = rcar_i2c_read(priv, ICMSR);
 
        /* Only handle interrupts that are currently enabled */
        msr &= rcar_i2c_read(priv, ICMIER);
        if (!msr) {
-               result = IRQ_NONE;
-               goto exit;
+               if (rcar_i2c_slave_irq(priv))
+                       return IRQ_HANDLED;
+
+               return IRQ_NONE;
        }
 
        /* Arbitration lost */
@@ -484,8 +482,7 @@ out:
                wake_up(&priv->wait);
        }
 
-exit:
-       return result;
+       return IRQ_HANDLED;
 }
 
 static int rcar_i2c_master_xfer(struct i2c_adapter *adap,