diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2010-09-06 18:22:03 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2010-09-06 18:22:03 +0000 |
commit | 0b0772671e9f15d9fe3cdd186251e3cd00543acf (patch) | |
tree | 7900c3a43433458d260e97e521139da82178b0b2 | |
parent | 9a6052c92f82f7e67d5eaf76b114d786abbbe3be (diff) |
Make the interrupt handler bail out early if the device wen away. Fixes
freezes that occur when removing CardBus cards when the interface is up.
ok deraadt@
-rw-r--r-- | sys/dev/ic/rt2560.c | 7 | ||||
-rw-r--r-- | sys/dev/ic/rt2661.c | 4 |
2 files changed, 8 insertions, 3 deletions
diff --git a/sys/dev/ic/rt2560.c b/sys/dev/ic/rt2560.c index 5464bd2d7da..730e02df478 100644 --- a/sys/dev/ic/rt2560.c +++ b/sys/dev/ic/rt2560.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rt2560.c,v 1.54 2010/08/28 18:08:07 deraadt Exp $ */ +/* $OpenBSD: rt2560.c,v 1.55 2010/09/06 18:22:00 kettenis Exp $ */ /*- * Copyright (c) 2005, 2006 @@ -1337,7 +1337,10 @@ rt2560_intr(void *arg) struct ifnet *ifp = &sc->sc_ic.ic_if; uint32_t r; - if ((r = RAL_READ(sc, RT2560_CSR7)) == 0) + r = RAL_READ(sc, RT2560_CSR7); + if (__predict_false(r == 0xffffffff)) + return 0; /* device likely went away */ + if (r == 0) return 0; /* not for us */ /* disable interrupts */ diff --git a/sys/dev/ic/rt2661.c b/sys/dev/ic/rt2661.c index ca017d0892b..fffb8a640a7 100644 --- a/sys/dev/ic/rt2661.c +++ b/sys/dev/ic/rt2661.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rt2661.c,v 1.60 2010/08/28 18:08:07 deraadt Exp $ */ +/* $OpenBSD: rt2661.c,v 1.61 2010/09/06 18:22:02 kettenis Exp $ */ /*- * Copyright (c) 2006 @@ -1247,6 +1247,8 @@ rt2661_intr(void *arg) r1 = RAL_READ(sc, RT2661_INT_SOURCE_CSR); r2 = RAL_READ(sc, RT2661_MCU_INT_SOURCE_CSR); + if (__predict_false(r1 == 0xffffffff && r2 == 0xffffffff)) + return 0; /* device likely went away */ if (r1 == 0 && r2 == 0) return 0; /* not for us */ |