tty: Replace ASYNC_CTS_FLOW bit and update atomically
Replace ASYNC_CTS_FLOW bit in the tty_port::flags field with TTY_PORT_CTS_FLOW bit in the tty_port::iflags field. Add tty_port_set_cts_flow() helper to abstract the atomic bit ops. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
e4d38f334a
commit
5604a98e2f
|
@ -1466,10 +1466,7 @@ static void mgslpc_change_params(MGSLPC_INFO *info, struct tty_struct *tty)
|
|||
}
|
||||
info->timeout += HZ/50; /* Add .02 seconds of slop */
|
||||
|
||||
if (cflag & CRTSCTS)
|
||||
info->port.flags |= ASYNC_CTS_FLOW;
|
||||
else
|
||||
info->port.flags &= ~ASYNC_CTS_FLOW;
|
||||
tty_port_set_cts_flow(&info->port, cflag & CRTSCTS);
|
||||
|
||||
if (cflag & CLOCAL)
|
||||
info->port.flags &= ~ASYNC_CHECK_CD;
|
||||
|
|
|
@ -727,11 +727,9 @@ static void change_speed(struct tty_struct *tty, struct serial_state *info,
|
|||
info->IER &= ~UART_IER_MSI;
|
||||
if (port->flags & ASYNC_HARDPPS_CD)
|
||||
info->IER |= UART_IER_MSI;
|
||||
if (cflag & CRTSCTS) {
|
||||
port->flags |= ASYNC_CTS_FLOW;
|
||||
tty_port_set_cts_flow(port, cflag & CRTSCTS);
|
||||
if (cflag & CRTSCTS)
|
||||
info->IER |= UART_IER_MSI;
|
||||
} else
|
||||
port->flags &= ~ASYNC_CTS_FLOW;
|
||||
if (cflag & CLOCAL)
|
||||
port->flags &= ~ASYNC_CHECK_CD;
|
||||
else {
|
||||
|
|
|
@ -2083,13 +2083,11 @@ static void cy_set_line_char(struct cyclades_port *info, struct tty_struct *tty)
|
|||
info->cor1 |= CyPARITY_NONE;
|
||||
|
||||
/* CTS flow control flag */
|
||||
if (cflag & CRTSCTS) {
|
||||
info->port.flags |= ASYNC_CTS_FLOW;
|
||||
tty_port_set_cts_flow(&info->port, cflag & CRTSCTS);
|
||||
if (cflag & CRTSCTS)
|
||||
info->cor2 |= CyCtsAE;
|
||||
} else {
|
||||
info->port.flags &= ~ASYNC_CTS_FLOW;
|
||||
else
|
||||
info->cor2 &= ~CyCtsAE;
|
||||
}
|
||||
if (cflag & CLOCAL)
|
||||
info->port.flags &= ~ASYNC_CHECK_CD;
|
||||
else
|
||||
|
@ -2234,7 +2232,7 @@ static void cy_set_line_char(struct cyclades_port *info, struct tty_struct *tty)
|
|||
}
|
||||
/* As the HW flow control is done in firmware, the driver
|
||||
doesn't need to care about it */
|
||||
info->port.flags &= ~ASYNC_CTS_FLOW;
|
||||
tty_port_set_cts_flow(&info->port, 0);
|
||||
|
||||
/* XON/XOFF/XANY flow control flags */
|
||||
sw_flow = 0;
|
||||
|
|
|
@ -765,11 +765,9 @@ static void isicom_config_port(struct tty_struct *tty)
|
|||
|
||||
/* flow control settings ...*/
|
||||
flow_ctrl = 0;
|
||||
port->port.flags &= ~ASYNC_CTS_FLOW;
|
||||
if (C_CRTSCTS(tty)) {
|
||||
port->port.flags |= ASYNC_CTS_FLOW;
|
||||
tty_port_set_cts_flow(&port->port, C_CRTSCTS(tty));
|
||||
if (C_CRTSCTS(tty))
|
||||
flow_ctrl |= ISICOM_CTSRTS;
|
||||
}
|
||||
if (I_IXON(tty))
|
||||
flow_ctrl |= ISICOM_RESPOND_XONXOFF;
|
||||
if (I_IXOFF(tty))
|
||||
|
|
|
@ -711,8 +711,8 @@ static int mxser_change_speed(struct tty_struct *tty,
|
|||
/* CTS flow control flag and modem status interrupts */
|
||||
info->IER &= ~UART_IER_MSI;
|
||||
info->MCR &= ~UART_MCR_AFE;
|
||||
tty_port_set_cts_flow(&info->port, cflag & CRTSCTS);
|
||||
if (cflag & CRTSCTS) {
|
||||
info->port.flags |= ASYNC_CTS_FLOW;
|
||||
info->IER |= UART_IER_MSI;
|
||||
if ((info->type == PORT_16550A) || (info->board->chip_flag)) {
|
||||
info->MCR |= UART_MCR_AFE;
|
||||
|
@ -744,8 +744,6 @@ static int mxser_change_speed(struct tty_struct *tty,
|
|||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
info->port.flags &= ~ASYNC_CTS_FLOW;
|
||||
}
|
||||
outb(info->MCR, info->ioaddr + UART_MCR);
|
||||
if (cflag & CLOCAL) {
|
||||
|
|
|
@ -1966,10 +1966,7 @@ static void mgsl_change_params(struct mgsl_struct *info)
|
|||
}
|
||||
info->timeout += HZ/50; /* Add .02 seconds of slop */
|
||||
|
||||
if (cflag & CRTSCTS)
|
||||
info->port.flags |= ASYNC_CTS_FLOW;
|
||||
else
|
||||
info->port.flags &= ~ASYNC_CTS_FLOW;
|
||||
tty_port_set_cts_flow(&info->port, cflag & CRTSCTS);
|
||||
|
||||
if (cflag & CLOCAL)
|
||||
info->port.flags &= ~ASYNC_CHECK_CD;
|
||||
|
|
|
@ -2576,10 +2576,7 @@ static void change_params(struct slgt_info *info)
|
|||
}
|
||||
info->timeout += HZ/50; /* Add .02 seconds of slop */
|
||||
|
||||
if (cflag & CRTSCTS)
|
||||
info->port.flags |= ASYNC_CTS_FLOW;
|
||||
else
|
||||
info->port.flags &= ~ASYNC_CTS_FLOW;
|
||||
tty_port_set_cts_flow(&info->port, cflag & CRTSCTS);
|
||||
|
||||
if (cflag & CLOCAL)
|
||||
info->port.flags &= ~ASYNC_CHECK_CD;
|
||||
|
|
|
@ -2813,10 +2813,7 @@ static void change_params(SLMP_INFO *info)
|
|||
}
|
||||
info->timeout += HZ/50; /* Add .02 seconds of slop */
|
||||
|
||||
if (cflag & CRTSCTS)
|
||||
info->port.flags |= ASYNC_CTS_FLOW;
|
||||
else
|
||||
info->port.flags &= ~ASYNC_CTS_FLOW;
|
||||
tty_port_set_cts_flow(&info->port, cflag & CRTSCTS);
|
||||
|
||||
if (cflag & CLOCAL)
|
||||
info->port.flags &= ~ASYNC_CHECK_CD;
|
||||
|
|
|
@ -255,7 +255,6 @@ struct tty_port {
|
|||
#define TTY_PORT_CTS_FLOW 3 /* h/w flow control enabled */
|
||||
#define TTY_PORT_CHECK_CD 4 /* carrier detect enabled */
|
||||
|
||||
|
||||
/*
|
||||
* Where all of the state associated with a tty is kept while the tty
|
||||
* is open. Since the termios state should be kept even if the tty
|
||||
|
@ -561,9 +560,18 @@ static inline struct tty_port *tty_port_get(struct tty_port *port)
|
|||
/* If the cts flow control is enabled, return true. */
|
||||
static inline bool tty_port_cts_enabled(struct tty_port *port)
|
||||
{
|
||||
return port->flags & ASYNC_CTS_FLOW;
|
||||
return test_bit(TTY_PORT_CTS_FLOW, &port->iflags);
|
||||
}
|
||||
|
||||
static inline void tty_port_set_cts_flow(struct tty_port *port, bool val)
|
||||
{
|
||||
if (val)
|
||||
set_bit(TTY_PORT_CTS_FLOW, &port->iflags);
|
||||
else
|
||||
clear_bit(TTY_PORT_CTS_FLOW, &port->iflags);
|
||||
}
|
||||
|
||||
|
||||
extern struct tty_struct *tty_port_tty_get(struct tty_port *port);
|
||||
extern void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty);
|
||||
extern int tty_port_carrier_raised(struct tty_port *port);
|
||||
|
|
|
@ -86,15 +86,14 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self,
|
|||
ircomm_param_request(self, IRCOMM_DATA_RATE, FALSE);
|
||||
|
||||
/* CTS flow control flag and modem status interrupts */
|
||||
tty_port_set_cts_flow(&self->port, cflag & CRTSCTS);
|
||||
if (cflag & CRTSCTS) {
|
||||
self->port.flags |= ASYNC_CTS_FLOW;
|
||||
self->settings.flow_control |= IRCOMM_RTS_CTS_IN;
|
||||
/* This got me. Bummer. Jean II */
|
||||
if (self->service_type == IRCOMM_3_WIRE_RAW)
|
||||
net_warn_ratelimited("%s(), enabling RTS/CTS on link that doesn't support it (3-wire-raw)\n",
|
||||
__func__);
|
||||
} else {
|
||||
self->port.flags &= ~ASYNC_CTS_FLOW;
|
||||
self->settings.flow_control &= ~IRCOMM_RTS_CTS_IN;
|
||||
}
|
||||
if (cflag & CLOCAL)
|
||||
|
|
Loading…
Reference in New Issue