summaryrefslogtreecommitdiffstats
path: root/sys/dev/pccbb
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2002-02-20 16:20:27 +0000
committerimp <imp@FreeBSD.org>2002-02-20 16:20:27 +0000
commitfd666ea1684cca65c3d0364a2950c0fdee2d3f13 (patch)
treedbf6be1c0d6dd5373a793de0a6995c7a3b01c794 /sys/dev/pccbb
parent2ea45f625c2b61e06304100499021308bc97eef9 (diff)
downloadFreeBSD-src-fd666ea1684cca65c3d0364a2950c0fdee2d3f13.zip
FreeBSD-src-fd666ea1684cca65c3d0364a2950c0fdee2d3f13.tar.gz
Check the status of the card bridge first thing, rather than last in
the loop. This fixes the "my card is in the laptop on boot, but doesn't attach" problem.
Diffstat (limited to 'sys/dev/pccbb')
-rw-r--r--sys/dev/pccbb/pccbb.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/sys/dev/pccbb/pccbb.c b/sys/dev/pccbb/pccbb.c
index 54b7fd4..8b50aa9 100644
--- a/sys/dev/pccbb/pccbb.c
+++ b/sys/dev/pccbb/pccbb.c
@@ -848,20 +848,16 @@ pccbb_event_thread(void *arg)
/*
* We take out Giant here because we drop it in tsleep
- * and need it for kthread_exit, which drops it
+ * and need it for kthread_exit, which drops it.
*/
mtx_lock(&Giant);
sc->flags |= PCCBB_KTHREAD_RUNNING;
- for(;;) {
+ while (1) {
/*
- * Wait until it has been 1s since the last time we
- * get an interrupt.
+ * Check to see if we have anything first so that
+ * if there's a card already inserted, we do the
+ * right thing.
*/
- tsleep (sc, PWAIT, "pccbbev", 0);
- do {
- err = tsleep (sc, PWAIT, "pccbbev", 1 * hz);
- } while (err != EWOULDBLOCK &&
- (sc->flags & PCCBB_KTHREAD_DONE) == 0);
mtx_lock(&sc->mtx);
if (sc->flags & PCCBB_KTHREAD_DONE)
break;
@@ -872,10 +868,19 @@ pccbb_event_thread(void *arg)
else
pccbb_removal(sc);
mtx_unlock(&sc->mtx);
+ /*
+ * 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.
+ */
+ tsleep (sc, PWAIT, "pccbbev", 0);
+ do {
+ err = tsleep (sc, PWAIT, "pccbbev", 1 * hz);
+ } while (err != EWOULDBLOCK &&
+ (sc->flags & PCCBB_KTHREAD_DONE) == 0);
}
mtx_unlock(&sc->mtx);
sc->flags &= ~PCCBB_KTHREAD_RUNNING;
- wakeup(sc);
/*
* XXX I think there's a race here. If we wakeup in the other
* thread before kthread_exit is called and this routine returns,
@@ -883,6 +888,7 @@ pccbb_event_thread(void *arg)
* ourselves up for a panic. Make sure that I check out
* jhb's crash.c for a fix.
*/
+ wakeup(sc);
kthread_exit(0);
}
OpenPOWER on IntegriCloud