summaryrefslogtreecommitdiffstats
path: root/sys/dev/pccbb
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2003-08-18 03:15:44 +0000
committerimp <imp@FreeBSD.org>2003-08-18 03:15:44 +0000
commitcb79c715dd08db9a90224825647fda99a740a31f (patch)
treec9214a300f87bdeea27c98b9ee6df7ce7b1bfebf /sys/dev/pccbb
parent4c787d57b889e3cc226488f4294a6eba3b895383 (diff)
downloadFreeBSD-src-cb79c715dd08db9a90224825647fda99a740a31f.zip
FreeBSD-src-cb79c715dd08db9a90224825647fda99a740a31f.tar.gz
Put the clearing of the socket cd interrupt and setting of it under
protection of sc->mtx. Sometimes multiple insert/ejections could cause further insertion/removals to not happen due to racing an ISR...
Diffstat (limited to 'sys/dev/pccbb')
-rw-r--r--sys/dev/pccbb/pccbb.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/sys/dev/pccbb/pccbb.c b/sys/dev/pccbb/pccbb.c
index 8df8efc..a3435b4 100644
--- a/sys/dev/pccbb/pccbb.c
+++ b/sys/dev/pccbb/pccbb.c
@@ -1011,23 +1011,21 @@ cbb_event_thread(void *arg)
mtx_unlock(&Giant);
/*
- * In our ISR, we turn off the card changed interrupt. Turn
- * them back on here before we wait for them to happen. We
- * turn them on/off so that we can tolerate a large latency
- * between the time we signal cbb_event_thread and it gets
- * a chance to run.
- */
- cbb_setb(sc, CBB_SOCKET_MASK, CBB_SOCKET_MASK_CD);
-
- /*
* Wait until it has been 1s since the last time we
* get an interrupt. We handle the rest of the interrupt
* at the top of the loop. Although we clear the bit in the
* ISR, we signal sc->cv from the detach path after we've
* set the CBB_KTHREAD_DONE bit, so we can't do a simple
* 1s sleep here.
+ *
+ * In our ISR, we turn off the card changed interrupt. Turn
+ * them back on here before we wait for them to happen. We
+ * turn them on/off so that we can tolerate a large latency
+ * between the time we signal cbb_event_thread and it gets
+ * a chance to run.
*/
mtx_lock(&sc->mtx);
+ cbb_setb(sc, CBB_SOCKET_MASK, CBB_SOCKET_MASK_CD);
cv_wait(&sc->cv, &sc->mtx);
err = 0;
while (err != EWOULDBLOCK &&
@@ -1125,8 +1123,8 @@ cbb_intr(void *arg)
* excellent results.
*/
if (sockevent & CBB_SOCKET_EVENT_CD) {
- cbb_clrb(sc, CBB_SOCKET_MASK, CBB_SOCKET_MASK_CD);
mtx_lock(&sc->mtx);
+ cbb_setb(sc, CBB_SOCKET_MASK, CBB_SOCKET_MASK_CD);
sc->flags &= ~CBB_CARD_OK;
cbb_disable_func_intr(sc);
DPRINTF(("Waking up thread\n"));
OpenPOWER on IntegriCloud