serial: 8250: Expose set_ldisc function
authorEd Blake <ed.blake@imgtec.com>
Thu, 10 Nov 2016 18:07:55 +0000 (18:07 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Nov 2016 09:59:38 +0000 (10:59 +0100)
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>
drivers/tty/serial/8250/8250_core.c
drivers/tty/serial/8250/8250_port.c
include/linux/serial_8250.h
include/linux/serial_core.h

index 13d04bf9547d8592f2340cce0c058be2eeab2342..61569a765d9ee17213052db6f0d3a1c41d4d9293 100644 (file)
@@ -830,6 +830,7 @@ static int serial8250_probe(struct platform_device *dev)
                uart.port.handle_irq    = p->handle_irq;
                uart.port.handle_break  = p->handle_break;
                uart.port.set_termios   = p->set_termios;
+               uart.port.set_ldisc     = p->set_ldisc;
                uart.port.get_mctrl     = p->get_mctrl;
                uart.port.pm            = p->pm;
                uart.port.dev           = &dev->dev;
@@ -1023,6 +1024,8 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
                /*  Possibly override set_termios call */
                if (up->port.set_termios)
                        uart->port.set_termios = up->port.set_termios;
+               if (up->port.set_ldisc)
+                       uart->port.set_ldisc = up->port.set_ldisc;
                if (up->port.get_mctrl)
                        uart->port.get_mctrl = up->port.get_mctrl;
                if (up->port.set_mctrl)
index 4a326034c51b1c750a89f62a9e0247e088a398a4..fe4399b41df6cea4904edcee4749bb67532f7e18 100644 (file)
@@ -2693,8 +2693,7 @@ serial8250_set_termios(struct uart_port *port, struct ktermios *termios,
                serial8250_do_set_termios(port, termios, old);
 }
 
-static void
-serial8250_set_ldisc(struct uart_port *port, struct ktermios *termios)
+void serial8250_do_set_ldisc(struct uart_port *port, struct ktermios *termios)
 {
        if (termios->c_line == N_PPS) {
                port->flags |= UPF_HARDPPS_CD;
@@ -2710,7 +2709,16 @@ serial8250_set_ldisc(struct uart_port *port, struct ktermios *termios)
                }
        }
 }
+EXPORT_SYMBOL_GPL(serial8250_do_set_ldisc);
 
+static void
+serial8250_set_ldisc(struct uart_port *port, struct ktermios *termios)
+{
+       if (port->set_ldisc)
+               port->set_ldisc(port, termios);
+       else
+               serial8250_do_set_ldisc(port, termios);
+}
 
 void serial8250_do_pm(struct uart_port *port, unsigned int state,
                      unsigned int oldstate)
index 04185e03d7bec56197cb7653773200449f11b65c..61fbb440449ca00d9e422966257ebbe5d9cbf434 100644 (file)
@@ -36,6 +36,8 @@ struct plat_serial8250_port {
        void            (*set_termios)(struct uart_port *,
                                       struct ktermios *new,
                                       struct ktermios *old);
+       void            (*set_ldisc)(struct uart_port *,
+                                    struct ktermios *);
        unsigned int    (*get_mctrl)(struct uart_port *);
        int             (*handle_irq)(struct uart_port *);
        void            (*pm)(struct uart_port *, unsigned int state,
@@ -149,6 +151,8 @@ extern int early_serial8250_setup(struct earlycon_device *device,
                                         const char *options);
 extern void serial8250_do_set_termios(struct uart_port *port,
                struct ktermios *termios, struct ktermios *old);
+extern void serial8250_do_set_ldisc(struct uart_port *port,
+                                   struct ktermios *termios);
 extern unsigned int serial8250_do_get_mctrl(struct uart_port *port);
 extern int serial8250_do_startup(struct uart_port *port);
 extern void serial8250_do_shutdown(struct uart_port *port);
index 344201437017e9b293eec185e66680511c2e8a7a..5d494888a612a8a33c4f022bf7a6c77c5e5a24f8 100644 (file)
@@ -123,6 +123,8 @@ struct uart_port {
        void                    (*set_termios)(struct uart_port *,
                                               struct ktermios *new,
                                               struct ktermios *old);
+       void                    (*set_ldisc)(struct uart_port *,
+                                            struct ktermios *);
        unsigned int            (*get_mctrl)(struct uart_port *);
        void                    (*set_mctrl)(struct uart_port *, unsigned int);
        int                     (*startup)(struct uart_port *port);