Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Dec 2011 00:48:20 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r228484 - head/sys/dev/sound/usb
Message-ID:  <201112140048.pBE0mKhS074681@svn.freebsd.org>

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



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