From bb1e81eb95f296ee75507091a8f6efebc055849a Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Thu, 14 Apr 2022 05:15:55 +0800 Subject: [PATCH] driver/mmcsdio: do not hold the semaphore in idle thread too Signed-off-by: Xiang Xiao --- 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 c2c7f30fd92..c41877a80fc 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