From 5959e33b4e14b2542dfee105a7c9756e03efae39 Mon Sep 17 00:00:00 2001 From: kettenis Date: Sun, 18 Aug 2024 11:08:47 +0000 Subject: [PATCH] Don't short-circuit interrupt handling when the sc_dying flag is set. Just don't forward reports to the child drivers instead. This fixes an issue with hardware that sends an interrupt in response to a reset request when a level-triggered interrupt is used. In that case the interrupt would just keep triggering when we issue a reset when we resume (when sc_dying is set) since we didn't clear the interrupt condition by reading from the device. ok mlarkin@, deraadt@ --- sys/dev/i2c/ihidev.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sys/dev/i2c/ihidev.c b/sys/dev/i2c/ihidev.c index a735b015f7f..80f730998fc 100644 --- a/sys/dev/i2c/ihidev.c +++ b/sys/dev/i2c/ihidev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ihidev.c,v 1.30 2024/08/18 03:25:04 deraadt Exp $ */ +/* $OpenBSD: ihidev.c,v 1.31 2024/08/18 11:08:47 kettenis Exp $ */ /* * HID-over-i2c driver * @@ -632,9 +632,6 @@ ihidev_intr(void *arg) u_char *p; u_int rep = 0; - if (sc->sc_dying) - return 1; - if (sc->sc_poll && !sc->sc_frompoll) { DPRINTF(("%s: received interrupt while polling, disabling " "polling\n", sc->sc_dev.dv_xname)); @@ -711,7 +708,8 @@ ihidev_intr(void *arg) return (1); } - scd->sc_intr(scd, p, psize); + if (!sc->sc_dying) + scd->sc_intr(scd, p, psize); if (sc->sc_poll && (fast != sc->sc_fastpoll)) { DPRINTF(("%s: %s->%s polling\n", sc->sc_dev.dv_xname, -- 2.20.1