ASoC: msm: Fix wrong wait_event_timeout timeout checks

wait_event_timeout returns zero when there is a timeout.
Change fixes the condition check to handle timeouts.

Change-Id: I01184cce0c98a82bb205023b07dd4dd2d91b42ad
CRs-Fixed: 487821
Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>
Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
This commit is contained in:
Asish Bhattacharya 2013-05-15 08:41:08 +05:30 committed by Artem Borisov
parent 4b7d2993d8
commit ba9db7d517
6 changed files with 16 additions and 16 deletions

View file

@ -1163,7 +1163,7 @@ static int msm_compr_ioctl(struct snd_pcm_substream *substream,
}
rc = wait_event_timeout(the_locks.flush_wait,
prtd->cmd_ack, 5 * HZ);
if (rc < 0)
if (!rc)
pr_err("Flush cmd timeout\n");
prtd->pcm_irq_pos = 0;
}

View file

@ -433,7 +433,7 @@ static int msm_pcm_playback_copy(struct snd_pcm_substream *substream, int a,
__func__, atomic_read(&prtd->out_count));
ret = wait_event_timeout(the_locks.write_wait,
(atomic_read(&prtd->out_count)), 5 * HZ);
if (ret < 0) {
if (!ret) {
pr_err("%s: wait_event_timeout failed\n", __func__);
goto fail;
}
@ -494,7 +494,7 @@ static int msm_pcm_playback_close(struct snd_pcm_substream *substream)
dir = IN;
ret = wait_event_timeout(the_locks.eos_wait,
prtd->cmd_ack, 5 * HZ);
if (ret < 0)
if (!ret)
pr_err("%s: CMD_EOS failed\n", __func__);
q6asm_cmd(prtd->audio_client, CMD_CLOSE);
q6asm_audio_client_buf_free_contiguous(dir,
@ -532,7 +532,7 @@ static int msm_pcm_capture_copy(struct snd_pcm_substream *substream,
ret = wait_event_timeout(the_locks.read_wait,
(atomic_read(&prtd->in_count)), 5 * HZ);
if (ret < 0) {
if (!ret) {
pr_debug("%s: wait_event_timeout failed\n", __func__);
goto fail;
}

View file

@ -512,7 +512,7 @@ static int msm_pcm_playback_copy(struct snd_pcm_substream *substream, int a,
__func__, atomic_read(&prtd->out_count));
ret = wait_event_timeout(the_locks.write_wait,
(atomic_read(&prtd->out_count)), 5 * HZ);
if (ret < 0) {
if (!ret) {
pr_err("%s: wait_event_timeout failed\n", __func__);
goto fail;
}
@ -565,7 +565,7 @@ static int msm_pcm_playback_close(struct snd_pcm_substream *substream)
dir = IN;
ret = wait_event_timeout(the_locks.eos_wait,
prtd->cmd_ack, 5 * HZ);
if (ret < 0)
if (!ret)
pr_err("%s: CMD_EOS failed\n", __func__);
q6asm_cmd(prtd->audio_client, CMD_CLOSE);
q6asm_audio_client_buf_free_contiguous(dir,
@ -604,7 +604,7 @@ static int msm_pcm_capture_copy(struct snd_pcm_substream *substream,
ret = wait_event_timeout(the_locks.read_wait,
(atomic_read(&prtd->in_count)), 5 * HZ);
if (ret < 0) {
if (!ret) {
pr_debug("%s: wait_event_timeout failed\n", __func__);
goto fail;
}

View file

@ -427,7 +427,7 @@ static int msm_pcm_playback_close(struct snd_pcm_substream *substream)
pr_debug("%s\n", __func__);
rc = wait_event_timeout(the_locks.eos_wait,
prtd->cmd_ack, 5 * HZ);
if (rc < 0)
if (!rc)
pr_err("EOS cmd timeout\n");
prtd->pcm_irq_pos = 0;
}
@ -586,7 +586,7 @@ static int msm_pcm_ioctl(struct snd_pcm_substream *substream,
pr_err("%s: flush cmd failed rc=%d\n", __func__, rc);
rc = wait_event_timeout(the_locks.eos_wait,
prtd->cmd_ack, 5 * HZ);
if (rc < 0)
if (!rc)
pr_err("Flush cmd timeout\n");
prtd->pcm_irq_pos = 0;
break;

View file

@ -434,7 +434,7 @@ static int msm_pcm_playback_copy(struct snd_pcm_substream *substream, int a,
__func__, atomic_read(&prtd->out_count));
ret = wait_event_timeout(the_locks.write_wait,
(atomic_read(&prtd->out_count)), 5 * HZ);
if (ret < 0) {
if (!ret) {
pr_err("%s: wait_event_timeout failed\n", __func__);
goto fail;
}
@ -487,7 +487,7 @@ static int msm_pcm_playback_close(struct snd_pcm_substream *substream)
dir = IN;
ret = wait_event_timeout(the_locks.eos_wait,
prtd->cmd_ack, 5 * HZ);
if (ret < 0)
if (!ret)
pr_err("%s: CMD_EOS failed\n", __func__);
q6asm_cmd(prtd->audio_client, CMD_CLOSE);
q6asm_audio_client_buf_free_contiguous(dir,
@ -525,7 +525,7 @@ static int msm_pcm_capture_copy(struct snd_pcm_substream *substream,
ret = wait_event_timeout(the_locks.read_wait,
(atomic_read(&prtd->in_count)), 5 * HZ);
if (ret < 0) {
if (!ret) {
pr_debug("%s: wait_event_timeout failed\n", __func__);
goto fail;
}

View file

@ -848,7 +848,7 @@ int afe_loopback_cfg(u16 enable, u16 dst_port, u16 src_port, u16 mode)
ret = wait_event_timeout(this_afe.wait,
(atomic_read(&this_afe.state) == 0),
msecs_to_jiffies(TIMEOUT_MS));
if (ret < 0) {
if (!ret) {
pr_err("%s: wait_event timeout\n", __func__);
ret = -EINVAL;
goto fail_cmd;
@ -926,7 +926,7 @@ int afe_loopback_gain(u16 port_id, u16 volume)
ret = wait_event_timeout(this_afe.wait,
(atomic_read(&this_afe.state) == 0),
msecs_to_jiffies(TIMEOUT_MS));
if (ret < 0) {
if (!ret) {
pr_err("%s: wait_event timeout\n", __func__);
ret = -EINVAL;
goto fail_cmd;
@ -987,7 +987,7 @@ int afe_apply_gain(u16 port_id, u16 gain)
ret = wait_event_timeout(this_afe.wait,
(atomic_read(&this_afe.state) == 0),
msecs_to_jiffies(TIMEOUT_MS));
if (ret < 0) {
if (!ret) {
pr_err("%s: wait_event timeout\n", __func__);
ret = -EINVAL;
goto fail_cmd;
@ -1662,7 +1662,7 @@ int afe_sidetone(u16 tx_port_id, u16 rx_port_id, u16 enable, uint16_t gain)
ret = wait_event_timeout(this_afe.wait,
(atomic_read(&this_afe.state) == 0),
msecs_to_jiffies(TIMEOUT_MS));
if (ret < 0) {
if (!ret) {
pr_err("%s: wait_event timeout\n", __func__);
ret = -EINVAL;
goto fail_cmd;