diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2014-09-05 15:02:36 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-09-08 19:32:36 -0400 |
commit | ae14a7954f5124208e6e93cafb3099f83acd43f5 (patch) | |
tree | 6dcba5a0186a067bf650d10f2dd9f7d96e3e828c /drivers/tty/serial/8250 | |
parent | 9d329c1c68d2cc625bb4b8191f37297db6061448 (diff) |
tty: serial: 8250_core: provide a function to export uart_8250_port
There is no way to access a struct uart_8250_port for a specific
line. This is only required outside of the 8250/uart callbacks like for
devices' suspend & remove callbacks. For those the 8250-core provides a
wrapper like serial8250_unregister_port() which passes the struct
to the proper function based on the line argument.
For run time suspend I need access to this struct not only to make
serial_out() work but also to properly restore up->ier and up->mcr.
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/8250')
-rw-r--r-- | drivers/tty/serial/8250/8250.h | 2 | ||||
-rw-r--r-- | drivers/tty/serial/8250/8250_core.c | 18 |
2 files changed, 20 insertions, 0 deletions
diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h index 1b08c918cd51..85bfec58d77c 100644 --- a/drivers/tty/serial/8250/8250.h +++ b/drivers/tty/serial/8250/8250.h | |||
@@ -112,6 +112,8 @@ static inline void serial_dl_write(struct uart_8250_port *up, int value) | |||
112 | up->dl_write(up, value); | 112 | up->dl_write(up, value); |
113 | } | 113 | } |
114 | 114 | ||
115 | struct uart_8250_port *serial8250_get_port(int line); | ||
116 | |||
115 | #if defined(__alpha__) && !defined(CONFIG_PCI) | 117 | #if defined(__alpha__) && !defined(CONFIG_PCI) |
116 | /* | 118 | /* |
117 | * Digital did something really horribly wrong with the OUT1 and OUT2 | 119 | * Digital did something really horribly wrong with the OUT1 and OUT2 |
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index b597e730b9e7..90e0d5e2b7ee 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c | |||
@@ -2916,6 +2916,24 @@ static struct uart_ops serial8250_pops = { | |||
2916 | 2916 | ||
2917 | static struct uart_8250_port serial8250_ports[UART_NR]; | 2917 | static struct uart_8250_port serial8250_ports[UART_NR]; |
2918 | 2918 | ||
2919 | /** | ||
2920 | * serial8250_get_port - retrieve struct uart_8250_port | ||
2921 | * @line: serial line number | ||
2922 | * | ||
2923 | * This function retrieves struct uart_8250_port for the specific line. | ||
2924 | * This struct *must* *not* be used to perform a 8250 or serial core operation | ||
2925 | * which is not accessible otherwise. Its only purpose is to make the struct | ||
2926 | * accessible to the runtime-pm callbacks for context suspend/restore. | ||
2927 | * The lock assumption made here is none because runtime-pm suspend/resume | ||
2928 | * callbacks should not be invoked if there is any operation performed on the | ||
2929 | * port. | ||
2930 | */ | ||
2931 | struct uart_8250_port *serial8250_get_port(int line) | ||
2932 | { | ||
2933 | return &serial8250_ports[line]; | ||
2934 | } | ||
2935 | EXPORT_SYMBOL_GPL(serial8250_get_port); | ||
2936 | |||
2919 | static void (*serial8250_isa_config)(int port, struct uart_port *up, | 2937 | static void (*serial8250_isa_config)(int port, struct uart_port *up, |
2920 | unsigned short *capabilities); | 2938 | unsigned short *capabilities); |
2921 | 2939 | ||