diff options
| author | Ramprasad Katkam <katkam@codeaurora.org> | 2017-05-17 13:21:57 +0530 |
|---|---|---|
| committer | Ramprasad Katkam <katkam@codeaurora.org> | 2017-05-18 21:59:39 +0530 |
| commit | 8f0c7ae73c205b9a1cfc685cbee9cb4ba437a554 (patch) | |
| tree | c53926bb27a1eb8b6c2ecfebd10a4f0eca709b8b | |
| parent | 3d82d66409abb91539bcb9d1f343fcb9d583f2b4 (diff) | |
ASoC: APR: Fix missing APR deregister from asm
APR deregister is to be called for two ports from both
q6asm_callback(during RESET) and q6asm_audio_client_free.
In race condition between the two, APR deregister is called
only for one port. The mismatch in apr register-deregister
count causes apr not to reset service after ssr, causing
APR communication failure.
Change-Id: Ibd0528215bf2fb986eda03ae0d683b2af31358fe
Signed-off-by: Ramprasad Katkam <katkam@codeaurora.org>
| -rw-r--r-- | drivers/soc/qcom/qdsp6v2/apr.c | 3 | ||||
| -rw-r--r-- | sound/soc/msm/qdsp6v2/q6asm.c | 14 |
2 files changed, 8 insertions, 9 deletions
diff --git a/drivers/soc/qcom/qdsp6v2/apr.c b/drivers/soc/qcom/qdsp6v2/apr.c index a275537d4e08..2da8731c5753 100644 --- a/drivers/soc/qcom/qdsp6v2/apr.c +++ b/drivers/soc/qcom/qdsp6v2/apr.c @@ -745,13 +745,14 @@ int apr_deregister(void *handle) if (!handle) return -EINVAL; + mutex_lock(&svc->m_lock); if (!svc->svc_cnt) { pr_err("%s: svc already deregistered. svc = %pK\n", __func__, svc); + mutex_unlock(&svc->m_lock); return -EINVAL; } - mutex_lock(&svc->m_lock); dest_id = svc->dest_id; client_id = svc->client_id; clnt = &client[dest_id][client_id]; diff --git a/sound/soc/msm/qdsp6v2/q6asm.c b/sound/soc/msm/qdsp6v2/q6asm.c index 0cf386a3c2fc..b11b7fe91ec2 100644 --- a/sound/soc/msm/qdsp6v2/q6asm.c +++ b/sound/soc/msm/qdsp6v2/q6asm.c @@ -1031,14 +1031,12 @@ void q6asm_audio_client_free(struct audio_client *ac) } rtac_set_asm_handle(ac->session, NULL); - if (!atomic_read(&ac->reset)) { - apr_deregister(ac->apr2); - apr_deregister(ac->apr); - q6asm_mmap_apr_dereg(); - ac->apr2 = NULL; - ac->apr = NULL; - ac->mmap_apr = NULL; - } + apr_deregister(ac->apr2); + apr_deregister(ac->apr); + q6asm_mmap_apr_dereg(); + ac->apr2 = NULL; + ac->apr = NULL; + ac->mmap_apr = NULL; q6asm_session_free(ac); pr_debug("%s: APR De-Register\n", __func__); |
