mirror of
https://github.com/apache/nuttx.git
synced 2026-03-26 18:23:50 +08:00
use small lock in following files
arch/xtensa/src/esp32s3/esp32s3_rtc_lowerhalf.c arch/z16/src/z16f/z16f_serial.c arch/z80/src/z8/z8_serial.c boards/arm/max326xx/max32660-evsys/src/max326_button.c boards/arm/stm32/stm32f4discovery/src/stm32_gs2200m.c drivers/i2c/i2c_bitbang.c drivers/power/supply/act8945a.c drivers/serial/uart_pci_16550.c drivers/serial/uart_pl011.c drivers/wireless/bluetooth/bt_uart_shim.c Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
@@ -59,6 +59,7 @@ struct hciuart_state_s
|
||||
|
||||
struct file f; /* File structure */
|
||||
struct pollfd p; /* Poll structure */
|
||||
spinlock_t lock; /* Spinlock */
|
||||
};
|
||||
|
||||
struct hciuart_config_s
|
||||
@@ -120,7 +121,7 @@ hciuart_rxattach(FAR const struct btuart_lowerhalf_s *lower,
|
||||
|
||||
/* If the callback is NULL, then we are detaching */
|
||||
|
||||
flags = spin_lock_irqsave(NULL);
|
||||
flags = spin_lock_irqsave(&state->lock);
|
||||
if (callback == NULL)
|
||||
{
|
||||
/* Disable Rx callbacks and detach the Rx callback */
|
||||
@@ -137,7 +138,7 @@ hciuart_rxattach(FAR const struct btuart_lowerhalf_s *lower,
|
||||
state->callback = callback;
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(NULL, flags);
|
||||
spin_unlock_irqrestore(&state->lock, flags);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -373,6 +374,7 @@ FAR struct btuart_lowerhalf_s *btuart_shim_getdevice(FAR const char *path)
|
||||
s->p.events = POLLIN;
|
||||
s->p.arg = n;
|
||||
s->p.cb = hciuart_rxpollcb;
|
||||
spin_lock_init(&s->lock);
|
||||
|
||||
/* Hook the routines in */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user