Skip to content

Commit 7fe85f8

Browse files
yishai1999kartben
authored andcommitted
drivers: serial: stm32: simplify logic
Simplify the logic for the `uart_stm32_cfg2ll_databits` function regarding `LL_USART_DATAWIDTH_9B` being defined or not. Signed-off-by: Yishai Jaffe <[email protected]>
1 parent 0f22fde commit 7fe85f8

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/serial/uart_stm32.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,13 +411,11 @@ static inline uint32_t uart_stm32_cfg2ll_databits(enum uart_config_data_bits db,
411411
#endif /* LL_USART_DATAWIDTH_9B */
412412
case UART_CFG_DATA_BITS_8:
413413
default:
414-
if (p == UART_CFG_PARITY_NONE) {
415-
return LL_USART_DATAWIDTH_8B;
416414
#ifdef LL_USART_DATAWIDTH_9B
417-
} else {
415+
if (p != UART_CFG_PARITY_NONE) {
418416
return LL_USART_DATAWIDTH_9B;
419-
#endif
420417
}
418+
#endif
421419
return LL_USART_DATAWIDTH_8B;
422420
}
423421
}

0 commit comments

Comments
 (0)