You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/09/06 06:57:13 UTC

[incubator-nuttx] branch master updated: net: utils: Remove critical section for SMP in net_lock.c

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

xiaoxiang 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 3330543  net: utils: Remove critical section for SMP in net_lock.c
3330543 is described below

commit 3330543fe6328beb18a97babb04766599953fcc9
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Mon Sep 6 14:01:55 2021 +0900

    net: utils: Remove critical section for SMP in net_lock.c
    
    Summary:
    - The critical section was added in Mar 2018 to improve
      stability in SMP mode
    - However, I noticed that this critical section is no longer
      needed
    
    Impact:
    - None
    
    Testing:
    - Tested with spresense:wifi_smp and spresense:rndis_smp
    
    Signed-off-by: Masayuki Ishikawa <Ma...@jp.sony.com>
---
 net/utils/net_lock.c | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/net/utils/net_lock.c b/net/utils/net_lock.c
index 13e2c47..94b3385 100644
--- a/net/utils/net_lock.c
+++ b/net/utils/net_lock.c
@@ -179,9 +179,6 @@ void net_lockinitialize(void)
 
 int net_lock(void)
 {
-#ifdef CONFIG_SMP
-  irqstate_t flags = enter_critical_section();
-#endif
   pid_t me = getpid();
   int ret = OK;
 
@@ -207,9 +204,6 @@ int net_lock(void)
         }
     }
 
-#ifdef CONFIG_SMP
-  leave_critical_section(flags);
-#endif
   return ret;
 }
 
@@ -232,9 +226,6 @@ int net_lock(void)
 
 int net_trylock(void)
 {
-#ifdef CONFIG_SMP
-  irqstate_t flags = enter_critical_section();
-#endif
   pid_t me = getpid();
   int ret = OK;
 
@@ -258,9 +249,6 @@ int net_trylock(void)
         }
     }
 
-#ifdef CONFIG_SMP
-  leave_critical_section(flags);
-#endif
   return ret;
 }
 
@@ -280,9 +268,6 @@ int net_trylock(void)
 
 void net_unlock(void)
 {
-#ifdef CONFIG_SMP
-  irqstate_t flags = enter_critical_section();
-#endif
   DEBUGASSERT(g_holder == getpid() && g_count > 0);
 
   /* If the count would go to zero, then release the semaphore */
@@ -301,10 +286,6 @@ void net_unlock(void)
 
       g_count--;
     }
-
-#ifdef CONFIG_SMP
-  leave_critical_section(flags);
-#endif
 }
 
 /****************************************************************************