[PATCH v2 03/15] serial: core: use uart_iotype_*() to simplify uart_match_port()

From: Hugo Villeneuve

Date: Tue Apr 28 2026 - 14:02:49 EST


From: Hugo Villeneuve <hvilleneuve@xxxxxxxxxxxx>

Make use of new functions uart_iotype_mmio() and uart_iotype_legacy_io()
to simplify and improve code readability.

Signed-off-by: Hugo Villeneuve <hvilleneuve@xxxxxxxxxxxx>
---
drivers/tty/serial/serial_core.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index c177054f9515e1cb5a1e557c0dac096cb1cbd8cf..06a774f93652d65bc8e0f1ed912aa3e5c95e2bfa 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -3222,22 +3222,14 @@ bool uart_match_port(const struct uart_port *port1,
{
if (port1->iotype != port2->iotype)
return false;
-
- switch (port1->iotype) {
- case UPIO_PORT:
+ else if (port1->iotype == UPIO_PORT)
return port1->iobase == port2->iobase;
- case UPIO_HUB6:
+ else if (port1->iotype == UPIO_HUB6)
return hub6_match_port(port1, port2);
- case UPIO_MEM:
- case UPIO_MEM16:
- case UPIO_MEM32:
- case UPIO_MEM32BE:
- case UPIO_AU:
- case UPIO_TSI:
+ else if (uart_iotype_mmio(port1->iotype))
return port1->mapbase == port2->mapbase;
- default:
+ else
return false;
- }
}
EXPORT_SYMBOL(uart_match_port);


--
2.47.3