MFS: allow multiple opens of mixer devices

This commit is contained in:
Cameron Grant 2001-08-23 11:56:07 +00:00
parent 67b1dce3bc
commit 1662598f0c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=82181

View File

@ -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;
}