diff mbox series

media: ite-cir: ignore interrupts when they are not pending

Message ID 20221007125011.132480-1-sean@mess.org (mailing list archive)
State New, archived
Headers show
Series media: ite-cir: ignore interrupts when they are not pending | expand

Commit Message

Sean Young Oct. 7, 2022, 12:50 p.m. UTC
On an Intel NUC6iSYK, during suspend an interrupt is sometimes received
by the driver even though there is no work pending. This results in an
infred overflow being recorded:

rc rc0: receive overflow

There is no receiver overflow at this time.

Signed-off-by: Sean Young <sean@mess.org>
---
 drivers/media/rc/ite-cir.c | 26 ++++++++++++++++----------
 drivers/media/rc/ite-cir.h |  1 +
 2 files changed, 17 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c
index fcfadd7ea31c..ffb0c2249010 100644
--- a/drivers/media/rc/ite-cir.c
+++ b/drivers/media/rc/ite-cir.c
@@ -234,6 +234,8 @@  static irqreturn_t ite_cir_isr(int irq, void *data)
 
 	/* read the interrupt flags */
 	iflags = dev->params->get_irq_causes(dev);
+	if (iflags == ITE_IRQ_NOT_PENDING)
+		return IRQ_RETVAL(IRQ_NONE);
 
 	/* Check for RX overflow */
 	if (iflags & ITE_IRQ_RX_FIFO_OVERRUN) {
@@ -498,16 +500,20 @@  static int it87_get_irq_causes(struct ite_dev *dev)
 	/* read the interrupt flags */
 	iflags = inb(dev->cir_addr + IT87_IIR) & IT87_II;
 
-	switch (iflags) {
-	case IT87_II_RXDS:
-		ret = ITE_IRQ_RX_FIFO;
-		break;
-	case IT87_II_RXFO:
-		ret = ITE_IRQ_RX_FIFO_OVERRUN;
-		break;
-	case IT87_II_TXLDL:
-		ret = ITE_IRQ_TX_FIFO;
-		break;
+	if (!(iflags & IT87_IP)) {
+		ret = ITE_IRQ_NOT_PENDING;
+	} else {
+		switch (iflags) {
+		case IT87_II_RXDS:
+			ret = ITE_IRQ_RX_FIFO;
+			break;
+		case IT87_II_RXFO:
+			ret = ITE_IRQ_RX_FIFO_OVERRUN;
+			break;
+		case IT87_II_TXLDL:
+			ret = ITE_IRQ_TX_FIFO;
+			break;
+		}
 	}
 
 	return ret;
diff --git a/drivers/media/rc/ite-cir.h b/drivers/media/rc/ite-cir.h
index 4b4294d77555..8df392bd9af7 100644
--- a/drivers/media/rc/ite-cir.h
+++ b/drivers/media/rc/ite-cir.h
@@ -16,6 +16,7 @@ 
 #define ITE_IRQ_TX_FIFO        1
 #define ITE_IRQ_RX_FIFO        2
 #define ITE_IRQ_RX_FIFO_OVERRUN    4
+#define ITE_IRQ_NOT_PENDING    8
 
 /* forward declaration */
 struct ite_dev;