diff options
author | Ioan-Adrian Ratiu <adi@adirat.com> | 2017-01-04 17:37:47 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2017-01-05 01:35:17 -0500 |
commit | 13a6c8328e6056932dc680e447d4c5e8ad9add17 (patch) | |
tree | 1678baeaa0a21ef8ecc188c84533276165fb82bd | |
parent | 1d0f953086f090a022f2c0e1448300c15372db46 (diff) |
ALSA: usb-audio: test EP_FLAG_RUNNING at urb completion
Testing EP_FLAG_RUNNING in snd_complete_urb() before running the completion
logic allows us to save a few cpu cycles by returning early, skipping the
pending urb in case the stream was stopped; the stop logic handles the urb
and sets the completion callbacks to NULL.
Signed-off-by: Ioan-Adrian Ratiu <adi@adirat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/usb/endpoint.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c index 2f0ea70a998c..c90607ebe155 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c | |||
@@ -384,6 +384,9 @@ static void snd_complete_urb(struct urb *urb) | |||
384 | if (unlikely(atomic_read(&ep->chip->shutdown))) | 384 | if (unlikely(atomic_read(&ep->chip->shutdown))) |
385 | goto exit_clear; | 385 | goto exit_clear; |
386 | 386 | ||
387 | if (unlikely(!test_bit(EP_FLAG_RUNNING, &ep->flags))) | ||
388 | goto exit_clear; | ||
389 | |||
387 | if (usb_pipeout(ep->pipe)) { | 390 | if (usb_pipeout(ep->pipe)) { |
388 | retire_outbound_urb(ep, ctx); | 391 | retire_outbound_urb(ep, ctx); |
389 | /* can be stopped during retire callback */ | 392 | /* can be stopped during retire callback */ |