From 0300b34cf0926eb6bd62bcdc63afdffb654e6a00 Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Wed, 31 Aug 2022 12:13:41 +0200 Subject: [PATCH] drivers: serial: stm32 UART driver do not start Rx timer if null This commit is optimizing the uart isr execution to avoid starting the Rx timeout if it is null. In anycase the async_timer_start function is checking the tiemout value. This will just save some execution lines. Signed-off-by: Francois Ramu --- drivers/serial/uart_stm32.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/serial/uart_stm32.c b/drivers/serial/uart_stm32.c index 228e916921b..f2b258acfb9 100644 --- a/drivers/serial/uart_stm32.c +++ b/drivers/serial/uart_stm32.c @@ -1024,12 +1024,12 @@ static void uart_stm32_isr(const struct device *dev) LOG_DBG("idle interrupt occurred"); - /* Start the RX timer */ - async_timer_start(&data->dma_rx.timeout_work, - data->dma_rx.timeout); - if (data->dma_rx.timeout == 0) { uart_stm32_dma_rx_flush(dev); + } else { + /* Start the RX timer not null */ + async_timer_start(&data->dma_rx.timeout_work, + data->dma_rx.timeout); } } else if (LL_USART_IsEnabledIT_TC(config->usart) && LL_USART_IsActiveFlag_TC(config->usart)) {