summaryrefslogtreecommitdiffstats
path: root/sys/dev/sound/pcm
diff options
context:
space:
mode:
authorcg <cg@FreeBSD.org>2001-08-23 11:56:07 +0000
committercg <cg@FreeBSD.org>2001-08-23 11:56:07 +0000
commit14ef1eed0d59834c781d84b22b34c15b75ed9036 (patch)
tree3d7b31a6089be0e00ef19a6d95e1314c10ff78cd /sys/dev/sound/pcm
parent2cfb90cc8dc9d8f8ae1f12afed63cf0409ed6dd2 (diff)
downloadFreeBSD-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.c19
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;
}
OpenPOWER on IntegriCloud