aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/endpoint.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-09-11 10:46:36 -0400
committerTakashi Iwai <tiwai@suse.de>2012-09-11 10:46:36 -0400
commit05288426908ecb7ed7cbff61901db5918525578a (patch)
tree94a814cfdd53a011a10da09201ed08a6572175ff /sound/usb/endpoint.c
parentb35aabd78ddae8300fda7e6a1ac6f0484ef3e804 (diff)
parentc302d6133c094bda7a7ce94eac5b50c018a7ca7b (diff)
Merge branch 'for-linus' into for-next
To merge HD-audio fixes back to 3.7 development line
Diffstat (limited to 'sound/usb/endpoint.c')
-rw-r--r--sound/usb/endpoint.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index 94b08a6087a3..a83a18dbac25 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -142,7 +142,7 @@ int snd_usb_endpoint_implict_feedback_sink(struct snd_usb_endpoint *ep)
142 * 142 *
143 * For implicit feedback, next_packet_size() is unused. 143 * For implicit feedback, next_packet_size() is unused.
144 */ 144 */
145static int next_packet_size(struct snd_usb_endpoint *ep) 145int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep)
146{ 146{
147 unsigned long flags; 147 unsigned long flags;
148 int ret; 148 int ret;
@@ -183,15 +183,6 @@ static void retire_inbound_urb(struct snd_usb_endpoint *ep,
183 ep->retire_data_urb(ep->data_subs, urb); 183 ep->retire_data_urb(ep->data_subs, urb);
184} 184}
185 185
186static void prepare_outbound_urb_sizes(struct snd_usb_endpoint *ep,
187 struct snd_urb_ctx *ctx)
188{
189 int i;
190
191 for (i = 0; i < ctx->packets; ++i)
192 ctx->packet_size[i] = next_packet_size(ep);
193}
194
195/* 186/*
196 * Prepare a PLAYBACK urb for submission to the bus. 187 * Prepare a PLAYBACK urb for submission to the bus.
197 */ 188 */
@@ -376,7 +367,6 @@ static void snd_complete_urb(struct urb *urb)
376 goto exit_clear; 367 goto exit_clear;
377 } 368 }
378 369
379 prepare_outbound_urb_sizes(ep, ctx);
380 prepare_outbound_urb(ep, ctx); 370 prepare_outbound_urb(ep, ctx);
381 } else { 371 } else {
382 retire_inbound_urb(ep, ctx); 372 retire_inbound_urb(ep, ctx);
@@ -805,7 +795,9 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep,
805/** 795/**
806 * snd_usb_endpoint_start: start an snd_usb_endpoint 796 * snd_usb_endpoint_start: start an snd_usb_endpoint
807 * 797 *
808 * @ep: the endpoint to start 798 * @ep: the endpoint to start
799 * @can_sleep: flag indicating whether the operation is executed in
800 * non-atomic context
809 * 801 *
810 * A call to this function will increment the use count of the endpoint. 802 * A call to this function will increment the use count of the endpoint.
811 * In case it is not already running, the URBs for this endpoint will be 803 * In case it is not already running, the URBs for this endpoint will be
@@ -815,7 +807,7 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep,
815 * 807 *
816 * Returns an error if the URB submission failed, 0 in all other cases. 808 * Returns an error if the URB submission failed, 0 in all other cases.
817 */ 809 */
818int snd_usb_endpoint_start(struct snd_usb_endpoint *ep) 810int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, int can_sleep)
819{ 811{
820 int err; 812 int err;
821 unsigned int i; 813 unsigned int i;
@@ -827,6 +819,11 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep)
827 if (++ep->use_count != 1) 819 if (++ep->use_count != 1)
828 return 0; 820 return 0;
829 821
822 /* just to be sure */
823 deactivate_urbs(ep, 0, can_sleep);
824 if (can_sleep)
825 wait_clear_urbs(ep);
826
830 ep->active_mask = 0; 827 ep->active_mask = 0;
831 ep->unlink_mask = 0; 828 ep->unlink_mask = 0;
832 ep->phase = 0; 829 ep->phase = 0;
@@ -858,7 +855,6 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep)
858 goto __error; 855 goto __error;
859 856
860 if (usb_pipeout(ep->pipe)) { 857 if (usb_pipeout(ep->pipe)) {
861 prepare_outbound_urb_sizes(ep, urb->context);
862 prepare_outbound_urb(ep, urb->context); 858 prepare_outbound_urb(ep, urb->context);
863 } else { 859 } else {
864 prepare_inbound_urb(ep, urb->context); 860 prepare_inbound_urb(ep, urb->context);