From 5604a98e2f95d6221852960a3363588f40d78e22 Mon Sep 17 00:00:00 2001 From: Peter Hurley Date: Sat, 9 Apr 2016 17:53:21 -0700 Subject: 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 Signed-off-by: Greg Kroah-Hartman --- drivers/tty/amiserial.c | 6 ++---- drivers/tty/cyclades.c | 10 ++++------ drivers/tty/isicom.c | 6 ++---- drivers/tty/mxser.c | 4 +--- drivers/tty/synclink.c | 7 ++----- drivers/tty/synclink_gt.c | 5 +---- drivers/tty/synclinkmp.c | 5 +---- 7 files changed, 13 insertions(+), 30 deletions(-) (limited to 'drivers/tty') diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c index e68208eac322..92717b088959 100644 --- a/drivers/tty/amiserial.c +++ b/drivers/tty/amiserial.c @@ -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 { diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c index d67e542bab1c..1a12776ba24c 100644 --- a/drivers/tty/cyclades.c +++ b/drivers/tty/cyclades.c @@ -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; diff --git a/drivers/tty/isicom.c b/drivers/tty/isicom.c index 8bf67630018b..c5f06b54b9ca 100644 --- a/drivers/tty/isicom.c +++ b/drivers/tty/isicom.c @@ -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)) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index f23c2a101688..8f3fdad37ac7 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -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) { diff --git a/drivers/tty/synclink.c b/drivers/tty/synclink.c index 3768e5c71c0b..0e4290183280 100644 --- a/drivers/tty/synclink.c +++ b/drivers/tty/synclink.c @@ -1966,11 +1966,8 @@ 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; else diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c index ceeaeb703f51..5da69d30f816 100644 --- a/drivers/tty/synclink_gt.c +++ b/drivers/tty/synclink_gt.c @@ -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; diff --git a/drivers/tty/synclinkmp.c b/drivers/tty/synclinkmp.c index b0cce4b24e51..7a21491d0c0d 100644 --- a/drivers/tty/synclinkmp.c +++ b/drivers/tty/synclinkmp.c @@ -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; -- cgit v1.2.3