public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: hisi: Only handle the interrupt of the driver's transfer
@ 2023-08-01 12:46 Yicong Yang
  2023-08-01 22:15 ` Andi Shyti
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Yicong Yang @ 2023-08-01 12:46 UTC (permalink / raw)
  To: wsa, andi.shyti, linux-i2c; +Cc: yangyicong, f.fangjian, linuxarm

From: Yicong Yang <yangyicong@hisilicon.com>

The controller may be shared with other port, for example the firmware.
Handle the interrupt from other sources will cause crash since some
data are not initialized. So only handle the interrupt of the driver's
transfer and discard others.

Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
---
 drivers/i2c/busses/i2c-hisi.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/i2c/busses/i2c-hisi.c b/drivers/i2c/busses/i2c-hisi.c
index e067671b3ce2..8328da4bc3ec 100644
--- a/drivers/i2c/busses/i2c-hisi.c
+++ b/drivers/i2c/busses/i2c-hisi.c
@@ -330,6 +330,14 @@ static irqreturn_t hisi_i2c_irq(int irq, void *context)
 	struct hisi_i2c_controller *ctlr = context;
 	u32 int_stat;
 
+	/*
+	 * Don't handle the interrupt if cltr->completion is NULL. We may
+	 * reach here because the interrupt is spurious or the transfer is
+	 * started by another port rather than us.
+	 */
+	if (!ctlr->completion)
+		return IRQ_NONE;
+
 	int_stat = readl(ctlr->iobase + HISI_I2C_INT_MSTAT);
 	hisi_i2c_clear_int(ctlr, int_stat);
 	if (!(int_stat & HISI_I2C_INT_ALL))
-- 
2.24.0


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

end of thread, other threads:[~2023-08-15  8:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-01 12:46 [PATCH] i2c: hisi: Only handle the interrupt of the driver's transfer Yicong Yang
2023-08-01 22:15 ` Andi Shyti
2023-08-02  2:39   ` Yicong Yang
2023-08-04 23:30     ` Andi Shyti
2023-08-08 13:11       ` Yicong Yang
2023-08-09 20:08         ` Andi Shyti
2023-08-09 20:43 ` Andi Shyti
2023-08-14 13:42 ` Wolfram Sang
2023-08-15  8:41   ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox