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

Commit c11b140d authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

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

parents 232c301b a15c8260
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -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