From 86305190f307c05bc2e0660f4ce16b7aeca6711b Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Thu, 21 May 2026 14:16:50 -0400 Subject: serial: uniformize serial port I/O infos display Uniformize serial port I/O infos display from three different functions that display mostly the same information, but with some variations, by adding a common function. This make use of new functions uart_iotype_mmio() and uart_iotype_legacy_io() to simplify and improve code readability. This will prevent displaying irrelevant information for future IO types (ex: UPIO_BUS), while also addressing the (eventually) invalid check for "iotype >= UPIO_MEM". This also allows us to remove the confusing cast to (unsigned long long) for iobase which is defined as an unsigned long, and use %pa to display the mapbase pointer, as it is done in earlycon_print_info(). Replace snprintf with more robust scnprintf so we could perhaps one day get rid of snprintf() entirely. Signed-off-by: Hugo Villeneuve Link: https://patch.msgid.link/20260521-tty-upio-v3-4-bf74567994a0@dimonoff.com Signed-off-by: Greg Kroah-Hartman --- include/linux/serial_core.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/linux') diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 3cfde1af12fe..66b1459d53fc 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -1339,6 +1339,7 @@ static inline int uart_handle_break(struct uart_port *port) int uart_get_rs485_mode(struct uart_port *port); +void uart_get_ioinfos(struct uart_port *port, char *buf, size_t size); bool uart_iotype_mmio(enum uart_iotype iotype); bool uart_iotype_io(enum uart_iotype iotype); -- cgit v1.2.3