litex_serial: use small lock in arch/risc-v/src/litex/litex_serial.c
reason: We hope to remove all instances of spin_lock_irqsave(NULL). Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
parent
7e5088f4ea
commit
3063f2c0e0
1 changed files with 6 additions and 4 deletions
|
@ -124,6 +124,7 @@ struct up_dev_s
|
|||
uintptr_t uartbase; /* Base address of UART registers */
|
||||
uint32_t baud; /* Configured baud */
|
||||
uint8_t irq; /* IRQ associated with this UART */
|
||||
spinlock_t lock; /* Spinlock */
|
||||
uint8_t im; /* Interrupt mask state */
|
||||
};
|
||||
|
||||
|
@ -190,6 +191,7 @@ static struct up_dev_s g_uart0priv =
|
|||
.uartbase = LITEX_UART0_BASE,
|
||||
.baud = CONFIG_UART0_BAUD,
|
||||
.irq = LITEX_IRQ_UART0,
|
||||
.lock = SP_UNLOCKED,
|
||||
};
|
||||
|
||||
static uart_dev_t g_uart0port =
|
||||
|
@ -240,7 +242,7 @@ static void up_serialout(struct up_dev_s *priv, int offset, uint32_t value)
|
|||
|
||||
static void up_restoreuartint(struct up_dev_s *priv, uint8_t im)
|
||||
{
|
||||
irqstate_t flags = spin_lock_irqsave(NULL);
|
||||
irqstate_t flags = spin_lock_irqsave(&priv->lock);
|
||||
|
||||
priv->im = im;
|
||||
|
||||
|
@ -248,7 +250,7 @@ static void up_restoreuartint(struct up_dev_s *priv, uint8_t im)
|
|||
LITEX_CONSOLE_BASE + UART_EV_PENDING_OFFSET);
|
||||
up_serialout(priv, UART_EV_ENABLE_OFFSET, im);
|
||||
|
||||
spin_unlock_irqrestore(NULL, flags);
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -257,7 +259,7 @@ static void up_restoreuartint(struct up_dev_s *priv, uint8_t im)
|
|||
|
||||
static void up_disableuartint(struct up_dev_s *priv, uint8_t *im)
|
||||
{
|
||||
irqstate_t flags = spin_lock_irqsave(NULL);
|
||||
irqstate_t flags = spin_lock_irqsave(&priv->lock);
|
||||
|
||||
/* Return the current interrupt mask value */
|
||||
|
||||
|
@ -274,7 +276,7 @@ static void up_disableuartint(struct up_dev_s *priv, uint8_t *im)
|
|||
LITEX_CONSOLE_BASE + UART_EV_PENDING_OFFSET);
|
||||
up_serialout(priv, UART_EV_ENABLE_OFFSET, 0);
|
||||
|
||||
spin_unlock_irqrestore(NULL, flags);
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
Loading…
Reference in a new issue