aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2010-06-01 16:52:53 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-10 16:47:41 -0400
commitd87d9b7d19f04b16c4406d3c0feeca10090e0ada (patch)
treec6eadc964d4fdfe9e421a2d4d4143748f4668a6b
parenteab4f5af6b07009d1fc48bac5f3215c0cbfb2fc3 (diff)
tty: serial - fix tty referencing in set_ldisc
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>
-rw-r--r--drivers/serial/bfin_5xx.c7
-rw-r--r--drivers/serial/serial_core.c2
-rw-r--r--include/linux/serial_core.h2
3 files changed, 4 insertions, 7 deletions
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c
index 511cbf68787..a9eff2b18ea 100644
--- a/drivers/serial/bfin_5xx.c
+++ b/drivers/serial/bfin_5xx.c
@@ -957,15 +957,12 @@ bfin_serial_verify_port(struct uart_port *port, struct serial_struct *ser)
957 * Enable the IrDA function if tty->ldisc.num is N_IRDA. 957 * Enable the IrDA function if tty->ldisc.num is N_IRDA.
958 * In other cases, disable IrDA function. 958 * In other cases, disable IrDA function.
959 */ 959 */
960static void bfin_serial_set_ldisc(struct uart_port *port) 960static void bfin_serial_set_ldisc(struct uart_port *port, int ld)
961{ 961{
962 int line = port->line; 962 int line = port->line;
963 unsigned short val; 963 unsigned short val;
964 964
965 if (line >= port->state->port.tty->driver->num) 965 switch (ld) {
966 return;
967
968 switch (port->state->port.tty->termios->c_line) {
969 case N_IRDA: 966 case N_IRDA:
970 val = UART_GET_GCTL(&bfin_serial_ports[line]); 967 val = UART_GET_GCTL(&bfin_serial_ports[line]);
971 val |= (IREN | RPOLC); 968 val |= (IREN | RPOLC);
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 12ee7e0f99c..570dca2935e 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -1194,7 +1194,7 @@ static void uart_set_ldisc(struct tty_struct *tty)
1194 struct uart_port *uport = state->uart_port; 1194 struct uart_port *uport = state->uart_port;
1195 1195
1196 if (uport->ops->set_ldisc) 1196 if (uport->ops->set_ldisc)
1197 uport->ops->set_ldisc(uport); 1197 uport->ops->set_ldisc(uport, tty->termios->c_line);
1198} 1198}
1199 1199
1200static void uart_set_termios(struct tty_struct *tty, 1200static void uart_set_termios(struct tty_struct *tty,
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index f10db6e5f3b..32928161fab 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -220,7 +220,7 @@ struct uart_ops {
220 void (*flush_buffer)(struct uart_port *); 220 void (*flush_buffer)(struct uart_port *);
221 void (*set_termios)(struct uart_port *, struct ktermios *new, 221 void (*set_termios)(struct uart_port *, struct ktermios *new,
222 struct ktermios *old); 222 struct ktermios *old);
223 void (*set_ldisc)(struct uart_port *); 223 void (*set_ldisc)(struct uart_port *, int new);
224 void (*pm)(struct uart_port *, unsigned int state, 224 void (*pm)(struct uart_port *, unsigned int state,
225 unsigned int oldstate); 225 unsigned int oldstate);
226 int (*set_wake)(struct uart_port *, unsigned int state); 226 int (*set_wake)(struct uart_port *, unsigned int state);