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/nuttx.git

commit db908d58aa08b33e955ef56ce6affc2d92a7d97e
Author: Bowen Wang <[email protected]>
AuthorDate: Fri Oct 31 16:25:43 2025 +0800

    drivers/rptun: change the rptun lock to nxrmutex
    
    g_rptun_lock is held across rptun_ioctl_foreach(), whose ioctls may
    block on a semaphore. It must stay a sleeping lock once metal_mutex
    becomes a spinlock, so make it a plain rmutex_t.
    
    Signed-off-by: Bowen Wang <[email protected]>
---
 drivers/rptun/rptun.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/rptun/rptun.c b/drivers/rptun/rptun.c
index 5ed0a5077e0..dae052a7f4f 100644
--- a/drivers/rptun/rptun.c
+++ b/drivers/rptun/rptun.c
@@ -185,7 +185,7 @@ static const struct virtio_memory_ops g_rptun_mmops =
 };
 
 static struct metal_list g_rptun_priv = METAL_INIT_LIST(g_rptun_priv);
-static metal_mutex_t g_rptun_lock = METAL_MUTEX_INIT(g_rptun_lock);
+static rmutex_t g_rptun_lock = NXRMUTEX_INITIALIZER;
 
 /****************************************************************************
  * Private Functions
@@ -1183,7 +1183,7 @@ static int rptun_ioctl_foreach(FAR const char *cpuname, 
int cmd,
 
   if (!up_interrupt_context())
     {
-      metal_mutex_acquire(&g_rptun_lock);
+      nxrmutex_lock(&g_rptun_lock);
     }
 
   metal_list_for_each(&g_rptun_priv, node)
@@ -1204,7 +1204,7 @@ static int rptun_ioctl_foreach(FAR const char *cpuname, 
int cmd,
 
   if (!up_interrupt_context())
     {
-      metal_mutex_release(&g_rptun_lock);
+      nxrmutex_unlock(&g_rptun_lock);
     }
 
   return ret;
@@ -1392,9 +1392,9 @@ int rptun_initialize(FAR struct rptun_dev_s *dev)
               priv->nbpanic.notifier_call = rptun_panic_notifier;
               panic_notifier_chain_register(&priv->nbpanic);
 
-              metal_mutex_acquire(&g_rptun_lock);
+              nxrmutex_lock(&g_rptun_lock);
               metal_list_add_tail(&g_rptun_priv, &priv->node);
-              metal_mutex_release(&g_rptun_lock);
+              nxrmutex_unlock(&g_rptun_lock);
             }
         }
       else

Reply via email to