svn commit: r232877 - stable/9/sys/dev/sound/usb

Hans Petter Selasky hselasky at FreeBSD.org
Mon Mar 12 18:38:40 UTC 2012


Author: hselasky
Date: Mon Mar 12 18:38:40 2012
New Revision: 232877
URL: http://svn.freebsd.org/changeset/base/232877

Log:
  MFC r228485 and r227843:
  Stop USB audio transfers early so that any audio applications
  will time out and close opened /dev/dspX.Y device(s), if
  any.

Modified:
  stable/9/sys/dev/sound/usb/uaudio.c
  stable/9/sys/dev/sound/usb/uaudio.h
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/dev/sound/usb/uaudio.c
==============================================================================
--- stable/9/sys/dev/sound/usb/uaudio.c	Mon Mar 12 18:22:04 2012	(r232876)
+++ stable/9/sys/dev/sound/usb/uaudio.c	Mon Mar 12 18:38:40 2012	(r232877)
@@ -773,7 +773,17 @@ 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.
+	 */
+	if (sc->sc_play_chan.valid)
+		usbd_transfer_unsetup(sc->sc_play_chan.xfer, UAUDIO_NCHANBUFS);
+	if (sc->sc_rec_chan.valid)
+		usbd_transfer_unsetup(sc->sc_rec_chan.xfer, UAUDIO_NCHANBUFS);
+
+	if (bus_generic_detach(dev) != 0) {
 		DPRINTF("detach failed!\n");
 	}
 	sbuf_delete(&sc->sc_sndstat);

Modified: stable/9/sys/dev/sound/usb/uaudio.h
==============================================================================
--- stable/9/sys/dev/sound/usb/uaudio.h	Mon Mar 12 18:22:04 2012	(r232876)
+++ stable/9/sys/dev/sound/usb/uaudio.h	Mon Mar 12 18:38:40 2012	(r232877)
@@ -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-stable-9 mailing list