All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ALSA: snd-usb: tighten EP_FLAG_RUNNING checks
@ 2012-07-12 13:19 Daniel Mack
  2012-07-12 13:19 ` [PATCH 2/2] ALSA: snd-usb: move calls to usb_set_interface Daniel Mack
  2012-07-12 14:29 ` [PATCH 1/2] ALSA: snd-usb: tighten EP_FLAG_RUNNING checks Clemens Ladisch
  0 siblings, 2 replies; 10+ messages in thread
From: Daniel Mack @ 2012-07-12 13:19 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, clemens, philipp, joseph.salisbury, Daniel Mack

In endpoint.c, bail out earlier in case the stream is stopped. Also
clear the flag from deactivate_urbs() in case the chip's shutdown
flag is set.

Signed-off-by: Daniel Mack <zonque@gmail.com>
---
 sound/usb/endpoint.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index e690690..a75bdf4 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -350,7 +350,8 @@ static void snd_complete_urb(struct urb *urb)
 		     urb->status == -ENODEV ||		/* device removed */
 		     urb->status == -ECONNRESET ||	/* unlinked */
 		     urb->status == -ESHUTDOWN ||	/* device disabled */
-		     ep->chip->shutdown))		/* device disconnected */
+		     ep->chip->shutdown) ||		/* device disconnected */
+		     !test_bit(EP_FLAG_RUNNING, &ep->flags))
 		goto exit_clear;
 
 	if (usb_pipeout(ep->pipe)) {
@@ -522,13 +523,13 @@ static int deactivate_urbs(struct snd_usb_endpoint *ep, int force, int can_sleep
 	unsigned int i;
 	int async;
 
+	clear_bit(EP_FLAG_RUNNING, &ep->flags);
+
 	if (!force && ep->chip->shutdown) /* to be sure... */
 		return -EBADFD;
 
 	async = !can_sleep && ep->chip->async_unlink;
 
-	clear_bit(EP_FLAG_RUNNING, &ep->flags);
-
 	INIT_LIST_HEAD(&ep->ready_playback_urbs);
 	ep->next_packet_read_pos = 0;
 	ep->next_packet_write_pos = 0;
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-07-13  7:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-12 13:19 [PATCH 1/2] ALSA: snd-usb: tighten EP_FLAG_RUNNING checks Daniel Mack
2012-07-12 13:19 ` [PATCH 2/2] ALSA: snd-usb: move calls to usb_set_interface Daniel Mack
2012-07-13  5:58   ` Takashi Iwai
2012-07-13  6:08     ` Daniel Mack
2012-07-13  7:33       ` Takashi Iwai
2012-07-12 14:29 ` [PATCH 1/2] ALSA: snd-usb: tighten EP_FLAG_RUNNING checks Clemens Ladisch
2012-07-12 14:58   ` Daniel Mack
2012-07-12 15:20     ` Clemens Ladisch
2012-07-12 15:27       ` Daniel Mack
     [not found]         ` <4FFF232E.8020008@canonical.com>
2012-07-12 19:26           ` Daniel Mack

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.