From ad561e4755a78b67059e6b9cb974fc63735ff9ab Mon Sep 17 00:00:00 2001 From: Jacob Meuser Date: Sun, 24 Apr 2011 20:31:27 +0000 Subject: in azalia_intr(): * deal with the possibility of the hardware being detached, as could happen with expresscard. from deraadt@ * only return 1 if an interrupt was actually serviced. fixes "constant interrupts when the device isn't being used" issue reported by oga@. --- sys/dev/pci/azalia.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/sys/dev/pci/azalia.c b/sys/dev/pci/azalia.c index b81b51bdf6d..8dafff76461 100644 --- a/sys/dev/pci/azalia.c +++ b/sys/dev/pci/azalia.c @@ -1,4 +1,4 @@ -/* $OpenBSD: azalia.c,v 1.194 2011/04/10 17:10:08 jakemsr Exp $ */ +/* $OpenBSD: azalia.c,v 1.195 2011/04/24 20:31:26 jakemsr Exp $ */ /* $NetBSD: azalia.c,v 1.20 2006/05/07 08:31:44 kent Exp $ */ /*- @@ -649,25 +649,32 @@ azalia_intr(void *v) { azalia_t *az = v; uint32_t intsts; + int ret = 0; intsts = AZ_READ_4(az, INTSTS); - if (intsts == 0) - return (0); + if (intsts == 0 || intsts == 0xffffffff) + return (ret); AZ_WRITE_4(az, INTSTS, intsts); - if (intsts & az->pstream.intr_bit) + if (intsts & az->pstream.intr_bit) { azalia_stream_intr(&az->pstream); + ret = 1; + } - if (intsts & az->rstream.intr_bit) + if (intsts & az->rstream.intr_bit) { azalia_stream_intr(&az->rstream); + ret = 1; + } if ((intsts & HDA_INTSTS_CIS) && (AZ_READ_1(az, RIRBCTL) & HDA_RIRBCTL_RINTCTL) && - (AZ_READ_1(az, RIRBSTS) & HDA_RIRBSTS_RINTFL)) + (AZ_READ_1(az, RIRBSTS) & HDA_RIRBSTS_RINTFL)) { azalia_rirb_intr(az); + ret = 1; + } - return (1); + return (ret); } void -- cgit v1.2.3