ASoC: msm: fix indefinite wait in compress drain

In compressed driver streams might get stopped while
ioctl drain is started but not completed, since buffers
are drained in multiple stages when gapless mode is
enabled.
Check stream state before issuing wait commands to
prevent waiting for drain ack on stopped streams.

Change-Id: I606639c103a7aed90dd9a4561fa6dffc3d4c3822
Signed-off-by: Dhananjay Kumar <dhakumar@codeaurora.org>
This commit is contained in:
Dhananjay Kumar 2015-11-18 18:48:51 +05:30
parent 7114c2c052
commit 04eb413627

View file

@ -1620,7 +1620,7 @@ static int msm_compr_trigger(struct snd_compr_stream *cstream, int cmd)
if (prtd->last_buffer) {
pr_debug("%s: last buffer drain\n", __func__);
rc = msm_compr_drain_buffer(prtd, &flags);
if (rc) {
if (rc || !atomic_read(&prtd->start)) {
spin_unlock_irqrestore(&prtd->lock,
flags);
break;
@ -1639,7 +1639,7 @@ static int msm_compr_trigger(struct snd_compr_stream *cstream, int cmd)
/* wait for the zero length buffer to be returned */
pr_debug("%s: zero length buffer drain\n", __func__);
rc = msm_compr_drain_buffer(prtd, &flags);
if (rc) {
if (rc || !atomic_read(&prtd->start)) {
spin_unlock_irqrestore(&prtd->lock, flags);
break;
}