Skip to content

Commit 6b879bc

Browse files
Jiri Slaby (SUSE)gregkh
authored andcommitted
serial: 8250_rsa: simplify rsa8250_{request/release}_resource()
* Use already defined 'port' for fetching start/offset, and size. * Return from the switch immediately -- so it is clear what is returned and when. Signed-off-by: Jiri Slaby (SUSE) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent dbd26a8 commit 6b879bc

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

drivers/tty/serial/8250/8250_rsa.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,27 @@ static unsigned int probe_rsa_count;
1616

1717
static int rsa8250_request_resource(struct uart_8250_port *up)
1818
{
19-
unsigned long start = UART_RSA_BASE << up->port.regshift;
20-
unsigned int size = 8 << up->port.regshift;
2119
struct uart_port *port = &up->port;
22-
int ret = -EINVAL;
20+
unsigned long start = UART_RSA_BASE << port->regshift;
21+
unsigned int size = 8 << port->regshift;
2322

2423
switch (port->iotype) {
2524
case UPIO_HUB6:
2625
case UPIO_PORT:
2726
start += port->iobase;
28-
if (request_region(start, size, "serial-rsa"))
29-
ret = 0;
30-
else
31-
ret = -EBUSY;
32-
break;
27+
if (!request_region(start, size, "serial-rsa"))
28+
return -EBUSY;
29+
return 0;
30+
default:
31+
return -EINVAL;
3332
}
34-
35-
return ret;
3633
}
3734

3835
static void rsa8250_release_resource(struct uart_8250_port *up)
3936
{
40-
unsigned long offset = UART_RSA_BASE << up->port.regshift;
41-
unsigned int size = 8 << up->port.regshift;
4237
struct uart_port *port = &up->port;
38+
unsigned long offset = UART_RSA_BASE << port->regshift;
39+
unsigned int size = 8 << port->regshift;
4340

4441
switch (port->iotype) {
4542
case UPIO_HUB6:

0 commit comments

Comments
 (0)