linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c-rcar: check for no IRQ in rcar_i2c_irq()
@ 2014-09-14 20:20 Sergei Shtylyov
       [not found] ` <3921243.2t7X6eKC2i-gHKXc3Y1Z8zGSmamagVegGFoWSdPRAKMAL8bYrjMMd8@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Sergei Shtylyov @ 2014-09-14 20:20 UTC (permalink / raw)
  To: wsa-z923LK4zBo2bacvFa/9K2g, linux-i2c-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-sh-u79uwXL29TY76Z2rM5mHXA

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

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,


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] i2c-rcar: check for no IRQ in rcar_i2c_irq()
       [not found] ` <3921243.2t7X6eKC2i-gHKXc3Y1Z8zGSmamagVegGFoWSdPRAKMAL8bYrjMMd8@public.gmane.org>
@ 2014-09-20  9:59   ` Wolfram Sang
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Sang @ 2014-09-20  9:59 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, linux-sh-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 362 bytes --]

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!


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-20  9:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-14 20:20 [PATCH] i2c-rcar: check for no IRQ in rcar_i2c_irq() Sergei Shtylyov
     [not found] ` <3921243.2t7X6eKC2i-gHKXc3Y1Z8zGSmamagVegGFoWSdPRAKMAL8bYrjMMd8@public.gmane.org>
2014-09-20  9:59   ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).