diff options
author | truckman <truckman@FreeBSD.org> | 2004-02-28 19:47:02 +0000 |
---|---|---|
committer | truckman <truckman@FreeBSD.org> | 2004-02-28 19:47:02 +0000 |
commit | 0810203f400a00c493ca888054ecef05fd79854c (patch) | |
tree | 929fb68d1e346df84f89f946fd5915522c44cda8 /sys/dev/sound/pcm/sound.c | |
parent | 9389696e8906abb17c16608befcd37d32e8ed693 (diff) | |
download | FreeBSD-src-0810203f400a00c493ca888054ecef05fd79854c.zip FreeBSD-src-0810203f400a00c493ca888054ecef05fd79854c.tar.gz |
Create a new mutex type for virtual channels. This allows us to get
rid of the MTX_DUPOK flag on channel mutexes, which allows witness to
do a better job of lock order checking. Nuke snd_chnmtxcreate() since
it is no longer needed.
Tested by: matk
Diffstat (limited to 'sys/dev/sound/pcm/sound.c')
-rw-r--r-- | sys/dev/sound/pcm/sound.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index edb765e..67ba33e 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -82,22 +82,6 @@ snd_mtxcreate(const char *desc, const char *type) #endif } -void * -snd_chnmtxcreate(const char *desc, const char *type) -{ -#ifdef USING_MUTEX - struct mtx *m; - - m = malloc(sizeof(*m), M_DEVBUF, M_WAITOK | M_ZERO); - if (m == NULL) - return NULL; - mtx_init(m, desc, type, MTX_DEF | MTX_DUPOK); - return m; -#else - return (void *)0xcafebabe; -#endif -} - void snd_mtxfree(void *m) { @@ -358,22 +342,24 @@ pcm_chn_create(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t c { struct pcm_channel *ch; char *dirs; - int err, *pnum; + int direction, err, *pnum; switch(dir) { case PCMDIR_PLAY: dirs = "play"; + direction = PCMDIR_PLAY; pnum = &d->playcount; break; case PCMDIR_REC: dirs = "record"; + direction = PCMDIR_REC; pnum = &d->reccount; break; case PCMDIR_VIRTUAL: dirs = "virtual"; - dir = PCMDIR_PLAY; + direction = PCMDIR_PLAY; pnum = &d->vchancount; break; @@ -402,7 +388,7 @@ pcm_chn_create(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t c ch->dev = d->dev; snprintf(ch->name, 32, "%s:%s:%d", device_get_nameunit(ch->dev), dirs, ch->num); - err = chn_init(ch, devinfo, dir); + err = chn_init(ch, devinfo, dir, direction); if (err) { device_printf(d->dev, "chn_init(%s) failed: err = %d\n", ch->name, err); kobj_delete(ch->methods, M_DEVBUF); @@ -684,7 +670,7 @@ pcm_register(device_t dev, void *devinfo, int numplay, int numrec) d->flags |= SD_F_SIMPLEX; d->fakechan = fkchan_setup(dev); - chn_init(d->fakechan, NULL, 0); + chn_init(d->fakechan, NULL, 0, 0); #ifdef SND_DYNSYSCTL sysctl_ctx_init(&d->sysctl_tree); |