From bec9058b4cb368e33361a14f317b015d03e0a451 Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Wed, 8 Dec 2021 08:14:30 +0900 Subject: [PATCH] arch: lc823450: Replace the critical section with spinlock in lc823450_serial.c Summary: - This commit replaces the critical section with spinlock - The logic is the same as cxd56_serial.c Impact: - None Testing: - Tested with lc823450-xgevk:bt Signed-off-by: Masayuki Ishikawa --- arch/arm/src/lc823450/lc823450_serial.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/arm/src/lc823450/lc823450_serial.c b/arch/arm/src/lc823450/lc823450_serial.c index 21689df999a..93b5a5bb977 100644 --- a/arch/arm/src/lc823450/lc823450_serial.c +++ b/arch/arm/src/lc823450/lc823450_serial.c @@ -40,6 +40,7 @@ #include #include #include +#include #include @@ -172,6 +173,7 @@ struct up_dev_s sem_t rxpkt_wait; sem_t txdma_wait; #endif /* CONFIG_HSUART */ + spinlock_t lock; }; /**************************************************************************** @@ -944,7 +946,7 @@ static void up_txint(struct uart_dev_s *dev, bool enable) struct up_dev_s *priv = (struct up_dev_s *)dev->priv; irqstate_t flags; - flags = enter_critical_section(); + flags = spin_lock_irqsave(&priv->lock); if (enable) { /* Set to receive an interrupt when the TX fifo is half emptied */ @@ -963,7 +965,9 @@ static void up_txint(struct uart_dev_s *dev, bool enable) * the TX interrupt. */ + spin_unlock_irqrestore(&priv->lock, flags); uart_xmitchars(dev); + flags = spin_lock_irqsave(&priv->lock); #endif } else @@ -974,7 +978,7 @@ static void up_txint(struct uart_dev_s *dev, bool enable) up_serialout(priv, UART_UIEN, priv->im); } - leave_critical_section(flags); + spin_unlock_irqrestore(&priv->lock, flags); } /****************************************************************************