Index: pcm/dsp.c =================================================================== RCS file: /home/ncvs/src/sys/dev/sound/pcm/dsp.c,v retrieving revision 1.15.2.10 diff -u -r1.15.2.10 dsp.c --- pcm/dsp.c 2001/08/24 18:39:21 1.15.2.10 +++ pcm/dsp.c 2001/09/14 14:34:49 @@ -245,10 +245,10 @@ chn_reset(rdch, fmt); if (flags & O_NONBLOCK) rdch->flags |= CHN_F_NBIO; - } else { + } else CHN_LOCK(rdch); - pcm_chnref(rdch, 1); - } + + pcm_chnref(rdch, 1); CHN_UNLOCK(rdch); } if (wrch) { @@ -256,10 +256,10 @@ chn_reset(wrch, fmt); if (flags & O_NONBLOCK) wrch->flags |= CHN_F_NBIO; - } else { + } else CHN_LOCK(wrch); - pcm_chnref(wrch, 1); - } + + pcm_chnref(wrch, 1); CHN_UNLOCK(wrch); } splx(s); Index: pcm/sndstat.c =================================================================== RCS file: /home/ncvs/src/sys/dev/sound/pcm/sndstat.c,v retrieving revision 1.4.2.1 diff -u -r1.4.2.1 sndstat.c --- pcm/sndstat.c 2001/08/01 03:41:03 1.4.2.1 +++ pcm/sndstat.c 2001/09/14 14:50:56 @@ -108,12 +108,25 @@ sndstat_close(dev_t i_dev, int flags, int mode, struct proc *p) { intrmask_t s; + int i; + struct snddev_info *d; s = spltty(); + if (!sndstat_isopen) { splx(s); return EBADF; } + + for (i = 0; i < devclass_get_maxunit(pcm_devclass); i++) { + d = devclass_get_softc(pcm_devclass, i); + if (!d) + continue; + snd_mtxlock(d->lock); + d->inprog--; + snd_mtxunlock(d->lock); + } + sbuf_delete(&sndstat_sbuf); sndstat_isopen = 0; @@ -163,6 +176,7 @@ if (!d) continue; snd_mtxlock(d->lock); + d->inprog++; dev = devclass_get_device(pcm_devclass, i); sbuf_printf(s, "pcm%d: <%s> %s", i, device_get_desc(dev), d->status); if (!SLIST_EMPTY(&d->channels)) { Index: pcm/sound.c =================================================================== RCS file: /home/ncvs/src/sys/dev/sound/pcm/sound.c,v retrieving revision 1.17.2.11 diff -u -r1.17.2.11 sound.c --- pcm/sound.c 2001/08/02 14:50:59 1.17.2.11 +++ pcm/sound.c 2001/09/14 14:50:39 @@ -416,19 +416,19 @@ snd_mtxlock(d->lock); if (d->inprog) { - device_printf(dev, "unregister: operation in progress"); + device_printf(dev, "unregister: operation in progress\n"); snd_mtxunlock(d->lock); return EBUSY; } SLIST_FOREACH(sce, &d->channels, link) { if (sce->channel->refcount > 0) { - device_printf(dev, "unregister: channel busy"); + device_printf(dev, "unregister: channel busy\n"); snd_mtxunlock(d->lock); return EBUSY; } } if (mixer_uninit(dev)) { - device_printf(dev, "unregister: mixer busy"); + device_printf(dev, "unregister: mixer busy\n"); snd_mtxunlock(d->lock); return EBUSY; }