Commit d87d9b7d authored by Alan Cox's avatar Alan Cox Committed by Greg Kroah-Hartman

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: default avatarAlan Cox <alan@linux.intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent eab4f5af
...@@ -957,15 +957,12 @@ bfin_serial_verify_port(struct uart_port *port, struct serial_struct *ser) ...@@ -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. * Enable the IrDA function if tty->ldisc.num is N_IRDA.
* In other cases, disable IrDA function. * 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; int line = port->line;
unsigned short val; unsigned short val;
if (line >= port->state->port.tty->driver->num) switch (ld) {
return;
switch (port->state->port.tty->termios->c_line) {
case N_IRDA: case N_IRDA:
val = UART_GET_GCTL(&bfin_serial_ports[line]); val = UART_GET_GCTL(&bfin_serial_ports[line]);
val |= (IREN | RPOLC); val |= (IREN | RPOLC);
......
...@@ -1194,7 +1194,7 @@ static void uart_set_ldisc(struct tty_struct *tty) ...@@ -1194,7 +1194,7 @@ static void uart_set_ldisc(struct tty_struct *tty)
struct uart_port *uport = state->uart_port; struct uart_port *uport = state->uart_port;
if (uport->ops->set_ldisc) 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, static void uart_set_termios(struct tty_struct *tty,
......
...@@ -220,7 +220,7 @@ struct uart_ops { ...@@ -220,7 +220,7 @@ struct uart_ops {
void (*flush_buffer)(struct uart_port *); void (*flush_buffer)(struct uart_port *);
void (*set_termios)(struct uart_port *, struct ktermios *new, void (*set_termios)(struct uart_port *, struct ktermios *new,
struct ktermios *old); 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, void (*pm)(struct uart_port *, unsigned int state,
unsigned int oldstate); unsigned int oldstate);
int (*set_wake)(struct uart_port *, unsigned int state); int (*set_wake)(struct uart_port *, unsigned int state);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment