diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index 92c5f3d613e6ee..f3703e807bad74 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -774,25 +774,14 @@ mixer_uninit(device_t dev) d = device_get_softc(dev); pdev = mixer_get_devt(dev); - if (d == NULL || pdev == NULL || pdev->si_drv1 == NULL) + if (d == NULL || pdev == NULL || (m = pdev->si_drv1) == NULL) return EBADF; - m = pdev->si_drv1; KASSERT(m != NULL, ("NULL snd_mixer")); KASSERT(m->type == MIXER_TYPE_PRIMARY, ("%s(): illegal mixer type=%d", __func__, m->type)); - snd_mtxlock(m->lock); - - if (m->busy) { - snd_mtxunlock(m->lock); - return EBUSY; - } - - /* destroy dev can sleep --hps */ - - snd_mtxunlock(m->lock); - + d->mixer_dev = NULL; pdev->si_drv1 = NULL; destroy_dev(pdev); @@ -812,7 +801,6 @@ mixer_uninit(device_t dev) snd_mtxfree(m->lock); kobj_delete((kobj_t)m, M_MIXER); - d->mixer_dev = NULL; --mixer_count; diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index b4be28aeff844a..c020f6019c8b3e 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -1145,9 +1145,7 @@ pcm_unregister(device_t dev) { struct snddev_info *d; struct pcm_channel *ch; - struct thread *td; - td = curthread; d = device_get_softc(dev); if (!PCM_ALIVE(d)) { @@ -1194,15 +1192,7 @@ pcm_unregister(device_t dev) } } - if (mixer_uninit(dev) == EBUSY) { - device_printf(dev, "unregister: mixer busy\n"); - PCM_LOCK(d); - if (d->clones != NULL) - (void)snd_clone_enable(d->clones); - PCM_RELEASE(d); - PCM_UNLOCK(d); - return (EBUSY); - } + mixer_uninit(dev); /* remove /dev/sndstat entry first */ sndstat_unregister(dev); diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index 3285710be961b0..77dc12627f30f4 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -1235,8 +1235,10 @@ uaudio_detach_sub(device_t dev) if (sc->sc_child[i].pcm_registered) { error = pcm_unregister(dev); } else { - if (sc->sc_child[i].mixer_init) - error = mixer_uninit(dev); + if (sc->sc_child[i].mixer_init) { + error = 0; + mixer_uninit(dev); + } } if (error) {