aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/endpoint.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/usb/endpoint.c')
-rw-r--r--sound/usb/endpoint.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index 7f78c6d782b0..34de6f2faf61 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -35,6 +35,7 @@
35 35
36#define EP_FLAG_ACTIVATED 0 36#define EP_FLAG_ACTIVATED 0
37#define EP_FLAG_RUNNING 1 37#define EP_FLAG_RUNNING 1
38#define EP_FLAG_STOPPING 2
38 39
39/* 40/*
40 * snd_usb_endpoint is a model that abstracts everything related to an 41 * snd_usb_endpoint is a model that abstracts everything related to an
@@ -502,10 +503,20 @@ static int wait_clear_urbs(struct snd_usb_endpoint *ep)
502 if (alive) 503 if (alive)
503 snd_printk(KERN_ERR "timeout: still %d active urbs on EP #%x\n", 504 snd_printk(KERN_ERR "timeout: still %d active urbs on EP #%x\n",
504 alive, ep->ep_num); 505 alive, ep->ep_num);
506 clear_bit(EP_FLAG_STOPPING, &ep->flags);
505 507
506 return 0; 508 return 0;
507} 509}
508 510
511/* sync the pending stop operation;
512 * this function itself doesn't trigger the stop operation
513 */
514void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep)
515{
516 if (ep && test_bit(EP_FLAG_STOPPING, &ep->flags))
517 wait_clear_urbs(ep);
518}
519
509/* 520/*
510 * unlink active urbs. 521 * unlink active urbs.
511 */ 522 */
@@ -918,6 +929,8 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep,
918 929
919 if (wait) 930 if (wait)
920 wait_clear_urbs(ep); 931 wait_clear_urbs(ep);
932 else
933 set_bit(EP_FLAG_STOPPING, &ep->flags);
921 } 934 }
922} 935}
923 936