hujun260 commented on code in PR #15426: URL: https://github.com/apache/nuttx/pull/15426#discussion_r1908534638
########## arch/arm/src/am335x/am335x_serial.c: ########## @@ -630,7 +642,7 @@ static inline void am335x_uart3config(void) /* Step 1: Enable power to UART3 */ - flags = enter_critical_section(); + flags = spin_lock_irqsave(&g_gpio_lock); Review Comment: flags = spin_lock_irqsave(&g_gpio_lock); ########## arch/arm64/src/imx9/imx9_lpspi.c: ########## @@ -2017,11 +2033,15 @@ struct spi_dev_s *imx9_lpspibus_initialize(int bus) else #endif { - leave_critical_section(flags); + spin_unlock_irqrestore(&g_lpspi_lock, flags_1); spierr("ERROR: Unsupported SPI bus: %d\n", bus); return NULL; } + /* Protecting critical resources. */ + + flags_2 = spin_lock_irqsave(&priv->spinlock); Review Comment: remove spinlock initialize function will call only once ########## arch/arm64/src/imx9/imx9_lpspi.c: ########## @@ -1797,8 +1809,12 @@ static inline void spi_dmatxstart(struct imx9_lpspidev_s *priv) struct spi_dev_s *imx9_lpspibus_initialize(int bus) { struct imx9_lpspidev_s *priv = NULL; + irqstate_t flags_1; + irqstate_t flags_2; + + /* Implementing atomic operations. */ - irqstate_t flags = enter_critical_section(); + flags_1 = spin_lock_irqsave(&g_lpspi_lock); Review Comment: remove spinlock initialize function will call only once -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org