uart: ns16550: simplify DEV_DATA_FLOW_CTRL

Use COND_CODE_1() instead of macro trampoline and move it
into struct initializer.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2023-09-18 15:54:41 -07:00 committed by Carles Cufí
commit 566d21804c

View file

@ -1301,11 +1301,6 @@ static const struct uart_driver_api uart_ns16550_driver_api = {
#define DEV_PCIE_DECLARE(n) \
COND_CODE_1(DT_INST_ON_BUS(n, pcie), (DEVICE_PCIE_INST_DECLARE(n)), ())
#define DEV_DATA_FLOW_CTRL0 UART_CFG_FLOW_CTRL_NONE
#define DEV_DATA_FLOW_CTRL1 UART_CFG_FLOW_CTRL_RTS_CTS
#define DEV_DATA_FLOW_CTRL(n) \
_CONCAT(DEV_DATA_FLOW_CTRL, DT_INST_PROP_OR(n, hw_flow_control, 0))
#ifdef CONFIG_UART_NS16550_PARENT_INIT_LEVEL
#define BOOT_LEVEL(n) \
COND_CODE_1(DT_INST_ON_BUS(n, pcie), (POST_KERNEL), (PRE_KERNEL_1))
@ -1348,7 +1343,10 @@ static const struct uart_driver_api uart_ns16550_driver_api = {
.uart_config.parity = UART_CFG_PARITY_NONE, \
.uart_config.stop_bits = UART_CFG_STOP_BITS_1, \
.uart_config.data_bits = UART_CFG_DATA_BITS_8, \
.uart_config.flow_ctrl = DEV_DATA_FLOW_CTRL(n), \
.uart_config.flow_ctrl = \
COND_CODE_1(DT_INST_PROP_OR(n, hw_flow_control, 0), \
(UART_CFG_FLOW_CTRL_RTS_CTS), \
(UART_CFG_FLOW_CTRL_NONE)), \
IF_ENABLED(DT_INST_NODE_HAS_PROP(n, dlf), \
(.dlf = DT_INST_PROP_OR(n, dlf, 0),)) \
}; \