lkml.org 
[lkml]   [2021]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 3/6] usb: typec: tipd: Add short-circuit for no irqs
Date
If no interrupts are set in IntEventX directly skip to the end of the
interrupt handler and return IRQ_NONE instead of IRQ_HANDLED.
This possibly allows to detect spurious interrupts if the i2c bus is fast
enough.

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Sven Peter <sven@svenpeter.dev>
---
changes since v1:
- added Heikki's r-b
- s/event/(event1 | event2)/

drivers/usb/typec/tipd/core.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
index 162d405baa92..cd1e37eb8a0c 100644
--- a/drivers/usb/typec/tipd/core.c
+++ b/drivers/usb/typec/tipd/core.c
@@ -476,6 +476,9 @@ static irqreturn_t tps6598x_interrupt(int irq, void *data)
}
trace_tps6598x_irq(event1, event2);

+ if (!(event1 | event2))
+ goto err_unlock;
+
if (!tps6598x_read_status(tps, &status))
goto err_clear_ints;

@@ -498,7 +501,9 @@ static irqreturn_t tps6598x_interrupt(int irq, void *data)
err_unlock:
mutex_unlock(&tps->lock);

- return IRQ_HANDLED;
+ if (event1 | event2)
+ return IRQ_HANDLED;
+ return IRQ_NONE;
}

static int tps6598x_check_mode(struct tps6598x *tps)
--
2.25.1
\
 
 \ /
  Last update: 2021-09-23 20:14    [W:0.084 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site