Commit 732a84a0 authored by Peter Hurley's avatar Peter Hurley Committed by Greg Kroah-Hartman

serial: core: Pass termios to set_ldisc() notifications

UART drivers which enable modem status interrupts when switching
to N_PPS line discipline need to determine if modem status
interrupts should be disabled when switching from N_PPS.
Specifically, the set_ldisc() notification needs to evaluate
UART_ENABLE_MS() which requires termios->c_cflag.

Convert in-tree UART drivers to new interface.
Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent db1b9dfc
...@@ -2609,9 +2609,9 @@ serial8250_set_termios(struct uart_port *port, struct ktermios *termios, ...@@ -2609,9 +2609,9 @@ serial8250_set_termios(struct uart_port *port, struct ktermios *termios,
} }
static void static void
serial8250_set_ldisc(struct uart_port *port, int new) serial8250_set_ldisc(struct uart_port *port, struct ktermios *termios)
{ {
if (new == N_PPS) { if (termios->c_line == N_PPS) {
port->flags |= UPF_HARDPPS_CD; port->flags |= UPF_HARDPPS_CD;
serial8250_enable_ms(port); serial8250_enable_ms(port);
} else } else
......
...@@ -479,9 +479,9 @@ pl010_set_termios(struct uart_port *port, struct ktermios *termios, ...@@ -479,9 +479,9 @@ pl010_set_termios(struct uart_port *port, struct ktermios *termios,
spin_unlock_irqrestore(&uap->port.lock, flags); spin_unlock_irqrestore(&uap->port.lock, flags);
} }
static void pl010_set_ldisc(struct uart_port *port, int new) static void pl010_set_ldisc(struct uart_port *port, struct ktermios *termios)
{ {
if (new == N_PPS) { if (termios->c_line == N_PPS) {
port->flags |= UPF_HARDPPS_CD; port->flags |= UPF_HARDPPS_CD;
pl010_enable_ms(port); pl010_enable_ms(port);
} else } else
......
...@@ -2056,9 +2056,9 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, ...@@ -2056,9 +2056,9 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios,
spin_unlock_irqrestore(&port->lock, flags); spin_unlock_irqrestore(&port->lock, flags);
} }
static void atmel_set_ldisc(struct uart_port *port, int new) static void atmel_set_ldisc(struct uart_port *port, struct ktermios *termios)
{ {
if (new == N_PPS) { if (termios->c_line == N_PPS) {
port->flags |= UPF_HARDPPS_CD; port->flags |= UPF_HARDPPS_CD;
atmel_enable_ms(port); atmel_enable_ms(port);
} else { } else {
......
...@@ -944,12 +944,13 @@ bfin_serial_verify_port(struct uart_port *port, struct serial_struct *ser) ...@@ -944,12 +944,13 @@ 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, int ld) static void bfin_serial_set_ldisc(struct uart_port *port,
struct ktermios *termios)
{ {
struct bfin_serial_port *uart = (struct bfin_serial_port *)port; struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
unsigned int val; unsigned int val;
switch (ld) { switch (termios->c_line) {
case N_IRDA: case N_IRDA:
val = UART_GET_GCTL(uart); val = UART_GET_GCTL(uart);
val |= (UMOD_IRDA | RPOLC); val |= (UMOD_IRDA | RPOLC);
......
...@@ -225,13 +225,14 @@ static void uart_clps711x_break_ctl(struct uart_port *port, int break_state) ...@@ -225,13 +225,14 @@ static void uart_clps711x_break_ctl(struct uart_port *port, int break_state)
writel(ubrlcr, port->membase + UBRLCR_OFFSET); writel(ubrlcr, port->membase + UBRLCR_OFFSET);
} }
static void uart_clps711x_set_ldisc(struct uart_port *port, int ld) static void uart_clps711x_set_ldisc(struct uart_port *port,
struct ktermios *termios)
{ {
if (!port->line) { if (!port->line) {
struct clps711x_port *s = dev_get_drvdata(port->dev); struct clps711x_port *s = dev_get_drvdata(port->dev);
regmap_update_bits(s->syscon, SYSCON_OFFSET, SYSCON1_SIREN, regmap_update_bits(s->syscon, SYSCON_OFFSET, SYSCON1_SIREN,
(ld == N_IRDA) ? SYSCON1_SIREN : 0); (termios->c_line == N_IRDA) ? SYSCON1_SIREN : 0);
} }
} }
......
...@@ -1247,7 +1247,7 @@ static void uart_set_ldisc(struct tty_struct *tty) ...@@ -1247,7 +1247,7 @@ static void uart_set_ldisc(struct tty_struct *tty)
if (uport->ops->set_ldisc) { if (uport->ops->set_ldisc) {
mutex_lock(&state->port.mutex); mutex_lock(&state->port.mutex);
uport->ops->set_ldisc(uport, tty->termios.c_line); uport->ops->set_ldisc(uport, &tty->termios);
mutex_unlock(&state->port.mutex); mutex_unlock(&state->port.mutex);
} }
} }
......
...@@ -63,7 +63,7 @@ struct uart_ops { ...@@ -63,7 +63,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 *, int new); void (*set_ldisc)(struct uart_port *, struct ktermios *);
void (*pm)(struct uart_port *, unsigned int state, void (*pm)(struct uart_port *, unsigned int state,
unsigned int oldstate); unsigned int oldstate);
......
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