Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Mar 2012 18:38:40 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r232877 - stable/9/sys/dev/sound/usb
Message-ID:  <201203121838.q2CIceHY079682@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203121838.q2CIceHY079682>