diff options
author | cg <cg@FreeBSD.org> | 2001-08-23 11:56:07 +0000 |
---|---|---|
committer | cg <cg@FreeBSD.org> | 2001-08-23 11:56:07 +0000 |
commit | 14ef1eed0d59834c781d84b22b34c15b75ed9036 (patch) | |
tree | 3d7b31a6089be0e00ef19a6d95e1314c10ff78cd /sys/dev/sound/pcm | |
parent | 2cfb90cc8dc9d8f8ae1f12afed63cf0409ed6dd2 (diff) | |
download | FreeBSD-src-14ef1eed0d59834c781d84b22b34c15b75ed9036.zip FreeBSD-src-14ef1eed0d59834c781d84b22b34c15b75ed9036.tar.gz |
MFS: allow multiple opens of mixer devices
Diffstat (limited to 'sys/dev/sound/pcm')
-rw-r--r-- | sys/dev/sound/pcm/mixer.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index ba8a473..cddb515 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -397,14 +397,13 @@ mixer_open(dev_t i_dev, int flags, int mode, struct proc *p) struct snd_mixer *m; intrmask_t s; - s = spltty(); m = i_dev->si_drv1; - if (m->busy) { - splx(s); - return EBUSY; - } - m->busy = 1; + s = spltty(); + snd_mtxlock(m->lock); + + m->busy++; + snd_mtxunlock(m->lock); splx(s); return 0; } @@ -415,14 +414,18 @@ mixer_close(dev_t i_dev, int flags, int mode, struct proc *p) struct snd_mixer *m; intrmask_t s; - s = spltty(); m = i_dev->si_drv1; + s = spltty(); + snd_mtxlock(m->lock); + if (!m->busy) { + snd_mtxunlock(m->lock); splx(s); return EBADF; } - m->busy = 0; + m->busy--; + snd_mtxunlock(m->lock); splx(s); return 0; } |