ASoC: msm: proper error code for drain ioctl

If a drain ioctl on a compressed driver has been interrupted
by a reset ioctl, we need to return a proper error code for the
drain ioctl

Change-Id: I15f42a22b1cc13b3a0e2ae873adfcd1db2ac1e53
Signed-off-by: Haynes Mathew George <hgeorge@codeaurora.org>
CRs-Fixed: 445370
This commit is contained in:
Haynes Mathew George 2013-01-23 14:25:40 -08:00 committed by Iliyan Malchev
parent dc326510ef
commit 4b8f6f68a6
2 changed files with 10 additions and 4 deletions

View file

@ -466,7 +466,7 @@ static int msm_compr_playback_prepare(struct snd_pcm_substream *substream)
prtd->enabled = 1;
prtd->cmd_ack = 0;
prtd->cmd_interrupt = 0;
return 0;
}
@ -1147,7 +1147,7 @@ static int msm_compr_ioctl(struct snd_pcm_substream *substream,
(substream->stream == SNDRV_PCM_STREAM_CAPTURE &&
atomic_read(&prtd->start))) {
if (atomic_read(&prtd->eos)) {
prtd->cmd_ack = 1;
prtd->cmd_interrupt = 1;
wake_up(&the_locks.eos_wait);
atomic_set(&prtd->eos, 0);
}
@ -1176,11 +1176,16 @@ static int msm_compr_ioctl(struct snd_pcm_substream *substream,
q6asm_cmd_nowait(prtd->audio_client, CMD_EOS);
/* Wait indefinitely for DRAIN. Flush can also signal this*/
rc = wait_event_interruptible(the_locks.eos_wait,
prtd->cmd_ack);
(prtd->cmd_ack || prtd->cmd_interrupt));
if (rc < 0)
pr_err("EOS cmd interrupted\n");
pr_debug("%s: SNDRV_COMPRESS_DRAIN out of wait\n", __func__);
return 0;
if (prtd->cmd_interrupt)
rc = -EINTR;
prtd->cmd_interrupt = 0;
return rc;
default:
break;
}

View file

@ -81,6 +81,7 @@ struct msm_audio {
int periods;
int mmap_flag;
atomic_t pending_buffer;
int cmd_interrupt;
};
struct output_meta_data_st {