Skip to content

Commit

Permalink
drivers: uart_mcux_flexcomm: Merge conditions for enabling ISR
Browse files Browse the repository at this point in the history
Merges the condition for `UART_INTERRUPT_DRIVEN || UART_ASYNC_API` into
`UART_MCUX_FLEXCOMM_ISR_SUPPORT`.

Signed-off-by: Alp Sayin <[email protected]>
  • Loading branch information
alpsayin committed Jul 3, 2023
1 parent 3d4a329 commit 086cd47
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
7 changes: 7 additions & 0 deletions drivers/serial/Kconfig.mcux_flexcomm
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,10 @@ config UART_MCUX_FLEXCOMM
select PINCTRL
help
Enable the MCUX USART driver.

config UART_MCUX_FLEXCOMM_ISR_SUPPORT
bool
depends on UART_MCUX_FLEXCOMM
default y if UART_INTERRUPT_DRIVEN || UART_ASYNC_API
help
Enable UART interrupt service routine.
14 changes: 7 additions & 7 deletions drivers/serial/uart_mcux_flexcomm.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct mcux_flexcomm_config {
clock_control_subsys_t clock_subsys;
uint32_t baud_rate;
uint8_t parity;
#if defined(CONFIG_UART_INTERRUPT_DRIVEN) || defined(CONFIG_UART_ASYNC_API)
#ifdef CONFIG_UART_MCUX_FLEXCOMM_ISR_SUPPORT
void (*irq_config_func)(const struct device *dev);
#endif
const struct pinctrl_dev_config *pincfg;
Expand Down Expand Up @@ -916,7 +916,7 @@ static int flexcomm_uart_async_init(const struct device *dev)

#endif /* CONFIG_UART_ASYNC_API */

#if defined(CONFIG_UART_INTERRUPT_DRIVEN) || defined(CONFIG_UART_ASYNC_API)
#ifdef CONFIG_UART_MCUX_FLEXCOMM_ISR_SUPPORT
static void mcux_flexcomm_isr(const struct device *dev)
{
struct mcux_flexcomm_data *data = dev->data;
Expand Down Expand Up @@ -985,9 +985,9 @@ static void mcux_flexcomm_isr(const struct device *dev)
}

}
#endif
#endif /* CONFIG_UART_ASYNC_API */
}
#endif
#endif /* CONFIG_UART_MCUX_FLEXCOMM_ISR_SUPPORT */


static int mcux_flexcomm_init(const struct device *dev)
Expand Down Expand Up @@ -1042,7 +1042,7 @@ static int mcux_flexcomm_init(const struct device *dev)

USART_Init(config->base, &usart_config, clock_freq);

#if defined(CONFIG_UART_INTERRUPT_DRIVEN) || defined(CONFIG_UART_ASYNC_API)
#ifdef CONFIG_UART_MCUX_FLEXCOMM_ISR_SUPPORT
config->irq_config_func(dev);
#endif

Expand Down Expand Up @@ -1091,7 +1091,7 @@ static const struct uart_driver_api mcux_flexcomm_driver_api = {
};


#if defined(CONFIG_UART_INTERRUPT_DRIVEN) || defined(CONFIG_UART_ASYNC_API)
#ifdef CONFIG_UART_MCUX_FLEXCOMM_ISR_SUPPORT
#define UART_MCUX_FLEXCOMM_IRQ_CFG_FUNC(n) \
static void mcux_flexcomm_irq_config_func_##n(const struct device *dev) \
{ \
Expand All @@ -1106,7 +1106,7 @@ static const struct uart_driver_api mcux_flexcomm_driver_api = {
#else
#define UART_MCUX_FLEXCOMM_IRQ_CFG_FUNC(n)
#define UART_MCUX_FLEXCOMM_IRQ_CFG_FUNC_INIT(n)
#endif /* defined(CONFIG_UART_INTERRUPT_DRIVEN) || defined(CONFIG_UART_ASYNC_API) */
#endif /* CONFIG_UART_MCUX_FLEXCOMM_ISR_SUPPORT */

#ifdef CONFIG_UART_ASYNC_API
#define UART_MCUX_FLEXCOMM_TX_TIMEOUT_FUNC(n) \
Expand Down

0 comments on commit 086cd47

Please sign in to comment.