[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170102155031.3638-3-adi@adirat.com>
Date: Mon, 2 Jan 2017 17:50:31 +0200
From: Ioan-Adrian Ratiu <adi@...rat.com>
To: tiwai@...e.com, perex@...ex.cz, o-takashi@...amocchi.jp
Cc: linux-kernel@...r.kernel.org, alsa-devel@...a-project.org
Subject: [PATCH v2 2/2] 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@...rat.com>
---
sound/usb/endpoint.c | 3 +++
1 file changed, 3 insertions(+)
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)
if (unlikely(atomic_read(&ep->chip->shutdown)))
goto exit_clear;
+ if (unlikely(!test_bit(EP_FLAG_RUNNING, &ep->flags)))
+ goto exit_clear;
+
if (usb_pipeout(ep->pipe)) {
retire_outbound_urb(ep, ctx);
/* can be stopped during retire callback */
--
2.11.0
Powered by blists - more mailing lists