diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/usb/endpoint.c | 11 | ||||
-rw-r--r-- | sound/usb/endpoint.h | 2 | ||||
-rw-r--r-- | sound/usb/pcm.c | 9 |
3 files changed, 13 insertions, 9 deletions
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c index 6db2143350d3..f487d26f8d40 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c | |||
@@ -896,8 +896,11 @@ __error: | |||
896 | * actually be deactivated. | 896 | * actually be deactivated. |
897 | * | 897 | * |
898 | * Must be balanced to calls of snd_usb_endpoint_start(). | 898 | * Must be balanced to calls of snd_usb_endpoint_start(). |
899 | * | ||
900 | * The caller needs to synchronize the pending stop operation via | ||
901 | * snd_usb_endpoint_sync_pending_stop(). | ||
899 | */ | 902 | */ |
900 | void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep, bool wait) | 903 | void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep) |
901 | { | 904 | { |
902 | if (!ep) | 905 | if (!ep) |
903 | return; | 906 | return; |
@@ -911,11 +914,7 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep, bool wait) | |||
911 | ep->sync_slave = NULL; | 914 | ep->sync_slave = NULL; |
912 | ep->retire_data_urb = NULL; | 915 | ep->retire_data_urb = NULL; |
913 | ep->prepare_data_urb = NULL; | 916 | ep->prepare_data_urb = NULL; |
914 | 917 | set_bit(EP_FLAG_STOPPING, &ep->flags); | |
915 | if (wait) | ||
916 | wait_clear_urbs(ep); | ||
917 | else | ||
918 | set_bit(EP_FLAG_STOPPING, &ep->flags); | ||
919 | } | 918 | } |
920 | } | 919 | } |
921 | 920 | ||
diff --git a/sound/usb/endpoint.h b/sound/usb/endpoint.h index f1e451da9a67..447902dd8a4a 100644 --- a/sound/usb/endpoint.h +++ b/sound/usb/endpoint.h | |||
@@ -17,7 +17,7 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, | |||
17 | struct snd_usb_endpoint *sync_ep); | 17 | struct snd_usb_endpoint *sync_ep); |
18 | 18 | ||
19 | int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, bool can_sleep); | 19 | int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, bool can_sleep); |
20 | void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep, bool wait); | 20 | void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep); |
21 | void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep); | 21 | void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep); |
22 | int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep); | 22 | int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep); |
23 | int snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep); | 23 | int snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep); |
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index d90604aa5137..4750d3d5c0cc 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c | |||
@@ -266,10 +266,15 @@ static int start_endpoints(struct snd_usb_substream *subs, bool can_sleep) | |||
266 | static void stop_endpoints(struct snd_usb_substream *subs, bool wait) | 266 | static void stop_endpoints(struct snd_usb_substream *subs, bool wait) |
267 | { | 267 | { |
268 | if (test_and_clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags)) | 268 | if (test_and_clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags)) |
269 | snd_usb_endpoint_stop(subs->sync_endpoint, wait); | 269 | snd_usb_endpoint_stop(subs->sync_endpoint); |
270 | 270 | ||
271 | if (test_and_clear_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags)) | 271 | if (test_and_clear_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags)) |
272 | snd_usb_endpoint_stop(subs->data_endpoint, wait); | 272 | snd_usb_endpoint_stop(subs->data_endpoint); |
273 | |||
274 | if (wait) { | ||
275 | snd_usb_endpoint_sync_pending_stop(subs->sync_endpoint); | ||
276 | snd_usb_endpoint_sync_pending_stop(subs->data_endpoint); | ||
277 | } | ||
273 | } | 278 | } |
274 | 279 | ||
275 | static int deactivate_endpoints(struct snd_usb_substream *subs) | 280 | static int deactivate_endpoints(struct snd_usb_substream *subs) |