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/10/16 07:01:47 UTC

[incubator-nuttx] 14/16: esp32_wifi_adapter.c: Use the specified spin lock when enabling/disabling interrupts.

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

commit 0dff3f2762acf24e9cba57617d14d7e4d71883c0
Author: Abdelatif Guettouche <ab...@espressif.com>
AuthorDate: Fri Sep 10 00:09:34 2021 +0200

    esp32_wifi_adapter.c: Use the specified spin lock when
    enabling/disabling interrupts.
    
    Signed-off-by: Abdelatif Guettouche <ab...@espressif.com>
---
 arch/xtensa/src/esp32/esp32_wifi_adapter.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/xtensa/src/esp32/esp32_wifi_adapter.c b/arch/xtensa/src/esp32/esp32_wifi_adapter.c
index f8797e5..fc71661 100644
--- a/arch/xtensa/src/esp32/esp32_wifi_adapter.c
+++ b/arch/xtensa/src/esp32/esp32_wifi_adapter.c
@@ -975,11 +975,7 @@ static uint32_t IRAM_ATTR esp_wifi_int_disable(void *wifi_int_mux)
 {
   irqstate_t flags;
 
-  flags = enter_critical_section();
-
-  /* In SMP mode enter_critical_section already hold the global IRQ spinlock.
-   * We don't need another spinlock, so wifi_int_mux is unused here.
-   */
+  flags = spin_lock_irqsave((spinlock_t *)wifi_int_mux);
 
   return (uint32_t)flags;
 }
@@ -1004,7 +1000,7 @@ static void IRAM_ATTR esp_wifi_int_restore(void *wifi_int_mux, uint32_t tmp)
 {
   irqstate_t flags = (irqstate_t)tmp;
 
-  leave_critical_section(flags);
+  spin_unlock_irqrestore((spinlock_t *)wifi_int_mux, flags);
 }
 
 /****************************************************************************