]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
tty: serial - fix tty referencing in set_ldisc
authorAlan Cox <alan@linux.intel.com>
Tue, 1 Jun 2010 20:52:53 +0000 (22:52 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 10 Aug 2010 20:47:41 +0000 (13:47 -0700)
Pass down the ldisc number so that the drivers don't have to peek into the
tty object themselves. This lets us get rid of another case of back referencing
port to tty which we don't want (because of races versus hangup/close).

Signed-off-by: Alan Cox <alan@linux.intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/serial/bfin_5xx.c
drivers/serial/serial_core.c
include/linux/serial_core.h

index 511cbf68787782ce9b782f85ae51a0b5a80df5a6..a9eff2b18eab25ed0fb797f3e0a97be8e2b913c0 100644 (file)
@@ -957,15 +957,12 @@ bfin_serial_verify_port(struct uart_port *port, struct serial_struct *ser)
  * Enable the IrDA function if tty->ldisc.num is N_IRDA.
  * In other cases, disable IrDA function.
  */
-static void bfin_serial_set_ldisc(struct uart_port *port)
+static void bfin_serial_set_ldisc(struct uart_port *port, int ld)
 {
        int line = port->line;
        unsigned short val;
 
-       if (line >= port->state->port.tty->driver->num)
-               return;
-
-       switch (port->state->port.tty->termios->c_line) {
+       switch (ld) {
        case N_IRDA:
                val = UART_GET_GCTL(&bfin_serial_ports[line]);
                val |= (IREN | RPOLC);
index 12ee7e0f99cea40480ccfc5104b2326f4cfaf0bf..570dca2935e2a887c57af9cc293a5285f06091f1 100644 (file)
@@ -1194,7 +1194,7 @@ static void uart_set_ldisc(struct tty_struct *tty)
        struct uart_port *uport = state->uart_port;
 
        if (uport->ops->set_ldisc)
-               uport->ops->set_ldisc(uport);
+               uport->ops->set_ldisc(uport, tty->termios->c_line);
 }
 
 static void uart_set_termios(struct tty_struct *tty,
index f10db6e5f3b59f82cacb7303cd7e856d101acdcf..32928161fab63cde9d070d8d786b0761d2c7811e 100644 (file)
@@ -220,7 +220,7 @@ struct uart_ops {
        void            (*flush_buffer)(struct uart_port *);
        void            (*set_termios)(struct uart_port *, struct ktermios *new,
                                       struct ktermios *old);
-       void            (*set_ldisc)(struct uart_port *);
+       void            (*set_ldisc)(struct uart_port *, int new);
        void            (*pm)(struct uart_port *, unsigned int state,
                              unsigned int oldstate);
        int             (*set_wake)(struct uart_port *, unsigned int state);