diff options
-rw-r--r-- | drivers/tty/serial/serial_core.c | 17 | ||||
-rw-r--r-- | include/linux/serial_core.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 78036c510ccc..0fcfd98a9566 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c | |||
@@ -2129,6 +2129,7 @@ static int uart_poll_init(struct tty_driver *driver, int line, char *options) | |||
2129 | int bits = 8; | 2129 | int bits = 8; |
2130 | int parity = 'n'; | 2130 | int parity = 'n'; |
2131 | int flow = 'n'; | 2131 | int flow = 'n'; |
2132 | int ret; | ||
2132 | 2133 | ||
2133 | if (!state || !state->uart_port) | 2134 | if (!state || !state->uart_port) |
2134 | return -1; | 2135 | return -1; |
@@ -2137,6 +2138,22 @@ static int uart_poll_init(struct tty_driver *driver, int line, char *options) | |||
2137 | if (!(port->ops->poll_get_char && port->ops->poll_put_char)) | 2138 | if (!(port->ops->poll_get_char && port->ops->poll_put_char)) |
2138 | return -1; | 2139 | return -1; |
2139 | 2140 | ||
2141 | if (port->ops->poll_init) { | ||
2142 | struct tty_port *tport = &state->port; | ||
2143 | |||
2144 | ret = 0; | ||
2145 | mutex_lock(&tport->mutex); | ||
2146 | /* | ||
2147 | * We don't set ASYNCB_INITIALIZED as we only initialized the | ||
2148 | * hw, e.g. state->xmit is still uninitialized. | ||
2149 | */ | ||
2150 | if (!test_bit(ASYNCB_INITIALIZED, &tport->flags)) | ||
2151 | ret = port->ops->poll_init(port); | ||
2152 | mutex_unlock(&tport->mutex); | ||
2153 | if (ret) | ||
2154 | return ret; | ||
2155 | } | ||
2156 | |||
2140 | if (options) { | 2157 | if (options) { |
2141 | uart_parse_options(options, &baud, &parity, &bits, &flow); | 2158 | uart_parse_options(options, &baud, &parity, &bits, &flow); |
2142 | return uart_set_options(port, NULL, baud, parity, bits, flow); | 2159 | return uart_set_options(port, NULL, baud, parity, bits, flow); |
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index bb010030828a..f9b22ec7a9f3 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
@@ -275,6 +275,7 @@ struct uart_ops { | |||
275 | int (*verify_port)(struct uart_port *, struct serial_struct *); | 275 | int (*verify_port)(struct uart_port *, struct serial_struct *); |
276 | int (*ioctl)(struct uart_port *, unsigned int, unsigned long); | 276 | int (*ioctl)(struct uart_port *, unsigned int, unsigned long); |
277 | #ifdef CONFIG_CONSOLE_POLL | 277 | #ifdef CONFIG_CONSOLE_POLL |
278 | int (*poll_init)(struct uart_port *); | ||
278 | void (*poll_put_char)(struct uart_port *, unsigned char); | 279 | void (*poll_put_char)(struct uart_port *, unsigned char); |
279 | int (*poll_get_char)(struct uart_port *); | 280 | int (*poll_get_char)(struct uart_port *); |
280 | #endif | 281 | #endif |