PERFORCE change 144450 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Tue Jul 1 23:36:53 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=144450
Change 144450 by hselasky at 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 */
}
More information about the p4-projects
mailing list