Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion drivers/serial/leuart_gecko.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ static int leuart_gecko_init(const struct device *dev)
return 0;
}

static const struct uart_driver_api leuart_gecko_driver_api = {
static DEVICE_API(uart, leuart_gecko_driver_api) = {
.poll_in = leuart_gecko_poll_in,
.poll_out = leuart_gecko_poll_out,
.err_check = leuart_gecko_err_check,
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/serial_esp32_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ static void serial_esp32_usb_isr(void *arg)

#endif /* CONFIG_UART_INTERRUPT_DRIVEN */

static const DRAM_ATTR struct uart_driver_api serial_esp32_usb_api = {
static DEVICE_API(uart, serial_esp32_usb_api) = {
.poll_in = serial_esp32_usb_poll_in,
.poll_out = serial_esp32_usb_poll_out,
.err_check = serial_esp32_usb_err_check,
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/serial_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ static int serial_vnd_rx_enable(const struct device *dev, uint8_t *read_buf, siz
}
#endif /* CONFIG_UART_ASYNC_API */

static const struct uart_driver_api serial_vnd_api = {
static DEVICE_API(uart, serial_vnd_api) = {
.poll_in = serial_vnd_poll_in,
.poll_out = serial_vnd_poll_out,
.err_check = serial_vnd_err_check,
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_altera.c
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ static int uart_altera_drv_cmd(const struct device *dev, uint32_t cmd,

#endif /* CONFIG_UART_INTERRUPT_DRIVEN */

static const struct uart_driver_api uart_altera_driver_api = {
static DEVICE_API(uart, uart_altera_driver_api) = {
.poll_in = uart_altera_poll_in,
.poll_out = uart_altera_poll_out,
.err_check = uart_altera_err_check,
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_altera_jtag.c
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ static void uart_altera_jtag_isr(const struct device *dev)

#endif /* CONFIG_UART_INTERRUPT_DRIVEN && !CONFIG_UART_ALTERA_JTAG_HAL */

static const struct uart_driver_api uart_altera_jtag_driver_api = {
static DEVICE_API(uart, uart_altera_jtag_driver_api) = {
#ifndef CONFIG_UART_ALTERA_JTAG_HAL
.poll_in = uart_altera_jtag_poll_in,
#endif /* CONFIG_UART_ALTERA_JTAG_HAL */
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_apbuart.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ static int apbuart_init(const struct device *dev)
}

/* Driver API defined in uart.h */
static const struct uart_driver_api apbuart_driver_api = {
static DEVICE_API(uart, apbuart_driver_api) = {
.poll_in = apbuart_poll_in,
.poll_out = apbuart_poll_out,
.err_check = apbuart_err_check,
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_b91.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ static void uart_b91_irq_callback_set(const struct device *dev,

#endif /* CONFIG_UART_INTERRUPT_DRIVEN */

static const struct uart_driver_api uart_b91_driver_api = {
static DEVICE_API(uart, uart_b91_driver_api) = {
.poll_in = uart_b91_poll_in,
.poll_out = uart_b91_poll_out,
.err_check = uart_b91_err_check,
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_bcm2711.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ void uart_isr(const struct device *dev)
}
#endif /* CONFIG_UART_INTERRUPT_DRIVEN */

static const struct uart_driver_api uart_bcm2711_driver_api = {
static DEVICE_API(uart, uart_bcm2711_driver_api) = {
.poll_in = uart_bcm2711_poll_in,
.poll_out = uart_bcm2711_poll_out,

Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ static void uart_bt_irq_callback_set(const struct device *dev,
dev_data->uart.callback.cb_data = cb_data;
}

static const struct uart_driver_api uart_bt_driver_api = {
static DEVICE_API(uart, uart_bt_driver_api) = {
.poll_in = uart_bt_poll_in,
.poll_out = uart_bt_poll_out,
.fifo_fill = uart_bt_fifo_fill,
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_cc13xx_cc26xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ static int uart_cc13xx_cc26xx_pm_action(const struct device *dev,
}
#endif /* CONFIG_PM_DEVICE */

static const struct uart_driver_api uart_cc13xx_cc26xx_driver_api = {
static DEVICE_API(uart, uart_cc13xx_cc26xx_driver_api) = {
.poll_in = uart_cc13xx_cc26xx_poll_in,
.poll_out = uart_cc13xx_cc26xx_poll_out,
.err_check = uart_cc13xx_cc26xx_err_check,
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_cc32xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ static void uart_cc32xx_isr(const struct device *dev)
}
#endif /* CONFIG_UART_INTERRUPT_DRIVEN */

static const struct uart_driver_api uart_cc32xx_driver_api = {
static DEVICE_API(uart, uart_cc32xx_driver_api) = {
.poll_in = uart_cc32xx_poll_in,
.poll_out = uart_cc32xx_poll_out,
.err_check = uart_cc32xx_err_check,
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_cdns.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ void uart_cdns_set_irq_callback(const struct device *dev, uart_irq_callback_user
}
#endif

static const struct uart_driver_api uart_cdns_driver_api = {
static DEVICE_API(uart, uart_cdns_driver_api) = {
.poll_in = uart_cdns_poll_in,
.poll_out = uart_cdns_poll_out,
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
Expand Down
4 changes: 2 additions & 2 deletions drivers/serial/uart_cmsdk_apb.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ struct uart_cmsdk_apb_dev_data {
const struct arm_clock_control_t uart_cc_dss;
};

static const struct uart_driver_api uart_cmsdk_apb_driver_api;
static DEVICE_API(uart, uart_cmsdk_apb_driver_api);
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
static void uart_cmsdk_apb_isr(const struct device *dev);
#endif
Expand Down Expand Up @@ -454,7 +454,7 @@ void uart_cmsdk_apb_isr(const struct device *dev)
#endif /* CONFIG_UART_INTERRUPT_DRIVEN */


static const struct uart_driver_api uart_cmsdk_apb_driver_api = {
static DEVICE_API(uart, uart_cmsdk_apb_driver_api) = {
.poll_in = uart_cmsdk_apb_poll_in,
.poll_out = uart_cmsdk_apb_poll_out,
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_efinix_sapphire.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static int uart_efinix_sapphire_poll_in(const struct device *dev, unsigned char
return -1;
}

static const struct uart_driver_api uart_efinix_sapphire_api = {
static DEVICE_API(uart, uart_efinix_sapphire_api) = {
.poll_in = uart_efinix_sapphire_poll_in,
.poll_out = uart_efinix_sapphire_poll_out,
.err_check = NULL,
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_emul.c
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ static int uart_emul_rx_disable(const struct device *dev)
}
#endif /* CONFIG_UART_ASYNC_API */

static const struct uart_driver_api uart_emul_api = {
static DEVICE_API(uart, uart_emul_api) = {
.poll_in = uart_emul_poll_in,
.poll_out = uart_emul_poll_out,
#ifdef CONFIG_UART_USE_RUNTIME_CONFIGURE
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_ene_kb1200.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ static void kb1200_uart_poll_out(const struct device *dev, unsigned char c)
#endif /* CONFIG_UART_INTERRUPT_DRIVEN */
}

static const struct uart_driver_api kb1200_uart_api = {
static DEVICE_API(uart, kb1200_uart_api) = {
.poll_in = kb1200_uart_poll_in,
.poll_out = kb1200_uart_poll_out,
.err_check = kb1200_uart_err_check,
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_esp32.c
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,7 @@ static int uart_esp32_init(const struct device *dev)
return 0;
}

static const DRAM_ATTR struct uart_driver_api uart_esp32_api = {
static DEVICE_API(uart, uart_esp32_api) = {
.poll_in = uart_esp32_poll_in,
.poll_out = uart_esp32_poll_out,
.err_check = uart_esp32_err_check,
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_gecko.c
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ static int uart_gecko_pm_action(const struct device *dev, enum pm_device_action
}
#endif

static const struct uart_driver_api uart_gecko_driver_api = {
static DEVICE_API(uart, uart_gecko_driver_api) = {
.poll_in = uart_gecko_poll_in,
.poll_out = uart_gecko_poll_out,
.err_check = uart_gecko_err_check,
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_hostlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ static void uart_hostlink_poll_out(const struct device *dev, unsigned char c)
hl_write_char(1, c);
}

static const struct uart_driver_api uart_hostlink_driver_api = {
static DEVICE_API(uart, uart_hostlink_driver_api) = {
.poll_in = uart_hostlink_poll_in,
.poll_out = uart_hostlink_poll_out,
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_hvc_xen.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ static void xen_hvc_irq_callback_set(const struct device *dev,
}
#endif /* CONFIG_UART_INTERRUPT_DRIVEN */

static const struct uart_driver_api xen_hvc_api = {
static DEVICE_API(uart, xen_hvc_api) = {
.poll_in = xen_hvc_poll_in,
.poll_out = xen_hvc_poll_out,
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_hvc_xen_consoleio.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ static void xen_consoleio_poll_out(const struct device *dev,
(void) HYPERVISOR_console_io(CONSOLEIO_write, sizeof(c), &c);
}

static const struct uart_driver_api xen_consoleio_hvc_api = {
static DEVICE_API(uart, xen_consoleio_hvc_api) = {
.poll_in = xen_consoleio_poll_in,
.poll_out = xen_consoleio_poll_out,
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_ifx_cat1.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ static int ifx_cat1_uart_init(const struct device *dev)
return ret;
}

static const struct uart_driver_api ifx_cat1_uart_driver_api = {
static DEVICE_API(uart, ifx_cat1_uart_driver_api) = {
.poll_in = ifx_cat1_uart_poll_in,
.poll_out = ifx_cat1_uart_poll_out,
.err_check = ifx_cat1_uart_err_check,
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ void uart_imx_isr(const struct device *dev)
}
#endif /* CONFIG_UART_INTERRUPT_DRIVEN */

static const struct uart_driver_api uart_imx_driver_api = {
static DEVICE_API(uart, uart_imx_driver_api) = {
.poll_in = uart_imx_poll_in,
.poll_out = uart_imx_poll_out,

Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_intel_lw.c
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ static int uart_intel_lw_drv_cmd(const struct device *dev, uint32_t cmd,

#endif /* CONFIG_UART_INTERRUPT_DRIVEN */

static const struct uart_driver_api uart_intel_lw_driver_api = {
static DEVICE_API(uart, uart_intel_lw_driver_api) = {
.poll_in = uart_intel_lw_poll_in,
.poll_out = uart_intel_lw_poll_out,
.err_check = uart_intel_lw_err_check,
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_litex.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ static void uart_litex_tx_soft_isr(struct k_timer *timer)
}
#endif /* CONFIG_UART_INTERRUPT_DRIVEN */

static const struct uart_driver_api uart_litex_driver_api = {
static DEVICE_API(uart, uart_litex_driver_api) = {
.poll_in = uart_litex_poll_in,
.poll_out = uart_litex_poll_out,
.err_check = NULL,
Expand Down
4 changes: 2 additions & 2 deletions drivers/serial/uart_lpc11u6x.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ static const struct lpc11u6x_uart0_config uart0_config = {
#endif /* CONFIG_UART_INTERRUPT_DRIVEN */
};

static const struct uart_driver_api uart0_api = {
static DEVICE_API(uart, uart0_api) = {
.poll_in = lpc11u6x_uart0_poll_in,
.poll_out = lpc11u6x_uart0_poll_out,
.err_check = lpc11u6x_uart0_err_check,
Expand Down Expand Up @@ -827,7 +827,7 @@ static int lpc11u6x_uartx_init(const struct device *dev)
return 0;
}

static const struct uart_driver_api uartx_api = {
static DEVICE_API(uart, uartx_api) = {
.poll_in = lpc11u6x_uartx_poll_in,
.poll_out = lpc11u6x_uartx_poll_out,
.err_check = lpc11u6x_uartx_err_check,
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_max32.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ static void uart_max32_isr(const struct device *dev)

#endif /* CONFIG_UART_INTERRUPT_DRIVEN */

static const struct uart_driver_api uart_max32_driver_api = {
static DEVICE_API(uart, uart_max32_driver_api) = {
.poll_in = api_poll_in,
.poll_out = api_poll_out,
.err_check = api_err_check,
Expand Down
4 changes: 2 additions & 2 deletions drivers/serial/uart_mchp_xec.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ struct uart_xec_dev_data {
struct k_work_delayable rx_refresh_timeout_work;
#endif

static const struct uart_driver_api uart_xec_driver_api;
static DEVICE_API(uart, uart_xec_driver_api);

#if defined(CONFIG_PM_DEVICE) && defined(CONFIG_UART_CONSOLE_INPUT_EXPIRED)
static void uart_xec_pm_policy_state_lock_get(enum uart_xec_pm_policy_state_flag flag)
Expand Down Expand Up @@ -1001,7 +1001,7 @@ static int uart_xec_line_ctrl_set(const struct device *dev,

#endif /* CONFIG_UART_XEC_LINE_CTRL */

static const struct uart_driver_api uart_xec_driver_api = {
static DEVICE_API(uart, uart_xec_driver_api) = {
.poll_in = uart_xec_poll_in,
.poll_out = uart_xec_poll_out,
.err_check = uart_xec_err_check,
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_mcux.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ static int uart_mcux_pm_action(const struct device *dev, enum pm_device_action a
}
#endif /*CONFIG_PM_DEVICE*/

static const struct uart_driver_api uart_mcux_driver_api = {
static DEVICE_API(uart, uart_mcux_driver_api) = {
.poll_in = uart_mcux_poll_in,
.poll_out = uart_mcux_poll_out,
.err_check = uart_mcux_err_check,
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_mcux_flexcomm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,7 @@ static int mcux_flexcomm_init(const struct device *dev)
return 0;
}

static const struct uart_driver_api mcux_flexcomm_driver_api = {
static DEVICE_API(uart, mcux_flexcomm_driver_api) = {
.poll_in = mcux_flexcomm_poll_in,
.poll_out = mcux_flexcomm_poll_out,
.err_check = mcux_flexcomm_err_check,
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_mcux_iuart.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ static int mcux_iuart_init(const struct device *dev)
return 0;
}

static const struct uart_driver_api mcux_iuart_driver_api = {
static DEVICE_API(uart, mcux_iuart_driver_api) = {
.poll_in = mcux_iuart_poll_in,
.poll_out = mcux_iuart_poll_out,
.err_check = mcux_iuart_err_check,
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_mcux_lpsci.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ static int mcux_lpsci_init(const struct device *dev)
return 0;
}

static const struct uart_driver_api mcux_lpsci_driver_api = {
static DEVICE_API(uart, mcux_lpsci_driver_api) = {
.poll_in = mcux_lpsci_poll_in,
.poll_out = mcux_lpsci_poll_out,
.err_check = mcux_lpsci_err_check,
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_mcux_lpuart.c
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ static int mcux_lpuart_init(const struct device *dev)
return 0;
}

static const struct uart_driver_api mcux_lpuart_driver_api = {
static DEVICE_API(uart, mcux_lpuart_driver_api) = {
.poll_in = mcux_lpuart_poll_in,
.poll_out = mcux_lpuart_poll_out,
.err_check = mcux_lpuart_err_check,
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_miv.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ static int uart_miv_init(const struct device *dev)
return 0;
}

static const struct uart_driver_api uart_miv_driver_api = {
static DEVICE_API(uart, uart_miv_driver_api) = {
.poll_in = uart_miv_poll_in,
.poll_out = uart_miv_poll_out,
.err_check = uart_miv_err_check,
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/uart_msp432p4xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ static void uart_msp432p4xx_isr(const struct device *dev)
}
#endif /* CONFIG_UART_INTERRUPT_DRIVEN */

static const struct uart_driver_api uart_msp432p4xx_driver_api = {
static DEVICE_API(uart, uart_msp432p4xx_driver_api) = {
.poll_in = uart_msp432p4xx_poll_in,
.poll_out = uart_msp432p4xx_poll_out,
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
Expand Down
16 changes: 8 additions & 8 deletions drivers/serial/uart_native_ptty.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,19 @@ struct native_uart_status {

static struct native_uart_status native_uart_status_0;

static struct uart_driver_api np_uart_driver_api_0 = {
static DEVICE_API(uart, np_uart_driver_api_0) = {
.poll_out = np_uart_poll_out,
#if defined(CONFIG_NATIVE_UART_0_ON_OWN_PTY)
.poll_in = np_uart_tty_poll_in,
#else
.poll_in = np_uart_stdin_poll_in,
#endif
};

#if defined(CONFIG_UART_NATIVE_POSIX_PORT_1_ENABLE)
static struct native_uart_status native_uart_status_1;

static struct uart_driver_api np_uart_driver_api_1 = {
static DEVICE_API(uart, np_uart_driver_api_1) = {
.poll_out = np_uart_poll_out,
.poll_in = np_uart_tty_poll_in,
};
Expand Down Expand Up @@ -89,11 +93,9 @@ static int np_uart_0_init(const struct device *dev)

d->in_fd = tty_fn;
d->out_fd = tty_fn;
np_uart_driver_api_0.poll_in = np_uart_tty_poll_in;
} else { /* NATIVE_UART_0_ON_STDINOUT */
d->in_fd = np_uart_ptty_get_stdin_fileno();
d->out_fd = np_uart_ptty_get_stdout_fileno();
np_uart_driver_api_0.poll_in = np_uart_stdin_poll_in;
}

return 0;
Expand Down Expand Up @@ -160,8 +162,7 @@ static void np_uart_poll_out(const struct device *dev,
* @retval 0 If a character arrived and was stored in p_char
* @retval -1 If no character was available to read
*/
static int np_uart_stdin_poll_in(const struct device *dev,
unsigned char *p_char)
static int __maybe_unused np_uart_stdin_poll_in(const struct device *dev, unsigned char *p_char)
{
int in_f = ((struct native_uart_status *)dev->data)->in_fd;
static bool disconnected;
Expand Down Expand Up @@ -189,8 +190,7 @@ static int np_uart_stdin_poll_in(const struct device *dev,
* @retval 0 If a character arrived and was stored in p_char
* @retval -1 If no character was available to read
*/
static int np_uart_tty_poll_in(const struct device *dev,
unsigned char *p_char)
static int __maybe_unused np_uart_tty_poll_in(const struct device *dev, unsigned char *p_char)
{
int n = -1;
int in_f = ((struct native_uart_status *)dev->data)->in_fd;
Expand Down
Loading
Loading