You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by je...@apache.org on 2020/06/16 06:52:48 UTC
[incubator-nuttx] branch master updated: drivers: audio: Fix
cxd56_stop in cxd56.c
This is an automated email from the ASF dual-hosted git repository.
jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new ae92afd drivers: audio: Fix cxd56_stop in cxd56.c
ae92afd is described below
commit ae92afd2500e7d14506326c06112648bfd9309e3
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Tue Jun 16 12:24:40 2020 +0900
drivers: audio: Fix cxd56_stop in cxd56.c
In the previous implementation, cxd56_stop() checked the internal
state before sending AUDIO_MSG_STOP to the message queue. However,
if the worker thread took time to turn on AMP, cxd560_stop() was
not able to send the message and caused a deadlock.
This commit fixes this issue by always sending AUDIO_MSG_STOP
regardless of the internal state.
Signed-off-by: Masayuki Ishikawa <Ma...@jp.sony.com>
---
drivers/audio/cxd56.c | 32 ++++++++++++++------------------
1 file changed, 14 insertions(+), 18 deletions(-)
diff --git a/drivers/audio/cxd56.c b/drivers/audio/cxd56.c
index 6a3da21..866fab9 100644
--- a/drivers/audio/cxd56.c
+++ b/drivers/audio/cxd56.c
@@ -2899,31 +2899,27 @@ static int cxd56_stop(FAR struct audio_lowerhalf_s *lower, FAR void *session)
static int cxd56_stop(FAR struct audio_lowerhalf_s *lower)
#endif
{
+ int ret;
+ FAR void *value;
+ struct audio_msg_s msg;
FAR struct cxd56_dev_s *priv = (FAR struct cxd56_dev_s *)lower;
audinfo("cxd56_stop\n");
- if (priv->state != CXD56_DEV_STATE_STOPPED)
+ msg.msg_id = AUDIO_MSG_STOP;
+ msg.u.data = 0;
+ ret = nxmq_send(priv->mq, (FAR const char *)&msg,
+ sizeof(msg), CONFIG_CXD56_MSG_PRIO);
+ if (ret != OK)
{
- int ret;
- FAR void *value;
- struct audio_msg_s msg;
-
- msg.msg_id = AUDIO_MSG_STOP;
- msg.u.data = 0;
- ret = nxmq_send(priv->mq, (FAR const char *)&msg,
- sizeof(msg), CONFIG_CXD56_MSG_PRIO);
- if (ret != OK)
- {
- auderr("ERROR: nxmq_send stop message failed (%d)\n", ret);
- return ret;
- }
+ auderr("ERROR: nxmq_send stop message failed (%d)\n", ret);
+ return ret;
+ }
- /* Join the worker thread */
+ /* Join the worker thread */
- pthread_join(priv->threadid, &value);
- priv->threadid = 0;
- }
+ pthread_join(priv->threadid, &value);
+ priv->threadid = 0;
return OK;
}