View | Details | Raw Unified | Return to bug 194727 | Differences between
and this patch

Collapse All | Expand All

(-)/usr/src/sys/dev/sound/pcm/mixer.c (-14 / +2 lines)
Lines 774-798 Link Here
774
774
775
	d = device_get_softc(dev);
775
	d = device_get_softc(dev);
776
	pdev = mixer_get_devt(dev);
776
	pdev = mixer_get_devt(dev);
777
	if (d == NULL || pdev == NULL || pdev->si_drv1 == NULL)
777
	if (d == NULL || pdev == NULL || (m = pdev->si_drv1) == NULL)
778
		return EBADF;
778
		return EBADF;
779
779
780
	m = pdev->si_drv1;
781
	KASSERT(m != NULL, ("NULL snd_mixer"));
780
	KASSERT(m != NULL, ("NULL snd_mixer"));
782
	KASSERT(m->type == MIXER_TYPE_PRIMARY,
781
	KASSERT(m->type == MIXER_TYPE_PRIMARY,
783
	    ("%s(): illegal mixer type=%d", __func__, m->type));
782
	    ("%s(): illegal mixer type=%d", __func__, m->type));
784
783
785
	snd_mtxlock(m->lock);
784
	d->mixer_dev = NULL;
786
787
	if (m->busy) {
788
		snd_mtxunlock(m->lock);
789
		return EBUSY;
790
	}
791
792
	/* destroy dev can sleep --hps */
793
794
	snd_mtxunlock(m->lock);
795
796
	pdev->si_drv1 = NULL;
785
	pdev->si_drv1 = NULL;
797
	destroy_dev(pdev);
786
	destroy_dev(pdev);
798
787
Lines 812-818 Link Here
812
	snd_mtxfree(m->lock);
801
	snd_mtxfree(m->lock);
813
	kobj_delete((kobj_t)m, M_MIXER);
802
	kobj_delete((kobj_t)m, M_MIXER);
814
803
815
	d->mixer_dev = NULL;
816
804
817
	--mixer_count;
805
	--mixer_count;
818
806
(-)/usr/src/sys/dev/sound/pcm/sound.c (-11 / +1 lines)
Lines 1145-1153 Link Here
1145
{
1145
{
1146
	struct snddev_info *d;
1146
	struct snddev_info *d;
1147
	struct pcm_channel *ch;
1147
	struct pcm_channel *ch;
1148
	struct thread *td;
1149
1148
1150
	td = curthread;
1151
	d = device_get_softc(dev);
1149
	d = device_get_softc(dev);
1152
1150
1153
	if (!PCM_ALIVE(d)) {
1151
	if (!PCM_ALIVE(d)) {
Lines 1194-1208 Link Here
1194
		}
1192
		}
1195
	}
1193
	}
1196
1194
1197
	if (mixer_uninit(dev) == EBUSY) {
1195
	mixer_uninit(dev);
1198
		device_printf(dev, "unregister: mixer busy\n");
1199
		PCM_LOCK(d);
1200
		if (d->clones != NULL)
1201
			(void)snd_clone_enable(d->clones);
1202
		PCM_RELEASE(d);
1203
		PCM_UNLOCK(d);
1204
		return (EBUSY);
1205
	}
1206
1196
1207
	/* remove /dev/sndstat entry first */
1197
	/* remove /dev/sndstat entry first */
1208
	sndstat_unregister(dev);
1198
	sndstat_unregister(dev);
(-)/usr/src/sys/dev/sound/usb/uaudio.c (-2 / +4 lines)
Lines 1230-1237 Link Here
1230
	if (sc->sc_child[i].pcm_registered) {
1230
	if (sc->sc_child[i].pcm_registered) {
1231
		error = pcm_unregister(dev);
1231
		error = pcm_unregister(dev);
1232
	} else {
1232
	} else {
1233
		if (sc->sc_child[i].mixer_init)
1233
		if (sc->sc_child[i].mixer_init) {
1234
			error = mixer_uninit(dev);
1234
			error = 0;
1235
			mixer_uninit(dev);
1236
		}
1235
	}
1237
	}
1236
1238
1237
	if (error) {
1239
	if (error) {

Return to bug 194727