Date: Tue, 1 Jul 2008 23:36:53 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 144450 for review Message-ID: <200807012336.m61Narvo002646@repoman.freebsd.org>
index | next in thread | raw e-mail
http://perforce.freebsd.org/chv.cgi?CH=144450 Change 144450 by hselasky@hselasky_laptop001 on 2008/07/01 23:36:42 Workaround panic at USB sound device detach during playback! There might be a deadlock situation here if the USB sound device is located on the same HUB like the mouse and keyboard, and the HUB is detached, but else this works fine and is better than nothing. Affected files ... .. //depot/projects/usb/src/sys/dev/usb2/sound/uaudio2.c#3 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb2/sound/uaudio2.c#3 (text+ko) ==== @@ -661,11 +661,6 @@ device_printf(dev, "No midi sequencer\n"); } - if (sc->sc_play_chan.valid || - sc->sc_rec_chan.valid) { - device_printf(dev, "WARNING: Unplugging the device while " - "it is in use will cause a panic!\n"); - } DPRINTF(0, "doing child attach\n"); /* attach the children */ @@ -760,6 +755,7 @@ struct uaudio_softc *sc = device_get_softc(device_get_parent(dev)); int error = 0; +repeat: if (sc->sc_pcm_registered) { error = pcm_unregister(dev); } else { @@ -769,8 +765,11 @@ } if (error) { - panic("Please don't detach your sound device " - "while it is in use. This is not supported yet!\n"); + device_printf(dev, "Waiting for sound application to exit!\n"); + mtx_lock(&Giant); + usb2_pause_mtx(&Giant, 2000); + mtx_unlock(&Giant); + goto repeat; /* try again */ } return (0); /* success */ }help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807012336.m61Narvo002646>
