diff options
| author | Hugo Villeneuve <hvilleneuve@dimonoff.com> | 2026-05-21 14:16:51 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-07-10 14:50:12 +0200 |
| commit | 548aa0c850081dc923ed057a1ae3ec80cbbba618 (patch) | |
| tree | ba70b54d75566a4368bef9fb5c6ba300ab4fe6cf /drivers | |
| parent | 86305190f307c05bc2e0660f4ce16b7aeca6711b (diff) | |
| download | linux-next-548aa0c850081dc923ed057a1ae3ec80cbbba618.tar.gz linux-next-548aa0c850081dc923ed057a1ae3ec80cbbba618.zip | |
serial: 8250: use uart_iotype_*() to simplify code
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@dimonoff.com>
Link: https://patch.msgid.link/20260521-tty-upio-v3-5-bf74567994a0@dimonoff.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/tty/serial/8250/8250_port.c | 43 |
1 files changed, 7 insertions, 36 deletions
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index 630deb7dd344..dd63aedb8675 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -474,16 +474,10 @@ static void set_io_from_upio(struct uart_port *p) static void serial_port_out_sync(struct uart_port *p, int offset, int value) { - switch (p->iotype) { - case UPIO_MEM: - case UPIO_MEM16: - case UPIO_MEM32: - case UPIO_MEM32BE: - case UPIO_AU: + if (uart_iotype_mmio(p->iotype)) { p->serial_out(p, offset, value); p->serial_in(p, UART_LCR); /* safe, no side-effects */ - break; - default: + } else { p->serial_out(p, offset, value); } } @@ -2885,13 +2879,7 @@ static int serial8250_request_std_resource(struct uart_8250_port *up) unsigned int size = serial8250_port_size(up); struct uart_port *port = &up->port; - switch (port->iotype) { - case UPIO_AU: - case UPIO_TSI: - case UPIO_MEM32: - case UPIO_MEM32BE: - case UPIO_MEM16: - case UPIO_MEM: + if (uart_iotype_mmio(port->iotype)) { if (!port->mapbase) return -EINVAL; @@ -2905,14 +2893,9 @@ static int serial8250_request_std_resource(struct uart_8250_port *up) return -ENOMEM; } } - return 0; - case UPIO_HUB6: - case UPIO_PORT: + } else if (uart_iotype_io(port->iotype)) { if (!request_region(port->iobase, size, "serial")) return -EBUSY; - return 0; - case UPIO_UNKNOWN: - break; } return 0; @@ -2923,15 +2906,9 @@ static void serial8250_release_std_resource(struct uart_8250_port *up) unsigned int size = serial8250_port_size(up); struct uart_port *port = &up->port; - switch (port->iotype) { - case UPIO_AU: - case UPIO_TSI: - case UPIO_MEM32: - case UPIO_MEM32BE: - case UPIO_MEM16: - case UPIO_MEM: + if (uart_iotype_mmio(port->iotype)) { if (!port->mapbase) - break; + return; if (port->flags & UPF_IOREMAP) { iounmap(port->membase); @@ -2939,14 +2916,8 @@ static void serial8250_release_std_resource(struct uart_8250_port *up) } release_mem_region(port->mapbase, size); - break; - - case UPIO_HUB6: - case UPIO_PORT: + } else if (uart_iotype_io(port->iotype)) { release_region(port->iobase, size); - break; - case UPIO_UNKNOWN: - break; } } |
