]> git.karo-electronics.de Git - linux-beck.git/commitdiff
serial: 8250: export get_mctrl function
authorWan Ahmad Zainie <wan.ahmad.zainie.wan.mohamad@intel.com>
Wed, 6 Apr 2016 04:06:51 +0000 (12:06 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 30 Apr 2016 16:26:55 +0000 (09:26 -0700)
Exposes get_mctrl() function so that it can be overriden with platform
specific implementation.

Signed-off-by: Wan Ahmad Zainie <wan.ahmad.zainie.wan.mohamad@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.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 2f4f5ee651db63c040255347b56d0ac385e36415..0fbd7c033a251e7d0cb214ed2bbd1ad1f19f0a76 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.get_mctrl     = p->get_mctrl;
                uart.port.pm            = p->pm;
                uart.port.dev           = &dev->dev;
                uart.port.irqflags      |= irqflag;
@@ -1022,6 +1023,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.get_mctrl)
+                       uart->port.get_mctrl = up->port.get_mctrl;
                if (up->port.set_mctrl)
                        uart->port.set_mctrl = up->port.set_mctrl;
                if (up->port.startup)
index 00ad2637b08c082f523e3a28c3e3472b91b82438..a803ddfd5a599fb18b38cdcaeb0ed92964697d77 100644 (file)
@@ -1882,7 +1882,7 @@ static unsigned int serial8250_tx_empty(struct uart_port *port)
        return (lsr & BOTH_EMPTY) == BOTH_EMPTY ? TIOCSER_TEMT : 0;
 }
 
-static unsigned int serial8250_get_mctrl(struct uart_port *port)
+unsigned int serial8250_do_get_mctrl(struct uart_port *port)
 {
        struct uart_8250_port *up = up_to_u8250p(port);
        unsigned int status;
@@ -1903,6 +1903,14 @@ static unsigned int serial8250_get_mctrl(struct uart_port *port)
                ret |= TIOCM_CTS;
        return ret;
 }
+EXPORT_SYMBOL_GPL(serial8250_do_get_mctrl);
+
+static unsigned int serial8250_get_mctrl(struct uart_port *port)
+{
+       if (port->get_mctrl)
+               return port->get_mctrl(port);
+       return serial8250_do_get_mctrl(port);
+}
 
 void serial8250_do_set_mctrl(struct uart_port *port, unsigned int mctrl)
 {
index 4348797597256f06ffbd091209366335ea340664..48ec7651989b093fc015e44b59657c7000e11012 100644 (file)
@@ -36,6 +36,7 @@ struct plat_serial8250_port {
        void            (*set_termios)(struct uart_port *,
                                       struct ktermios *new,
                                       struct ktermios *old);
+       unsigned int    (*get_mctrl)(struct uart_port *);
        int             (*handle_irq)(struct uart_port *);
        void            (*pm)(struct uart_port *, unsigned int state,
                              unsigned old);
@@ -148,6 +149,7 @@ 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 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);
 extern void serial8250_do_pm(struct uart_port *port, unsigned int state,
index fd4ad4dce11acd0437e97fd5756b1fe1fe03489f..a3d7c0d4a03e75016023184a5fea18c91d9d8dbc 100644 (file)
@@ -123,6 +123,7 @@ struct uart_port {
        void                    (*set_termios)(struct uart_port *,
                                               struct ktermios *new,
                                               struct ktermios *old);
+       unsigned int            (*get_mctrl)(struct uart_port *);
        void                    (*set_mctrl)(struct uart_port *, unsigned int);
        int                     (*startup)(struct uart_port *port);
        void                    (*shutdown)(struct uart_port *port);