Merge "ASoC: compress: Avoid race condition in compress drain"

This commit is contained in:
qctecmdr 2020-04-16 01:40:57 -07:00 • committed by Gerrit - the friendly Code Review server
commit c11b140de7

View file

@ -799,6 +799,7 @@ int snd_compr_stop_error(struct snd_compr_stream *stream,
}
EXPORT_SYMBOL_GPL(snd_compr_stop_error);
#ifndef CONFIG_AUDIO_QGKI
static int snd_compress_wait_for_drain(struct snd_compr_stream *stream)
{
int ret;
@ -833,6 +834,7 @@ static int snd_compress_wait_for_drain(struct snd_compr_stream *stream)
return ret;
}
#endif
static int snd_compr_drain(struct snd_compr_stream *stream)
{
@ -851,6 +853,7 @@ static int snd_compr_drain(struct snd_compr_stream *stream)
}
retval = stream->ops->trigger(stream, SND_COMPR_TRIGGER_DRAIN);
#ifndef CONFIG_AUDIO_QGKI
if (retval) {
pr_debug("SND_COMPR_TRIGGER_DRAIN failed %d\n", retval);
wake_up(&stream->runtime->sleep);
@ -858,6 +861,13 @@ static int snd_compr_drain(struct snd_compr_stream *stream)
}
return snd_compress_wait_for_drain(stream);
#else
if (!retval) {
stream->runtime->state = SNDRV_PCM_STATE_DRAINING;
wake_up(&stream->runtime->sleep);
}
return retval;
#endif
}
static int snd_compr_next_track(struct snd_compr_stream *stream)
@ -911,6 +921,7 @@ static int snd_compr_partial_drain(struct snd_compr_stream *stream)
return -EPERM;
retval = stream->ops->trigger(stream, SND_COMPR_TRIGGER_PARTIAL_DRAIN);
#ifndef CONFIG_AUDIO_QGKI
if (retval) {
pr_debug("Partial drain returned failure\n");
wake_up(&stream->runtime->sleep);
@ -919,6 +930,10 @@ static int snd_compr_partial_drain(struct snd_compr_stream *stream)
stream->next_track = false;
return snd_compress_wait_for_drain(stream);
#else
stream->next_track = false;
return retval;
#endif
}
#ifdef CONFIG_AUDIO_QGKI