dsp: fix prm driver getting woken twice
Ensure that the mutex is not signalled twice. Also update resp_recieved variable to false before the command is sent. This helps ensure that the prm driver does not miss wake up signal issued from prm_callback. Change-Id: Ief9274768ef38095e0cadaf8e1e4b1f0dc5350ad Signed-off-by: Taha Azzaoui <tazzaoui@codeaurora.org>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
c1772c5d23
commit
4bca3d64c1
@@ -66,7 +66,6 @@ static int audio_prm_callback(struct gpr_device *adev, void *data)
|
||||
pr_err("%s: PRM command failed with error %d\n",
|
||||
__func__, payload[1]);
|
||||
atomic_set(&g_prm.state, payload[1]);
|
||||
wake_up(&g_prm.wait);
|
||||
break;
|
||||
default:
|
||||
pr_err("%s: hit default case",__func__);
|
||||
@@ -101,6 +100,7 @@ static int prm_gpr_send_pkt(struct gpr_pkt *pkt, wait_queue_head_t *wait)
|
||||
mutex_unlock(&g_prm.lock);
|
||||
return -ENODEV;
|
||||
}
|
||||
g_prm.resp_received = false;
|
||||
ret = gpr_send_pkt(g_prm.adev, pkt);
|
||||
if (ret < 0) {
|
||||
pr_err("%s: packet not transmitted %d\n", __func__, ret);
|
||||
@@ -109,7 +109,6 @@ static int prm_gpr_send_pkt(struct gpr_pkt *pkt, wait_queue_head_t *wait)
|
||||
}
|
||||
|
||||
if (wait) {
|
||||
g_prm.resp_received = false;
|
||||
ret = wait_event_timeout(g_prm.wait,
|
||||
(g_prm.resp_received),
|
||||
msecs_to_jiffies(2 * TIMEOUT_MS));
|
||||
|
Reference in New Issue
Block a user