diff options
Diffstat (limited to 'sound/usb/endpoint.c')
-rw-r--r-- | sound/usb/endpoint.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c index c41181202688..d6e2bb49c59c 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c | |||
@@ -141,7 +141,7 @@ int snd_usb_endpoint_implict_feedback_sink(struct snd_usb_endpoint *ep) | |||
141 | * | 141 | * |
142 | * For implicit feedback, next_packet_size() is unused. | 142 | * For implicit feedback, next_packet_size() is unused. |
143 | */ | 143 | */ |
144 | static int next_packet_size(struct snd_usb_endpoint *ep) | 144 | int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep) |
145 | { | 145 | { |
146 | unsigned long flags; | 146 | unsigned long flags; |
147 | int ret; | 147 | int ret; |
@@ -177,15 +177,6 @@ static void retire_inbound_urb(struct snd_usb_endpoint *ep, | |||
177 | ep->retire_data_urb(ep->data_subs, urb); | 177 | ep->retire_data_urb(ep->data_subs, urb); |
178 | } | 178 | } |
179 | 179 | ||
180 | static void prepare_outbound_urb_sizes(struct snd_usb_endpoint *ep, | ||
181 | struct snd_urb_ctx *ctx) | ||
182 | { | ||
183 | int i; | ||
184 | |||
185 | for (i = 0; i < ctx->packets; ++i) | ||
186 | ctx->packet_size[i] = next_packet_size(ep); | ||
187 | } | ||
188 | |||
189 | /* | 180 | /* |
190 | * Prepare a PLAYBACK urb for submission to the bus. | 181 | * Prepare a PLAYBACK urb for submission to the bus. |
191 | */ | 182 | */ |
@@ -370,7 +361,6 @@ static void snd_complete_urb(struct urb *urb) | |||
370 | goto exit_clear; | 361 | goto exit_clear; |
371 | } | 362 | } |
372 | 363 | ||
373 | prepare_outbound_urb_sizes(ep, ctx); | ||
374 | prepare_outbound_urb(ep, ctx); | 364 | prepare_outbound_urb(ep, ctx); |
375 | } else { | 365 | } else { |
376 | retire_inbound_urb(ep, ctx); | 366 | retire_inbound_urb(ep, ctx); |
@@ -799,7 +789,9 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, | |||
799 | /** | 789 | /** |
800 | * snd_usb_endpoint_start: start an snd_usb_endpoint | 790 | * snd_usb_endpoint_start: start an snd_usb_endpoint |
801 | * | 791 | * |
802 | * @ep: the endpoint to start | 792 | * @ep: the endpoint to start |
793 | * @can_sleep: flag indicating whether the operation is executed in | ||
794 | * non-atomic context | ||
803 | * | 795 | * |
804 | * A call to this function will increment the use count of the endpoint. | 796 | * A call to this function will increment the use count of the endpoint. |
805 | * In case it is not already running, the URBs for this endpoint will be | 797 | * In case it is not already running, the URBs for this endpoint will be |
@@ -809,7 +801,7 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, | |||
809 | * | 801 | * |
810 | * Returns an error if the URB submission failed, 0 in all other cases. | 802 | * Returns an error if the URB submission failed, 0 in all other cases. |
811 | */ | 803 | */ |
812 | int snd_usb_endpoint_start(struct snd_usb_endpoint *ep) | 804 | int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, int can_sleep) |
813 | { | 805 | { |
814 | int err; | 806 | int err; |
815 | unsigned int i; | 807 | unsigned int i; |
@@ -821,6 +813,11 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep) | |||
821 | if (++ep->use_count != 1) | 813 | if (++ep->use_count != 1) |
822 | return 0; | 814 | return 0; |
823 | 815 | ||
816 | /* just to be sure */ | ||
817 | deactivate_urbs(ep, 0, can_sleep); | ||
818 | if (can_sleep) | ||
819 | wait_clear_urbs(ep); | ||
820 | |||
824 | ep->active_mask = 0; | 821 | ep->active_mask = 0; |
825 | ep->unlink_mask = 0; | 822 | ep->unlink_mask = 0; |
826 | ep->phase = 0; | 823 | ep->phase = 0; |
@@ -850,7 +847,6 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep) | |||
850 | goto __error; | 847 | goto __error; |
851 | 848 | ||
852 | if (usb_pipeout(ep->pipe)) { | 849 | if (usb_pipeout(ep->pipe)) { |
853 | prepare_outbound_urb_sizes(ep, urb->context); | ||
854 | prepare_outbound_urb(ep, urb->context); | 850 | prepare_outbound_urb(ep, urb->context); |
855 | } else { | 851 | } else { |
856 | prepare_inbound_urb(ep, urb->context); | 852 | prepare_inbound_urb(ep, urb->context); |