Commit b2eb950d authored by Takashi Iwai's avatar Takashi Iwai

ALSA: usb-audio: stop both data and sync endpoints asynchronously

As we are stopping the endpoints asynchronously now, it's better to
trigger the stop of both data and sync endpoints and wait for pending
stopping operations, instead of the sequential trigger-and-wait
procedure.

So the wait argument in snd_usb_endpoint_stop() is dropped, and it's
expected that the caller synchronizes explicitly by calling
snd_usb_endpoint_sync_pending_stop().  (Actually there is only one
place calling this, so it was safe to change.)
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent ccc1696d
...@@ -896,8 +896,11 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, bool can_sleep) ...@@ -896,8 +896,11 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, bool can_sleep)
* actually be deactivated. * actually be deactivated.
* *
* Must be balanced to calls of snd_usb_endpoint_start(). * Must be balanced to calls of snd_usb_endpoint_start().
*
* The caller needs to synchronize the pending stop operation via
* snd_usb_endpoint_sync_pending_stop().
*/ */
void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep, bool wait) void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep)
{ {
if (!ep) if (!ep)
return; return;
...@@ -911,10 +914,6 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep, bool wait) ...@@ -911,10 +914,6 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep, bool wait)
ep->sync_slave = NULL; ep->sync_slave = NULL;
ep->retire_data_urb = NULL; ep->retire_data_urb = NULL;
ep->prepare_data_urb = NULL; ep->prepare_data_urb = NULL;
if (wait)
wait_clear_urbs(ep);
else
set_bit(EP_FLAG_STOPPING, &ep->flags); set_bit(EP_FLAG_STOPPING, &ep->flags);
} }
} }
......
...@@ -17,7 +17,7 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, ...@@ -17,7 +17,7 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep,
struct snd_usb_endpoint *sync_ep); struct snd_usb_endpoint *sync_ep);
int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, bool can_sleep); int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, bool can_sleep);
void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep, bool wait); void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep);
void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep); void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep);
int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep); int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep);
int snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep); int snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep);
......
...@@ -266,10 +266,15 @@ static int start_endpoints(struct snd_usb_substream *subs, bool can_sleep) ...@@ -266,10 +266,15 @@ static int start_endpoints(struct snd_usb_substream *subs, bool can_sleep)
static void stop_endpoints(struct snd_usb_substream *subs, bool wait) static void stop_endpoints(struct snd_usb_substream *subs, bool wait)
{ {
if (test_and_clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags)) if (test_and_clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags))
snd_usb_endpoint_stop(subs->sync_endpoint, wait); snd_usb_endpoint_stop(subs->sync_endpoint);
if (test_and_clear_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags)) if (test_and_clear_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags))
snd_usb_endpoint_stop(subs->data_endpoint, wait); snd_usb_endpoint_stop(subs->data_endpoint);
if (wait) {
snd_usb_endpoint_sync_pending_stop(subs->sync_endpoint);
snd_usb_endpoint_sync_pending_stop(subs->data_endpoint);
}
} }
static int deactivate_endpoints(struct snd_usb_substream *subs) static int deactivate_endpoints(struct snd_usb_substream *subs)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment