serial: core: add uart_iotype_mmio/io helper functions

To help simplify code that check on the io type mode of the port.

Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
Link: https://patch.msgid.link/20260521-tty-upio-v3-2-bf74567994a0@dimonoff.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Hugo Villeneuve
2026-05-21 14:16:48 -04:00
committed by Greg Kroah-Hartman
parent 3d406299d8
commit 6e85378a38
2 changed files with 32 additions and 0 deletions

View File

@@ -1963,6 +1963,34 @@ static const char *uart_type(struct uart_port *port)
return str;
}
bool uart_iotype_mmio(enum uart_iotype iotype)
{
switch (iotype) {
case UPIO_MEM:
case UPIO_MEM32:
case UPIO_AU:
case UPIO_TSI:
case UPIO_MEM32BE:
case UPIO_MEM16:
return true;
default:
return false;
}
}
EXPORT_SYMBOL_GPL(uart_iotype_mmio);
bool uart_iotype_io(enum uart_iotype iotype)
{
switch (iotype) {
case UPIO_PORT:
case UPIO_HUB6:
return true;
default:
return false;
}
}
EXPORT_SYMBOL_GPL(uart_iotype_io);
#ifdef CONFIG_PROC_FS
static void uart_line_info(struct seq_file *m, struct uart_state *state)

View File

@@ -1338,4 +1338,8 @@ static inline int uart_handle_break(struct uart_port *port)
!((cflag) & CLOCAL))
int uart_get_rs485_mode(struct uart_port *port);
bool uart_iotype_mmio(enum uart_iotype iotype);
bool uart_iotype_io(enum uart_iotype iotype);
#endif /* LINUX_SERIAL_CORE_H */