You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/04/14 14:12:16 UTC

[incubator-nuttx] 02/02: driver/mmcsdio: do not hold the semaphore in idle thread too

This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit bb1e81eb95f296ee75507091a8f6efebc055849a
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Thu Apr 14 05:15:55 2022 +0800

    driver/mmcsdio: do not hold the semaphore in idle thread too
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 drivers/mmcsd/mmcsd_sdio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmcsd/mmcsd_sdio.c b/drivers/mmcsd/mmcsd_sdio.c
index c2c7f30fd9..c41877a80f 100644
--- a/drivers/mmcsd/mmcsd_sdio.c
+++ b/drivers/mmcsd/mmcsd_sdio.c
@@ -256,7 +256,7 @@ static int mmcsd_takesem(FAR struct mmcsd_state_s *priv)
    * waiting)
    */
 
-  if (up_interrupt_context() == false)
+  if (!up_interrupt_context() && !sched_idletask())
     {
       ret = nxsem_wait_uninterruptible(&priv->sem);
       if (ret < 0)
@@ -282,7 +282,7 @@ static int mmcsd_takesem(FAR struct mmcsd_state_s *priv)
 
 static void mmcsd_givesem(FAR struct mmcsd_state_s *priv)
 {
-  if (up_interrupt_context() == false)
+  if (!up_interrupt_context() && !sched_idletask())
     {
       /* Release the SDIO bus lock, then the MMC/SD driver semaphore in the
        * opposite order that they were taken to assure that no deadlock