Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 13a6c832 authored by Ioan-Adrian Ratiu's avatar Ioan-Adrian Ratiu Committed by Takashi Iwai
Browse files

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: default avatarIoan-Adrian Ratiu <adi@adirat.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 1d0f9530
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -384,6 +384,9 @@ static void snd_complete_urb(struct urb *urb)
	if (unlikely(atomic_read(&ep->chip->shutdown)))
	if (unlikely(atomic_read(&ep->chip->shutdown)))
		goto exit_clear;
		goto exit_clear;


	if (unlikely(!test_bit(EP_FLAG_RUNNING, &ep->flags)))
		goto exit_clear;

	if (usb_pipeout(ep->pipe)) {
	if (usb_pipeout(ep->pipe)) {
		retire_outbound_urb(ep, ctx);
		retire_outbound_urb(ep, ctx);
		/* can be stopped during retire callback */
		/* can be stopped during retire callback */