mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 14:33:24 -04:00
serial: 8250_rsa: 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, as well as avoid some variables init if the iotype is not valid. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Link: https://patch.msgid.link/20260521-tty-upio-v3-6-bf74567994a0@dimonoff.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
548aa0c850
commit
650d60c734
@@ -19,35 +19,33 @@ static const struct uart_ops *core_port_base_ops;
|
||||
static int rsa8250_request_resource(struct uart_8250_port *up)
|
||||
{
|
||||
struct uart_port *port = &up->port;
|
||||
unsigned long start = UART_RSA_BASE << port->regshift;
|
||||
unsigned int size = 8 << port->regshift;
|
||||
unsigned long start;
|
||||
unsigned int size;
|
||||
|
||||
switch (port->iotype) {
|
||||
case UPIO_HUB6:
|
||||
case UPIO_PORT:
|
||||
start += port->iobase;
|
||||
if (!request_region(start, size, "serial-rsa"))
|
||||
return -EBUSY;
|
||||
return 0;
|
||||
default:
|
||||
if (!uart_iotype_io(port->iotype))
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
start = UART_RSA_BASE << port->regshift;
|
||||
start += port->iobase;
|
||||
size = 8 << port->regshift;
|
||||
|
||||
if (!request_region(start, size, "serial-rsa"))
|
||||
return -EBUSY;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void rsa8250_release_resource(struct uart_8250_port *up)
|
||||
{
|
||||
struct uart_port *port = &up->port;
|
||||
unsigned long offset = UART_RSA_BASE << port->regshift;
|
||||
unsigned int size = 8 << port->regshift;
|
||||
unsigned long offset;
|
||||
unsigned int size;
|
||||
|
||||
switch (port->iotype) {
|
||||
case UPIO_HUB6:
|
||||
case UPIO_PORT:
|
||||
release_region(port->iobase + offset, size);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (!uart_iotype_io(port->iotype))
|
||||
return;
|
||||
|
||||
offset = UART_RSA_BASE << port->regshift;
|
||||
size = 8 << port->regshift;
|
||||
release_region(port->iobase + offset, size);
|
||||
}
|
||||
|
||||
static void univ8250_config_port(struct uart_port *port, int flags)
|
||||
|
||||
Reference in New Issue
Block a user