--- msp34xx.c.orig Mon Nov 22 22:57:42 2004 +++ msp34xx.c Tue Nov 23 17:10:16 2004 @@ -702,6 +702,7 @@ dprintk("msp3400: thread started\n"); + mtx_lock(&Giant); for (;;) { if (msp->rmmod) goto done; @@ -892,6 +893,7 @@ msp->kthread = NULL; wakeup(&msp->kthread); + mtx_unlock(&Giant); kthread_exit(0); } @@ -936,6 +938,7 @@ dprintk("msp3410: thread started\n"); + mtx_lock(&Giant); for (;;) { if (msp->rmmod) goto done; @@ -1114,9 +1117,10 @@ done: dprintk("msp3410: thread: exit\n"); msp->active = 0; - + msp->kthread = NULL; wakeup(&msp->kthread); + mtx_unlock(&Giant); kthread_exit(0); } @@ -1213,12 +1217,14 @@ if (msp->kthread) { /* XXX mutex lock required */ + mtx_lock(&Giant); msp->rmmod = 1; msp->watch_stereo = 0; wakeup(msp->kthread); while (msp->kthread) tsleep(&msp->kthread, PRIBIO, "wait for kthread", hz/10); + mtx_unlock(&Giant); } if (client->msp3400c_info != NULL) {