svn commit: r228484 - head/sys/dev/sound/usb
Hans Petter Selasky
hselasky at FreeBSD.org
Wed Dec 14 00:48:21 UTC 2011
Author: hselasky
Date: Wed Dec 14 00:48:20 2011
New Revision: 228484
URL: http://svn.freebsd.org/changeset/base/228484
Log:
Stop USB audio transfers early so that any audio applications
will time out and close opened /dev/dspX.Y device(s), if
any. This is a workaround because we cannot unregister PCM
devices while the audio character device is in use.
Add a missing inclusion guard.
MFC after: 1 weeks
Modified:
head/sys/dev/sound/usb/uaudio.c
head/sys/dev/sound/usb/uaudio.h
Modified: head/sys/dev/sound/usb/uaudio.c
==============================================================================
--- head/sys/dev/sound/usb/uaudio.c Wed Dec 14 00:28:54 2011 (r228483)
+++ head/sys/dev/sound/usb/uaudio.c Wed Dec 14 00:48:20 2011 (r228484)
@@ -765,7 +765,15 @@ uaudio_detach(device_t dev)
{
struct uaudio_softc *sc = device_get_softc(dev);
- if (bus_generic_detach(dev)) {
+ /*
+ * Stop USB transfers early so that any audio applications
+ * will time out and close opened /dev/dspX.Y device(s), if
+ * any.
+ */
+ uaudio_chan_stop(&sc->sc_play_chan);
+ uaudio_chan_stop(&sc->sc_rec_chan);
+
+ if (bus_generic_detach(dev) != 0) {
DPRINTF("detach failed!\n");
}
sbuf_delete(&sc->sc_sndstat);
Modified: head/sys/dev/sound/usb/uaudio.h
==============================================================================
--- head/sys/dev/sound/usb/uaudio.h Wed Dec 14 00:28:54 2011 (r228483)
+++ head/sys/dev/sound/usb/uaudio.h Wed Dec 14 00:48:20 2011 (r228484)
@@ -27,6 +27,9 @@
/* prototypes from "uaudio.c" used by "uaudio_pcm.c" */
+#ifndef _UAUDIO_H_
+#define _UAUDIO_H_
+
struct uaudio_chan;
struct uaudio_softc;
struct snd_dbuf;
@@ -63,3 +66,5 @@ extern uint32_t uaudio_mixer_setrecsrc(s
int uaudio_get_vendor(device_t dev);
int uaudio_get_product(device_t dev);
int uaudio_get_release(device_t dev);
+
+#endif /* _UAUDIO_H_ */
More information about the svn-src-all
mailing list