Skip to content

Commit 222bc60

Browse files
erwangogalak
authored andcommitted
drivers: serial: stm32: report only unmasked irq
Fix #5298 irq_is_pending function returned TXE/RXNE flag status even if IRQ was masked, which led to enless loop in uart_pipe when no TX was performed. Fix by reporting status only when IRQ is unmasked. Signed-Off-by: Erwan Gouriou <[email protected]>
1 parent 7ef046f commit 222bc60

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/serial/uart_stm32.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,10 @@ static int uart_stm32_irq_is_pending(struct device *dev)
197197
{
198198
USART_TypeDef *UartInstance = UART_STRUCT(dev);
199199

200-
return (LL_USART_IsActiveFlag_RXNE(UartInstance) ||
201-
LL_USART_IsActiveFlag_TXE(UartInstance));
200+
return ((LL_USART_IsActiveFlag_RXNE(UartInstance) &&
201+
LL_USART_IsEnabledIT_RXNE(UartInstance)) ||
202+
(LL_USART_IsActiveFlag_TXE(UartInstance) &&
203+
LL_USART_IsEnabledIT_TXE(UartInstance)));
202204
}
203205

204206
static int uart_stm32_irq_update(struct device *dev)

0 commit comments

Comments
 (0)