diff options
author | Ed Blake <ed.blake@imgtec.com> | 2016-11-10 13:07:55 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-11-16 04:59:38 -0500 |
commit | db405a8f8bf70daf57ed88808a2bf9c5fe308c70 (patch) | |
tree | 5cbc937fe6794752d0e2f4a4de119275c04cf41d | |
parent | 98838d95075a5295f3478ceba18bcccf472e30f4 (diff) |
serial: 8250: Expose set_ldisc function
Expose set_ldisc() function so that it can be overridden with a
platform specific implementation.
Signed-off-by: Ed Blake <ed.blake@imgtec.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/tty/serial/8250/8250_core.c | 3 | ||||
-rw-r--r-- | drivers/tty/serial/8250/8250_port.c | 12 | ||||
-rw-r--r-- | include/linux/serial_8250.h | 4 | ||||
-rw-r--r-- | include/linux/serial_core.h | 2 |
4 files changed, 19 insertions, 2 deletions
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index 13d04bf9547d..61569a765d9e 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c | |||
@@ -830,6 +830,7 @@ static int serial8250_probe(struct platform_device *dev) | |||
830 | uart.port.handle_irq = p->handle_irq; | 830 | uart.port.handle_irq = p->handle_irq; |
831 | uart.port.handle_break = p->handle_break; | 831 | uart.port.handle_break = p->handle_break; |
832 | uart.port.set_termios = p->set_termios; | 832 | uart.port.set_termios = p->set_termios; |
833 | uart.port.set_ldisc = p->set_ldisc; | ||
833 | uart.port.get_mctrl = p->get_mctrl; | 834 | uart.port.get_mctrl = p->get_mctrl; |
834 | uart.port.pm = p->pm; | 835 | uart.port.pm = p->pm; |
835 | uart.port.dev = &dev->dev; | 836 | uart.port.dev = &dev->dev; |
@@ -1023,6 +1024,8 @@ int serial8250_register_8250_port(struct uart_8250_port *up) | |||
1023 | /* Possibly override set_termios call */ | 1024 | /* Possibly override set_termios call */ |
1024 | if (up->port.set_termios) | 1025 | if (up->port.set_termios) |
1025 | uart->port.set_termios = up->port.set_termios; | 1026 | uart->port.set_termios = up->port.set_termios; |
1027 | if (up->port.set_ldisc) | ||
1028 | uart->port.set_ldisc = up->port.set_ldisc; | ||
1026 | if (up->port.get_mctrl) | 1029 | if (up->port.get_mctrl) |
1027 | uart->port.get_mctrl = up->port.get_mctrl; | 1030 | uart->port.get_mctrl = up->port.get_mctrl; |
1028 | if (up->port.set_mctrl) | 1031 | if (up->port.set_mctrl) |
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index 4a326034c51b..fe4399b41df6 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c | |||
@@ -2693,8 +2693,7 @@ serial8250_set_termios(struct uart_port *port, struct ktermios *termios, | |||
2693 | serial8250_do_set_termios(port, termios, old); | 2693 | serial8250_do_set_termios(port, termios, old); |
2694 | } | 2694 | } |
2695 | 2695 | ||
2696 | static void | 2696 | void serial8250_do_set_ldisc(struct uart_port *port, struct ktermios *termios) |
2697 | serial8250_set_ldisc(struct uart_port *port, struct ktermios *termios) | ||
2698 | { | 2697 | { |
2699 | if (termios->c_line == N_PPS) { | 2698 | if (termios->c_line == N_PPS) { |
2700 | port->flags |= UPF_HARDPPS_CD; | 2699 | port->flags |= UPF_HARDPPS_CD; |
@@ -2710,7 +2709,16 @@ serial8250_set_ldisc(struct uart_port *port, struct ktermios *termios) | |||
2710 | } | 2709 | } |
2711 | } | 2710 | } |
2712 | } | 2711 | } |
2712 | EXPORT_SYMBOL_GPL(serial8250_do_set_ldisc); | ||
2713 | 2713 | ||
2714 | static void | ||
2715 | serial8250_set_ldisc(struct uart_port *port, struct ktermios *termios) | ||
2716 | { | ||
2717 | if (port->set_ldisc) | ||
2718 | port->set_ldisc(port, termios); | ||
2719 | else | ||
2720 | serial8250_do_set_ldisc(port, termios); | ||
2721 | } | ||
2714 | 2722 | ||
2715 | void serial8250_do_pm(struct uart_port *port, unsigned int state, | 2723 | void serial8250_do_pm(struct uart_port *port, unsigned int state, |
2716 | unsigned int oldstate) | 2724 | unsigned int oldstate) |
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h index 04185e03d7be..61fbb440449c 100644 --- a/include/linux/serial_8250.h +++ b/include/linux/serial_8250.h | |||
@@ -36,6 +36,8 @@ struct plat_serial8250_port { | |||
36 | void (*set_termios)(struct uart_port *, | 36 | void (*set_termios)(struct uart_port *, |
37 | struct ktermios *new, | 37 | struct ktermios *new, |
38 | struct ktermios *old); | 38 | struct ktermios *old); |
39 | void (*set_ldisc)(struct uart_port *, | ||
40 | struct ktermios *); | ||
39 | unsigned int (*get_mctrl)(struct uart_port *); | 41 | unsigned int (*get_mctrl)(struct uart_port *); |
40 | int (*handle_irq)(struct uart_port *); | 42 | int (*handle_irq)(struct uart_port *); |
41 | void (*pm)(struct uart_port *, unsigned int state, | 43 | void (*pm)(struct uart_port *, unsigned int state, |
@@ -149,6 +151,8 @@ extern int early_serial8250_setup(struct earlycon_device *device, | |||
149 | const char *options); | 151 | const char *options); |
150 | extern void serial8250_do_set_termios(struct uart_port *port, | 152 | extern void serial8250_do_set_termios(struct uart_port *port, |
151 | struct ktermios *termios, struct ktermios *old); | 153 | struct ktermios *termios, struct ktermios *old); |
154 | extern void serial8250_do_set_ldisc(struct uart_port *port, | ||
155 | struct ktermios *termios); | ||
152 | extern unsigned int serial8250_do_get_mctrl(struct uart_port *port); | 156 | extern unsigned int serial8250_do_get_mctrl(struct uart_port *port); |
153 | extern int serial8250_do_startup(struct uart_port *port); | 157 | extern int serial8250_do_startup(struct uart_port *port); |
154 | extern void serial8250_do_shutdown(struct uart_port *port); | 158 | extern void serial8250_do_shutdown(struct uart_port *port); |
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 344201437017..5d494888a612 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
@@ -123,6 +123,8 @@ struct uart_port { | |||
123 | void (*set_termios)(struct uart_port *, | 123 | void (*set_termios)(struct uart_port *, |
124 | struct ktermios *new, | 124 | struct ktermios *new, |
125 | struct ktermios *old); | 125 | struct ktermios *old); |
126 | void (*set_ldisc)(struct uart_port *, | ||
127 | struct ktermios *); | ||
126 | unsigned int (*get_mctrl)(struct uart_port *); | 128 | unsigned int (*get_mctrl)(struct uart_port *); |
127 | void (*set_mctrl)(struct uart_port *, unsigned int); | 129 | void (*set_mctrl)(struct uart_port *, unsigned int); |
128 | int (*startup)(struct uart_port *port); | 130 | int (*startup)(struct uart_port *port); |