Skip to content

Commit

Permalink
ALSA: usb-audio: Fix implicit sync clearance at stopping stream
Browse files Browse the repository at this point in the history
The recent endpoint management change for implicit feedback mode added
a clearance of ep->sync_sink (formerly ep->sync_slave) pointer at
snd_usb_endpoint_stop() to assure no leftover for the feedback from
the already stopped capture stream.  This turned out to cause a
regression, however, when full-duplex streams were running and only a
capture was stopped.  Because of the above clearance of ep->sync_sink
pointer, no more feedback is done, hence the playback will stall.

This patch fixes the ep->sync_sink clearance to be done only after all
endpoints are released, for addressing the regression.

Reported-and-tested-by: Lucas Endres <[email protected]>
Fixes: bf6313a ("ALSA: usb-audio: Refactor endpoint management")
Cc: <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
tiwai committed Apr 26, 2021
1 parent 316791b commit 988cc17
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sound/usb/endpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -1443,11 +1443,11 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep)
if (snd_BUG_ON(!atomic_read(&ep->running)))
return;

if (ep->sync_source)
WRITE_ONCE(ep->sync_source->sync_sink, NULL);

if (!atomic_dec_return(&ep->running))
if (!atomic_dec_return(&ep->running)) {
if (ep->sync_source)
WRITE_ONCE(ep->sync_source->sync_sink, NULL);
stop_urbs(ep, false);
}
}

/**
Expand Down

0 comments on commit 988cc17

Please sign in to comment.