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 <erwan.gouriou@linaro.org>
This commit is contained in:
Erwan Gouriou 2017-12-05 13:46:13 -06:00 committed by Kumar Gala
commit 222bc6096b

View file

@ -197,8 +197,10 @@ static int uart_stm32_irq_is_pending(struct device *dev)
{ {
USART_TypeDef *UartInstance = UART_STRUCT(dev); USART_TypeDef *UartInstance = UART_STRUCT(dev);
return (LL_USART_IsActiveFlag_RXNE(UartInstance) || return ((LL_USART_IsActiveFlag_RXNE(UartInstance) &&
LL_USART_IsActiveFlag_TXE(UartInstance)); LL_USART_IsEnabledIT_RXNE(UartInstance)) ||
(LL_USART_IsActiveFlag_TXE(UartInstance) &&
LL_USART_IsEnabledIT_TXE(UartInstance)));
} }
static int uart_stm32_irq_update(struct device *dev) static int uart_stm32_irq_update(struct device *dev)