summaryrefslogtreecommitdiffstats
path: root/sys/dev/sound
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2011-12-14 00:48:20 +0000
committerhselasky <hselasky@FreeBSD.org>2011-12-14 00:48:20 +0000
commit4109c91af29dcf4def6bc00f2bb1aec47bfff734 (patch)
tree804146607f8f403ef74b51b5b2f40e91b96b37a0 /sys/dev/sound
parent7076389cec83009f9046b6c6e2695fe340a63802 (diff)
downloadFreeBSD-src-4109c91af29dcf4def6bc00f2bb1aec47bfff734.zip
FreeBSD-src-4109c91af29dcf4def6bc00f2bb1aec47bfff734.tar.gz
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
Diffstat (limited to 'sys/dev/sound')
-rw-r--r--sys/dev/sound/usb/uaudio.c10
-rw-r--r--sys/dev/sound/usb/uaudio.h5
2 files changed, 14 insertions, 1 deletions
diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c
index de76f28..e6b4a1b 100644
--- a/sys/dev/sound/usb/uaudio.c
+++ b/sys/dev/sound/usb/uaudio.c
@@ -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);
diff --git a/sys/dev/sound/usb/uaudio.h b/sys/dev/sound/usb/uaudio.h
index 622cb3b..10c10de 100644
--- a/sys/dev/sound/usb/uaudio.h
+++ b/sys/dev/sound/usb/uaudio.h
@@ -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(struct uaudio_softc *sc, uint32_t src);
int uaudio_get_vendor(device_t dev);
int uaudio_get_product(device_t dev);
int uaudio_get_release(device_t dev);
+
+#endif /* _UAUDIO_H_ */
OpenPOWER on IntegriCloud