diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2015-02-24 14:25:13 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-03-26 13:18:20 -0400 |
commit | 3b81c26c92414024a8046eb216782f3d599a5d77 (patch) | |
tree | 637c59f576604aea344a76a98a09741e82d40b73 /drivers/tty/serial/8250 | |
parent | cd52b7599c1a1150719b2f6d20bce6b4f30dc8df (diff) |
serial: 8250: Only get RSA resource when required
The probe for Remote Supervisor Adapter is limited to port i/o
addresses which match one of the probe_rsa[] module parameter
addresses. Limit RSA resource acquire to matching i/o ports.
The result is a saner probe policy: only perform optional probes
when specified rather than by default.
NB: It is possible for userspace to set the port type == PORT_RSA
with ioctl(TIOCSSERIAL) and then autoconfig with ioctl(TIOCSERCONFIG),
which if it fails, may leave the port type set to PORT_RSA. Since
this may have previously resulted in a working RSA port, this behavior
is preserved.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/8250')
-rw-r--r-- | drivers/tty/serial/8250/8250_core.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index dcfe5500303f..257e373bfccd 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c | |||
@@ -1228,16 +1228,9 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags) | |||
1228 | /* | 1228 | /* |
1229 | * Only probe for RSA ports if we got the region. | 1229 | * Only probe for RSA ports if we got the region. |
1230 | */ | 1230 | */ |
1231 | if (port->type == PORT_16550A && probeflags & PROBE_RSA) { | 1231 | if (port->type == PORT_16550A && probeflags & PROBE_RSA && |
1232 | int i; | 1232 | __enable_rsa(up)) |
1233 | 1233 | port->type = PORT_RSA; | |
1234 | for (i = 0 ; i < probe_rsa_count; ++i) { | ||
1235 | if (probe_rsa[i] == port->iobase && __enable_rsa(up)) { | ||
1236 | port->type = PORT_RSA; | ||
1237 | break; | ||
1238 | } | ||
1239 | } | ||
1240 | } | ||
1241 | #endif | 1234 | #endif |
1242 | 1235 | ||
1243 | serial_out(up, UART_LCR, save_lcr); | 1236 | serial_out(up, UART_LCR, save_lcr); |
@@ -3008,7 +3001,7 @@ static void register_dev_spec_attr_grp(struct uart_8250_port *up) | |||
3008 | static void serial8250_config_port(struct uart_port *port, int flags) | 3001 | static void serial8250_config_port(struct uart_port *port, int flags) |
3009 | { | 3002 | { |
3010 | struct uart_8250_port *up = up_to_u8250p(port); | 3003 | struct uart_8250_port *up = up_to_u8250p(port); |
3011 | int probeflags = PROBE_ANY; | 3004 | int probeflags = 0; |
3012 | int ret; | 3005 | int ret; |
3013 | 3006 | ||
3014 | if (port->type == PORT_8250_CIR) | 3007 | if (port->type == PORT_8250_CIR) |
@@ -3023,9 +3016,20 @@ static void serial8250_config_port(struct uart_port *port, int flags) | |||
3023 | return; | 3016 | return; |
3024 | 3017 | ||
3025 | #ifdef CONFIG_SERIAL_8250_RSA | 3018 | #ifdef CONFIG_SERIAL_8250_RSA |
3026 | ret = serial8250_request_rsa_resource(up); | 3019 | if (port->type == PORT_RSA) { |
3027 | if (ret < 0) | 3020 | if (serial8250_request_rsa_resource(up) == 0) |
3028 | probeflags &= ~PROBE_RSA; | 3021 | probeflags |= PROBE_RSA; |
3022 | } else if (flags & UART_CONFIG_TYPE) { | ||
3023 | int i; | ||
3024 | |||
3025 | for (i = 0 ; i < probe_rsa_count; ++i) { | ||
3026 | if (probe_rsa[i] == port->iobase) { | ||
3027 | if (serial8250_request_rsa_resource(up) == 0) | ||
3028 | probeflags |= PROBE_RSA; | ||
3029 | break; | ||
3030 | } | ||
3031 | } | ||
3032 | } | ||
3029 | #endif | 3033 | #endif |
3030 | 3034 | ||
3031 | if (port->iotype != up->cur_iotype) | 3035 | if (port->iotype != up->cur_iotype) |