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/nuttx.git
commit ace5dde1a92112d758c1e1a89613439b93e3a092 Author: hujun5 <[email protected]> AuthorDate: Mon May 6 18:34:53 2024 +0800 arm/imx6: we use spin_lock_irqsave replace enter_critical_section to protect gpio init ,because enter_critical_section may be called before os initialized Signed-off-by: hujun5 <[email protected]> --- arch/arm/src/imx6/imx_gpio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm/src/imx6/imx_gpio.c b/arch/arm/src/imx6/imx_gpio.c index 133d13a4c7..6a77d6b0af 100644 --- a/arch/arm/src/imx6/imx_gpio.c +++ b/arch/arm/src/imx6/imx_gpio.c @@ -29,6 +29,7 @@ #include <errno.h> #include <nuttx/irq.h> +#include <nuttx/spinlock.h> #include "chip.h" #include "arm_internal.h" @@ -512,7 +513,7 @@ int imx_config_gpio(gpio_pinset_t pinset) /* Configure the pin as an input initially to avoid any spurious outputs */ - flags = enter_critical_section(); + flags = spin_lock_irqsave(NULL); /* Configure based upon the pin mode */ @@ -555,7 +556,7 @@ int imx_config_gpio(gpio_pinset_t pinset) break; } - leave_critical_section(flags); + spin_unlock_irqrestore(NULL, flags); return ret; }
