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 <hujun5@xiaomi.com>
This commit is contained in:
hujun5 2024-05-06 18:34:53 +08:00 committed by Xiang Xiao
parent 2ee8aa6f2b
commit ace5dde1a9
1 changed files with 3 additions and 2 deletions

View File

@ -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;
}