summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2016-01-10 23:36:15 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-01-28 17:13:44 -0500
commit9db276f8f02145068d8c04614bc28c2a4532a8c7 (patch)
tree981fcf1ce5da9a28fbef9a91ad75a7898bd88e02 /drivers
parent5823323ea5ed41ea08ef0a36013369d0c65a23de (diff)
tty: Use termios c_*flag macros
Expressions of the form "tty->termios.c_*flag & FLAG" are more clearly expressed with the termios flags macros, I_FLAG(), C_FLAG(), O_FLAG(), and L_FLAG(). Convert treewide. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Acked-by: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/pcmcia/synclink_cs.c21
-rw-r--r--drivers/mmc/card/sdio_uart.c14
-rw-r--r--drivers/staging/dgap/dgap.c2
-rw-r--r--drivers/staging/dgnc/dgnc_tty.c2
-rw-r--r--drivers/tty/amiserial.c22
-rw-r--r--drivers/tty/cyclades.c14
-rw-r--r--drivers/tty/isicom.c3
-rw-r--r--drivers/tty/mxser.c10
-rw-r--r--drivers/tty/n_gsm.c6
-rw-r--r--drivers/tty/pty.c3
-rw-r--r--drivers/tty/rocket.c8
-rw-r--r--drivers/tty/serial/68328serial.c4
-rw-r--r--drivers/tty/serial/crisv10.c18
-rw-r--r--drivers/tty/serial/jsm/jsm_tty.c3
-rw-r--r--drivers/tty/serial/serial_core.c20
-rw-r--r--drivers/tty/synclink.c23
-rw-r--r--drivers/tty/synclink_gt.c19
-rw-r--r--drivers/tty/synclinkmp.c19
-rw-r--r--drivers/tty/tty_ioctl.c12
-rw-r--r--drivers/tty/tty_port.c2
-rw-r--r--drivers/usb/serial/cypress_m8.c3
-rw-r--r--drivers/usb/serial/digi_acceleport.c8
-rw-r--r--drivers/usb/serial/io_edgeport.c4
-rw-r--r--drivers/usb/serial/mct_u232.c2
-rw-r--r--drivers/usb/serial/mos7720.c4
-rw-r--r--drivers/usb/serial/mos7840.c4
26 files changed, 104 insertions, 146 deletions
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index 45df4bf914f8..22c27652e46a 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -1349,7 +1349,7 @@ static void shutdown(MGSLPC_INFO * info, struct tty_struct *tty)
1349 /* TODO:disable interrupts instead of reset to preserve signal states */ 1349 /* TODO:disable interrupts instead of reset to preserve signal states */
1350 reset_device(info); 1350 reset_device(info);
1351 1351
1352 if (!tty || tty->termios.c_cflag & HUPCL) { 1352 if (!tty || C_HUPCL(tty)) {
1353 info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); 1353 info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR);
1354 set_signals(info); 1354 set_signals(info);
1355 } 1355 }
@@ -1390,7 +1390,7 @@ static void mgslpc_program_hw(MGSLPC_INFO *info, struct tty_struct *tty)
1390 port_irq_enable(info, (unsigned char) PVR_DSR | PVR_RI); 1390 port_irq_enable(info, (unsigned char) PVR_DSR | PVR_RI);
1391 get_signals(info); 1391 get_signals(info);
1392 1392
1393 if (info->netcount || (tty && (tty->termios.c_cflag & CREAD))) 1393 if (info->netcount || (tty && C_CREAD(tty)))
1394 rx_start(info); 1394 rx_start(info);
1395 1395
1396 spin_unlock_irqrestore(&info->lock, flags); 1396 spin_unlock_irqrestore(&info->lock, flags);
@@ -1733,7 +1733,7 @@ static void mgslpc_throttle(struct tty_struct * tty)
1733 if (I_IXOFF(tty)) 1733 if (I_IXOFF(tty))
1734 mgslpc_send_xchar(tty, STOP_CHAR(tty)); 1734 mgslpc_send_xchar(tty, STOP_CHAR(tty));
1735 1735
1736 if (tty->termios.c_cflag & CRTSCTS) { 1736 if (C_CRTSCTS(tty)) {
1737 spin_lock_irqsave(&info->lock, flags); 1737 spin_lock_irqsave(&info->lock, flags);
1738 info->serial_signals &= ~SerialSignal_RTS; 1738 info->serial_signals &= ~SerialSignal_RTS;
1739 set_signals(info); 1739 set_signals(info);
@@ -1762,7 +1762,7 @@ static void mgslpc_unthrottle(struct tty_struct * tty)
1762 mgslpc_send_xchar(tty, START_CHAR(tty)); 1762 mgslpc_send_xchar(tty, START_CHAR(tty));
1763 } 1763 }
1764 1764
1765 if (tty->termios.c_cflag & CRTSCTS) { 1765 if (C_CRTSCTS(tty)) {
1766 spin_lock_irqsave(&info->lock, flags); 1766 spin_lock_irqsave(&info->lock, flags);
1767 info->serial_signals |= SerialSignal_RTS; 1767 info->serial_signals |= SerialSignal_RTS;
1768 set_signals(info); 1768 set_signals(info);
@@ -2306,8 +2306,7 @@ static void mgslpc_set_termios(struct tty_struct *tty, struct ktermios *old_term
2306 mgslpc_change_params(info, tty); 2306 mgslpc_change_params(info, tty);
2307 2307
2308 /* Handle transition to B0 status */ 2308 /* Handle transition to B0 status */
2309 if (old_termios->c_cflag & CBAUD && 2309 if ((old_termios->c_cflag & CBAUD) && !C_BAUD(tty)) {
2310 !(tty->termios.c_cflag & CBAUD)) {
2311 info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); 2310 info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR);
2312 spin_lock_irqsave(&info->lock, flags); 2311 spin_lock_irqsave(&info->lock, flags);
2313 set_signals(info); 2312 set_signals(info);
@@ -2315,21 +2314,17 @@ static void mgslpc_set_termios(struct tty_struct *tty, struct ktermios *old_term
2315 } 2314 }
2316 2315
2317 /* Handle transition away from B0 status */ 2316 /* Handle transition away from B0 status */
2318 if (!(old_termios->c_cflag & CBAUD) && 2317 if (!(old_termios->c_cflag & CBAUD) && C_BAUD(tty)) {
2319 tty->termios.c_cflag & CBAUD) {
2320 info->serial_signals |= SerialSignal_DTR; 2318 info->serial_signals |= SerialSignal_DTR;
2321 if (!(tty->termios.c_cflag & CRTSCTS) || 2319 if (!C_CRTSCTS(tty) || !test_bit(TTY_THROTTLED, &tty->flags))
2322 !test_bit(TTY_THROTTLED, &tty->flags)) {
2323 info->serial_signals |= SerialSignal_RTS; 2320 info->serial_signals |= SerialSignal_RTS;
2324 }
2325 spin_lock_irqsave(&info->lock, flags); 2321 spin_lock_irqsave(&info->lock, flags);
2326 set_signals(info); 2322 set_signals(info);
2327 spin_unlock_irqrestore(&info->lock, flags); 2323 spin_unlock_irqrestore(&info->lock, flags);
2328 } 2324 }
2329 2325
2330 /* Handle turning off CRTSCTS */ 2326 /* Handle turning off CRTSCTS */
2331 if (old_termios->c_cflag & CRTSCTS && 2327 if (old_termios->c_cflag & CRTSCTS && !C_CRTSCTS(tty)) {
2332 !(tty->termios.c_cflag & CRTSCTS)) {
2333 tty->hw_stopped = 0; 2328 tty->hw_stopped = 0;
2334 tx_release(tty); 2329 tx_release(tty);
2335 } 2330 }
diff --git a/drivers/mmc/card/sdio_uart.c b/drivers/mmc/card/sdio_uart.c
index d2de5925b73e..5415056f9aa5 100644
--- a/drivers/mmc/card/sdio_uart.c
+++ b/drivers/mmc/card/sdio_uart.c
@@ -493,7 +493,7 @@ static void sdio_uart_check_modem_status(struct sdio_uart_port *port)
493 if (status & UART_MSR_DCTS) { 493 if (status & UART_MSR_DCTS) {
494 port->icount.cts++; 494 port->icount.cts++;
495 tty = tty_port_tty_get(&port->port); 495 tty = tty_port_tty_get(&port->port);
496 if (tty && (tty->termios.c_cflag & CRTSCTS)) { 496 if (tty && C_CRTSCTS(tty)) {
497 int cts = (status & UART_MSR_CTS); 497 int cts = (status & UART_MSR_CTS);
498 if (tty->hw_stopped) { 498 if (tty->hw_stopped) {
499 if (cts) { 499 if (cts) {
@@ -648,10 +648,10 @@ static int sdio_uart_activate(struct tty_port *tport, struct tty_struct *tty)
648 648
649 sdio_uart_change_speed(port, &tty->termios, NULL); 649 sdio_uart_change_speed(port, &tty->termios, NULL);
650 650
651 if (tty->termios.c_cflag & CBAUD) 651 if (C_BAUD(tty))
652 sdio_uart_set_mctrl(port, TIOCM_RTS | TIOCM_DTR); 652 sdio_uart_set_mctrl(port, TIOCM_RTS | TIOCM_DTR);
653 653
654 if (tty->termios.c_cflag & CRTSCTS) 654 if (C_CRTSCTS(tty))
655 if (!(sdio_uart_get_mctrl(port) & TIOCM_CTS)) 655 if (!(sdio_uart_get_mctrl(port) & TIOCM_CTS))
656 tty->hw_stopped = 1; 656 tty->hw_stopped = 1;
657 657
@@ -833,7 +833,7 @@ static void sdio_uart_throttle(struct tty_struct *tty)
833{ 833{
834 struct sdio_uart_port *port = tty->driver_data; 834 struct sdio_uart_port *port = tty->driver_data;
835 835
836 if (!I_IXOFF(tty) && !(tty->termios.c_cflag & CRTSCTS)) 836 if (!I_IXOFF(tty) && !C_CRTSCTS(tty))
837 return; 837 return;
838 838
839 if (sdio_uart_claim_func(port) != 0) 839 if (sdio_uart_claim_func(port) != 0)
@@ -844,7 +844,7 @@ static void sdio_uart_throttle(struct tty_struct *tty)
844 sdio_uart_start_tx(port); 844 sdio_uart_start_tx(port);
845 } 845 }
846 846
847 if (tty->termios.c_cflag & CRTSCTS) 847 if (C_CRTSCTS(tty))
848 sdio_uart_clear_mctrl(port, TIOCM_RTS); 848 sdio_uart_clear_mctrl(port, TIOCM_RTS);
849 849
850 sdio_uart_irq(port->func); 850 sdio_uart_irq(port->func);
@@ -855,7 +855,7 @@ static void sdio_uart_unthrottle(struct tty_struct *tty)
855{ 855{
856 struct sdio_uart_port *port = tty->driver_data; 856 struct sdio_uart_port *port = tty->driver_data;
857 857
858 if (!I_IXOFF(tty) && !(tty->termios.c_cflag & CRTSCTS)) 858 if (!I_IXOFF(tty) && !C_CRTSCTS(tty))
859 return; 859 return;
860 860
861 if (sdio_uart_claim_func(port) != 0) 861 if (sdio_uart_claim_func(port) != 0)
@@ -870,7 +870,7 @@ static void sdio_uart_unthrottle(struct tty_struct *tty)
870 } 870 }
871 } 871 }
872 872
873 if (tty->termios.c_cflag & CRTSCTS) 873 if (C_CRTSCTS(tty))
874 sdio_uart_set_mctrl(port, TIOCM_RTS); 874 sdio_uart_set_mctrl(port, TIOCM_RTS);
875 875
876 sdio_uart_irq(port->func); 876 sdio_uart_irq(port->func);
diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 5413ed8c29ff..294c1c83aa4d 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -1530,7 +1530,7 @@ static void dgap_input(struct channel_t *ch)
1530 if ((bd->state != BOARD_READY) || !tp || 1530 if ((bd->state != BOARD_READY) || !tp ||
1531 (tp->magic != TTY_MAGIC) || 1531 (tp->magic != TTY_MAGIC) ||
1532 !(ch->ch_tun.un_flags & UN_ISOPEN) || 1532 !(ch->ch_tun.un_flags & UN_ISOPEN) ||
1533 !(tp->termios.c_cflag & CREAD) || 1533 !C_CREAD(tp) ||
1534 (ch->ch_tun.un_flags & UN_CLOSING)) { 1534 (ch->ch_tun.un_flags & UN_CLOSING)) {
1535 writew(head, &bs->rx_tail); 1535 writew(head, &bs->rx_tail);
1536 writeb(1, &bs->idata); 1536 writeb(1, &bs->idata);
diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index 4a3d2c6f7eac..8b1ba65a6984 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -541,7 +541,7 @@ void dgnc_input(struct channel_t *ch)
541 */ 541 */
542 if (!tp || (tp->magic != TTY_MAGIC) || 542 if (!tp || (tp->magic != TTY_MAGIC) ||
543 !(ch->ch_tun.un_flags & UN_ISOPEN) || 543 !(ch->ch_tun.un_flags & UN_ISOPEN) ||
544 !(tp->termios.c_cflag & CREAD) || 544 !C_CREAD(tp) ||
545 (ch->ch_tun.un_flags & UN_CLOSING)) { 545 (ch->ch_tun.un_flags & UN_CLOSING)) {
546 ch->ch_r_head = tail; 546 ch->ch_r_head = tail;
547 547
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
index 6ba5681b6385..eacf4c9f3b29 100644
--- a/drivers/tty/amiserial.c
+++ b/drivers/tty/amiserial.c
@@ -639,7 +639,7 @@ static void shutdown(struct tty_struct *tty, struct serial_state *info)
639 custom.adkcon = AC_UARTBRK; 639 custom.adkcon = AC_UARTBRK;
640 mb(); 640 mb();
641 641
642 if (tty->termios.c_cflag & HUPCL) 642 if (C_HUPCL(tty))
643 info->MCR &= ~(SER_DTR|SER_RTS); 643 info->MCR &= ~(SER_DTR|SER_RTS);
644 rtsdtr_ctrl(info->MCR); 644 rtsdtr_ctrl(info->MCR);
645 645
@@ -974,7 +974,7 @@ static void rs_throttle(struct tty_struct * tty)
974 if (I_IXOFF(tty)) 974 if (I_IXOFF(tty))
975 rs_send_xchar(tty, STOP_CHAR(tty)); 975 rs_send_xchar(tty, STOP_CHAR(tty));
976 976
977 if (tty->termios.c_cflag & CRTSCTS) 977 if (C_CRTSCTS(tty))
978 info->MCR &= ~SER_RTS; 978 info->MCR &= ~SER_RTS;
979 979
980 local_irq_save(flags); 980 local_irq_save(flags);
@@ -999,7 +999,7 @@ static void rs_unthrottle(struct tty_struct * tty)
999 else 999 else
1000 rs_send_xchar(tty, START_CHAR(tty)); 1000 rs_send_xchar(tty, START_CHAR(tty));
1001 } 1001 }
1002 if (tty->termios.c_cflag & CRTSCTS) 1002 if (C_CRTSCTS(tty))
1003 info->MCR |= SER_RTS; 1003 info->MCR |= SER_RTS;
1004 local_irq_save(flags); 1004 local_irq_save(flags);
1005 rtsdtr_ctrl(info->MCR); 1005 rtsdtr_ctrl(info->MCR);
@@ -1332,8 +1332,7 @@ static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
1332 change_speed(tty, info, old_termios); 1332 change_speed(tty, info, old_termios);
1333 1333
1334 /* Handle transition to B0 status */ 1334 /* Handle transition to B0 status */
1335 if ((old_termios->c_cflag & CBAUD) && 1335 if ((old_termios->c_cflag & CBAUD) && !(cflag & CBAUD)) {
1336 !(cflag & CBAUD)) {
1337 info->MCR &= ~(SER_DTR|SER_RTS); 1336 info->MCR &= ~(SER_DTR|SER_RTS);
1338 local_irq_save(flags); 1337 local_irq_save(flags);
1339 rtsdtr_ctrl(info->MCR); 1338 rtsdtr_ctrl(info->MCR);
@@ -1341,21 +1340,17 @@ static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
1341 } 1340 }
1342 1341
1343 /* Handle transition away from B0 status */ 1342 /* Handle transition away from B0 status */
1344 if (!(old_termios->c_cflag & CBAUD) && 1343 if (!(old_termios->c_cflag & CBAUD) && (cflag & CBAUD)) {
1345 (cflag & CBAUD)) {
1346 info->MCR |= SER_DTR; 1344 info->MCR |= SER_DTR;
1347 if (!(tty->termios.c_cflag & CRTSCTS) || 1345 if (!C_CRTSCTS(tty) || !test_bit(TTY_THROTTLED, &tty->flags))
1348 !test_bit(TTY_THROTTLED, &tty->flags)) {
1349 info->MCR |= SER_RTS; 1346 info->MCR |= SER_RTS;
1350 }
1351 local_irq_save(flags); 1347 local_irq_save(flags);
1352 rtsdtr_ctrl(info->MCR); 1348 rtsdtr_ctrl(info->MCR);
1353 local_irq_restore(flags); 1349 local_irq_restore(flags);
1354 } 1350 }
1355 1351
1356 /* Handle turning off CRTSCTS */ 1352 /* Handle turning off CRTSCTS */
1357 if ((old_termios->c_cflag & CRTSCTS) && 1353 if ((old_termios->c_cflag & CRTSCTS) && !C_CRTSCTS(tty)) {
1358 !(tty->termios.c_cflag & CRTSCTS)) {
1359 tty->hw_stopped = 0; 1354 tty->hw_stopped = 0;
1360 rs_start(tty); 1355 rs_start(tty);
1361 } 1356 }
@@ -1367,8 +1362,7 @@ static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
1367 * XXX It's not clear whether the current behavior is correct 1362 * XXX It's not clear whether the current behavior is correct
1368 * or not. Hence, this may change..... 1363 * or not. Hence, this may change.....
1369 */ 1364 */
1370 if (!(old_termios->c_cflag & CLOCAL) && 1365 if (!(old_termios->c_cflag & CLOCAL) && C_CLOCAL(tty))
1371 (tty->termios.c_cflag & CLOCAL))
1372 wake_up_interruptible(&info->open_wait); 1366 wake_up_interruptible(&info->open_wait);
1373#endif 1367#endif
1374} 1368}
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
index a48e7e66b970..d67e542bab1c 100644
--- a/drivers/tty/cyclades.c
+++ b/drivers/tty/cyclades.c
@@ -1440,7 +1440,7 @@ static void cy_shutdown(struct cyclades_port *info, struct tty_struct *tty)
1440 info->port.xmit_buf = NULL; 1440 info->port.xmit_buf = NULL;
1441 free_page((unsigned long)temp); 1441 free_page((unsigned long)temp);
1442 } 1442 }
1443 if (tty->termios.c_cflag & HUPCL) 1443 if (C_HUPCL(tty))
1444 cyy_change_rts_dtr(info, 0, TIOCM_RTS | TIOCM_DTR); 1444 cyy_change_rts_dtr(info, 0, TIOCM_RTS | TIOCM_DTR);
1445 1445
1446 cyy_issue_cmd(info, CyCHAN_CTL | CyDIS_RCVR); 1446 cyy_issue_cmd(info, CyCHAN_CTL | CyDIS_RCVR);
@@ -1469,7 +1469,7 @@ static void cy_shutdown(struct cyclades_port *info, struct tty_struct *tty)
1469 free_page((unsigned long)temp); 1469 free_page((unsigned long)temp);
1470 } 1470 }
1471 1471
1472 if (tty->termios.c_cflag & HUPCL) 1472 if (C_HUPCL(tty))
1473 tty_port_lower_dtr_rts(&info->port); 1473 tty_port_lower_dtr_rts(&info->port);
1474 1474
1475 set_bit(TTY_IO_ERROR, &tty->flags); 1475 set_bit(TTY_IO_ERROR, &tty->flags);
@@ -2795,8 +2795,7 @@ static void cy_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
2795 2795
2796 cy_set_line_char(info, tty); 2796 cy_set_line_char(info, tty);
2797 2797
2798 if ((old_termios->c_cflag & CRTSCTS) && 2798 if ((old_termios->c_cflag & CRTSCTS) && !C_CRTSCTS(tty)) {
2799 !(tty->termios.c_cflag & CRTSCTS)) {
2800 tty->hw_stopped = 0; 2799 tty->hw_stopped = 0;
2801 cy_start(tty); 2800 cy_start(tty);
2802 } 2801 }
@@ -2807,8 +2806,7 @@ static void cy_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
2807 * XXX It's not clear whether the current behavior is correct 2806 * XXX It's not clear whether the current behavior is correct
2808 * or not. Hence, this may change..... 2807 * or not. Hence, this may change.....
2809 */ 2808 */
2810 if (!(old_termios->c_cflag & CLOCAL) && 2809 if (!(old_termios->c_cflag & CLOCAL) && C_CLOCAL(tty))
2811 (tty->termios.c_cflag & CLOCAL))
2812 wake_up_interruptible(&info->port.open_wait); 2810 wake_up_interruptible(&info->port.open_wait);
2813#endif 2811#endif
2814} /* cy_set_termios */ 2812} /* cy_set_termios */
@@ -2868,7 +2866,7 @@ static void cy_throttle(struct tty_struct *tty)
2868 info->throttle = 1; 2866 info->throttle = 1;
2869 } 2867 }
2870 2868
2871 if (tty->termios.c_cflag & CRTSCTS) { 2869 if (C_CRTSCTS(tty)) {
2872 if (!cy_is_Z(card)) { 2870 if (!cy_is_Z(card)) {
2873 spin_lock_irqsave(&card->card_lock, flags); 2871 spin_lock_irqsave(&card->card_lock, flags);
2874 cyy_change_rts_dtr(info, 0, TIOCM_RTS); 2872 cyy_change_rts_dtr(info, 0, TIOCM_RTS);
@@ -2905,7 +2903,7 @@ static void cy_unthrottle(struct tty_struct *tty)
2905 cy_send_xchar(tty, START_CHAR(tty)); 2903 cy_send_xchar(tty, START_CHAR(tty));
2906 } 2904 }
2907 2905
2908 if (tty->termios.c_cflag & CRTSCTS) { 2906 if (C_CRTSCTS(tty)) {
2909 card = info->card; 2907 card = info->card;
2910 if (!cy_is_Z(card)) { 2908 if (!cy_is_Z(card)) {
2911 spin_lock_irqsave(&card->card_lock, flags); 2909 spin_lock_irqsave(&card->card_lock, flags);
diff --git a/drivers/tty/isicom.c b/drivers/tty/isicom.c
index 99875949bfb7..8bf67630018b 100644
--- a/drivers/tty/isicom.c
+++ b/drivers/tty/isicom.c
@@ -1204,8 +1204,7 @@ static void isicom_set_termios(struct tty_struct *tty,
1204 isicom_config_port(tty); 1204 isicom_config_port(tty);
1205 spin_unlock_irqrestore(&port->card->card_lock, flags); 1205 spin_unlock_irqrestore(&port->card->card_lock, flags);
1206 1206
1207 if ((old_termios->c_cflag & CRTSCTS) && 1207 if ((old_termios->c_cflag & CRTSCTS) && !C_CRTSCTS(tty)) {
1208 !(tty->termios.c_cflag & CRTSCTS)) {
1209 tty->hw_stopped = 0; 1208 tty->hw_stopped = 0;
1210 isicom_start(tty); 1209 isicom_start(tty);
1211 } 1210 }
diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c
index 4c4a23674569..e9600cece8da 100644
--- a/drivers/tty/mxser.c
+++ b/drivers/tty/mxser.c
@@ -1864,7 +1864,7 @@ static void mxser_stoprx(struct tty_struct *tty)
1864 } 1864 }
1865 } 1865 }
1866 1866
1867 if (tty->termios.c_cflag & CRTSCTS) { 1867 if (C_CRTSCTS(tty)) {
1868 info->MCR &= ~UART_MCR_RTS; 1868 info->MCR &= ~UART_MCR_RTS;
1869 outb(info->MCR, info->ioaddr + UART_MCR); 1869 outb(info->MCR, info->ioaddr + UART_MCR);
1870 } 1870 }
@@ -1901,7 +1901,7 @@ static void mxser_unthrottle(struct tty_struct *tty)
1901 } 1901 }
1902 } 1902 }
1903 1903
1904 if (tty->termios.c_cflag & CRTSCTS) { 1904 if (C_CRTSCTS(tty)) {
1905 info->MCR |= UART_MCR_RTS; 1905 info->MCR |= UART_MCR_RTS;
1906 outb(info->MCR, info->ioaddr + UART_MCR); 1906 outb(info->MCR, info->ioaddr + UART_MCR);
1907 } 1907 }
@@ -1949,15 +1949,13 @@ static void mxser_set_termios(struct tty_struct *tty, struct ktermios *old_termi
1949 mxser_change_speed(tty, old_termios); 1949 mxser_change_speed(tty, old_termios);
1950 spin_unlock_irqrestore(&info->slock, flags); 1950 spin_unlock_irqrestore(&info->slock, flags);
1951 1951
1952 if ((old_termios->c_cflag & CRTSCTS) && 1952 if ((old_termios->c_cflag & CRTSCTS) && !C_CRTSCTS(tty)) {
1953 !(tty->termios.c_cflag & CRTSCTS)) {
1954 tty->hw_stopped = 0; 1953 tty->hw_stopped = 0;
1955 mxser_start(tty); 1954 mxser_start(tty);
1956 } 1955 }
1957 1956
1958 /* Handle sw stopped */ 1957 /* Handle sw stopped */
1959 if ((old_termios->c_iflag & IXON) && 1958 if ((old_termios->c_iflag & IXON) && !I_IXON(tty)) {
1960 !(tty->termios.c_iflag & IXON)) {
1961 tty->stopped = 0; 1959 tty->stopped = 0;
1962 1960
1963 if (info->board->chip_flag) { 1961 if (info->board->chip_flag) {
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index e3cc27749344..c01620780f5b 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -1066,7 +1066,7 @@ static void gsm_process_modem(struct tty_struct *tty, struct gsm_dlci *dlci,
1066 /* Carrier drop -> hangup */ 1066 /* Carrier drop -> hangup */
1067 if (tty) { 1067 if (tty) {
1068 if ((mlines & TIOCM_CD) == 0 && (dlci->modem_rx & TIOCM_CD)) 1068 if ((mlines & TIOCM_CD) == 0 && (dlci->modem_rx & TIOCM_CD))
1069 if (!(tty->termios.c_cflag & CLOCAL)) 1069 if (!C_CLOCAL(tty))
1070 tty_hangup(tty); 1070 tty_hangup(tty);
1071 } 1071 }
1072 if (brk & 0x01) 1072 if (brk & 0x01)
@@ -3116,7 +3116,7 @@ static void gsmtty_throttle(struct tty_struct *tty)
3116 struct gsm_dlci *dlci = tty->driver_data; 3116 struct gsm_dlci *dlci = tty->driver_data;
3117 if (dlci->state == DLCI_CLOSED) 3117 if (dlci->state == DLCI_CLOSED)
3118 return; 3118 return;
3119 if (tty->termios.c_cflag & CRTSCTS) 3119 if (C_CRTSCTS(tty))
3120 dlci->modem_tx &= ~TIOCM_DTR; 3120 dlci->modem_tx &= ~TIOCM_DTR;
3121 dlci->throttled = 1; 3121 dlci->throttled = 1;
3122 /* Send an MSC with DTR cleared */ 3122 /* Send an MSC with DTR cleared */
@@ -3128,7 +3128,7 @@ static void gsmtty_unthrottle(struct tty_struct *tty)
3128 struct gsm_dlci *dlci = tty->driver_data; 3128 struct gsm_dlci *dlci = tty->driver_data;
3129 if (dlci->state == DLCI_CLOSED) 3129 if (dlci->state == DLCI_CLOSED)
3130 return; 3130 return;
3131 if (tty->termios.c_cflag & CRTSCTS) 3131 if (C_CRTSCTS(tty))
3132 dlci->modem_tx |= TIOCM_DTR; 3132 dlci->modem_tx |= TIOCM_DTR;
3133 dlci->throttled = 0; 3133 dlci->throttled = 0;
3134 /* Send an MSC with DTR set */ 3134 /* Send an MSC with DTR set */
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index be5020d567ae..78170e7aa3a3 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -263,8 +263,7 @@ static void pty_set_termios(struct tty_struct *tty,
263{ 263{
264 /* See if packet mode change of state. */ 264 /* See if packet mode change of state. */
265 if (tty->link && tty->link->packet) { 265 if (tty->link && tty->link->packet) {
266 int extproc = (old_termios->c_lflag & EXTPROC) | 266 int extproc = (old_termios->c_lflag & EXTPROC) | L_EXTPROC(tty);
267 (tty->termios.c_lflag & EXTPROC);
268 int old_flow = ((old_termios->c_iflag & IXON) && 267 int old_flow = ((old_termios->c_iflag & IXON) &&
269 (old_termios->c_cc[VSTOP] == '\023') && 268 (old_termios->c_cc[VSTOP] == '\023') &&
270 (old_termios->c_cc[VSTART] == '\021')); 269 (old_termios->c_cc[VSTART] == '\021'));
diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c
index 9dd02daf45ca..2ab3b6fdb675 100644
--- a/drivers/tty/rocket.c
+++ b/drivers/tty/rocket.c
@@ -959,7 +959,7 @@ static int rp_open(struct tty_struct *tty, struct file *filp)
959 tty->alt_speed = 460800; 959 tty->alt_speed = 460800;
960 960
961 configure_r_port(tty, info, NULL); 961 configure_r_port(tty, info, NULL);
962 if (tty->termios.c_cflag & CBAUD) { 962 if (C_BAUD(tty)) {
963 sSetDTR(cp); 963 sSetDTR(cp);
964 sSetRTS(cp); 964 sSetRTS(cp);
965 } 965 }
@@ -1084,18 +1084,18 @@ static void rp_set_termios(struct tty_struct *tty,
1084 cp = &info->channel; 1084 cp = &info->channel;
1085 1085
1086 /* Handle transition to B0 status */ 1086 /* Handle transition to B0 status */
1087 if ((old_termios->c_cflag & CBAUD) && !(tty->termios.c_cflag & CBAUD)) { 1087 if ((old_termios->c_cflag & CBAUD) && !C_BAUD(tty)) {
1088 sClrDTR(cp); 1088 sClrDTR(cp);
1089 sClrRTS(cp); 1089 sClrRTS(cp);
1090 } 1090 }
1091 1091
1092 /* Handle transition away from B0 status */ 1092 /* Handle transition away from B0 status */
1093 if (!(old_termios->c_cflag & CBAUD) && (tty->termios.c_cflag & CBAUD)) { 1093 if (!(old_termios->c_cflag & CBAUD) && C_BAUD(tty)) {
1094 sSetRTS(cp); 1094 sSetRTS(cp);
1095 sSetDTR(cp); 1095 sSetDTR(cp);
1096 } 1096 }
1097 1097
1098 if ((old_termios->c_cflag & CRTSCTS) && !(tty->termios.c_cflag & CRTSCTS)) 1098 if ((old_termios->c_cflag & CRTSCTS) && !C_CRTSCTS(tty))
1099 rp_start(tty); 1099 rp_start(tty);
1100} 1100}
1101 1101
diff --git a/drivers/tty/serial/68328serial.c b/drivers/tty/serial/68328serial.c
index 90639b590a10..4931212e5cf6 100644
--- a/drivers/tty/serial/68328serial.c
+++ b/drivers/tty/serial/68328serial.c
@@ -976,10 +976,8 @@ static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
976 976
977 change_speed(info, tty); 977 change_speed(info, tty);
978 978
979 if ((old_termios->c_cflag & CRTSCTS) && 979 if ((old_termios->c_cflag & CRTSCTS) && !C_CRTSCTS(tty))
980 !(tty->termios.c_cflag & CRTSCTS))
981 rs_start(tty); 980 rs_start(tty);
982
983} 981}
984 982
985/* 983/*
diff --git a/drivers/tty/serial/crisv10.c b/drivers/tty/serial/crisv10.c
index e98aef797065..37f10c4a3faf 100644
--- a/drivers/tty/serial/crisv10.c
+++ b/drivers/tty/serial/crisv10.c
@@ -1413,9 +1413,8 @@ rs_stop(struct tty_struct *tty)
1413 xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, 1413 xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char,
1414 STOP_CHAR(info->port.tty)); 1414 STOP_CHAR(info->port.tty));
1415 xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, stop); 1415 xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, stop);
1416 if (tty->termios.c_iflag & IXON ) { 1416 if (I_IXON(tty))
1417 xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable); 1417 xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable);
1418 }
1419 1418
1420 *((unsigned long *)&info->ioport[REG_XOFF]) = xoff; 1419 *((unsigned long *)&info->ioport[REG_XOFF]) = xoff;
1421 local_irq_restore(flags); 1420 local_irq_restore(flags);
@@ -1436,9 +1435,8 @@ rs_start(struct tty_struct *tty)
1436 info->xmit.tail,SERIAL_XMIT_SIZE))); 1435 info->xmit.tail,SERIAL_XMIT_SIZE)));
1437 xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, STOP_CHAR(tty)); 1436 xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, STOP_CHAR(tty));
1438 xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, enable); 1437 xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, enable);
1439 if (tty->termios.c_iflag & IXON ) { 1438 if (I_IXON(tty))
1440 xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable); 1439 xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable);
1441 }
1442 1440
1443 *((unsigned long *)&info->ioport[REG_XOFF]) = xoff; 1441 *((unsigned long *)&info->ioport[REG_XOFF]) = xoff;
1444 if (!info->uses_dma_out && 1442 if (!info->uses_dma_out &&
@@ -3166,7 +3164,7 @@ rs_throttle(struct tty_struct * tty)
3166 DFLOW(DEBUG_LOG(info->line,"rs_throttle\n")); 3164 DFLOW(DEBUG_LOG(info->line,"rs_throttle\n"));
3167 3165
3168 /* Do RTS before XOFF since XOFF might take some time */ 3166 /* Do RTS before XOFF since XOFF might take some time */
3169 if (tty->termios.c_cflag & CRTSCTS) { 3167 if (C_CRTSCTS(tty)) {
3170 /* Turn off RTS line */ 3168 /* Turn off RTS line */
3171 e100_rts(info, 0); 3169 e100_rts(info, 0);
3172 } 3170 }
@@ -3185,7 +3183,7 @@ rs_unthrottle(struct tty_struct * tty)
3185 DFLOW(DEBUG_LOG(info->line,"rs_unthrottle ldisc\n")); 3183 DFLOW(DEBUG_LOG(info->line,"rs_unthrottle ldisc\n"));
3186 DFLOW(DEBUG_LOG(info->line,"rs_unthrottle flip.count: %i\n", tty->flip.count)); 3184 DFLOW(DEBUG_LOG(info->line,"rs_unthrottle flip.count: %i\n", tty->flip.count));
3187 /* Do RTS before XOFF since XOFF might take some time */ 3185 /* Do RTS before XOFF since XOFF might take some time */
3188 if (tty->termios.c_cflag & CRTSCTS) { 3186 if (C_CRTSCTS(tty)) {
3189 /* Assert RTS line */ 3187 /* Assert RTS line */
3190 e100_rts(info, 1); 3188 e100_rts(info, 1);
3191 } 3189 }
@@ -3553,8 +3551,7 @@ rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
3553 change_speed(info); 3551 change_speed(info);
3554 3552
3555 /* Handle turning off CRTSCTS */ 3553 /* Handle turning off CRTSCTS */
3556 if ((old_termios->c_cflag & CRTSCTS) && 3554 if ((old_termios->c_cflag & CRTSCTS) && !C_CRTSCTS(tty))
3557 !(tty->termios.c_cflag & CRTSCTS))
3558 rs_start(tty); 3555 rs_start(tty);
3559 3556
3560} 3557}
@@ -3765,9 +3762,8 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
3765 return 0; 3762 return 0;
3766 } 3763 }
3767 3764
3768 if (tty->termios.c_cflag & CLOCAL) { 3765 if (C_CLOCAL(tty))
3769 do_clocal = 1; 3766 do_clocal = 1;
3770 }
3771 3767
3772 /* 3768 /*
3773 * Block waiting for the carrier detect and the line to become 3769 * Block waiting for the carrier detect and the line to become
diff --git a/drivers/tty/serial/jsm/jsm_tty.c b/drivers/tty/serial/jsm/jsm_tty.c
index 524e86ab3cae..00cac10ae75a 100644
--- a/drivers/tty/serial/jsm/jsm_tty.c
+++ b/drivers/tty/serial/jsm/jsm_tty.c
@@ -569,8 +569,7 @@ void jsm_input(struct jsm_channel *ch)
569 *If the device is not open, or CREAD is off, flush 569 *If the device is not open, or CREAD is off, flush
570 *input data and return immediately. 570 *input data and return immediately.
571 */ 571 */
572 if (!tp || 572 if (!tp || !C_CREAD(tp)) {
573 !(tp->termios.c_cflag & CREAD) ) {
574 573
575 jsm_dbg(READ, &ch->ch_bd->pci_dev, 574 jsm_dbg(READ, &ch->ch_bd->pci_dev,
576 "input. dropping %d bytes on port %d...\n", 575 "input. dropping %d bytes on port %d...\n",
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index b1f54ab1818c..1efdc2b476ea 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -171,14 +171,12 @@ static int uart_port_startup(struct tty_struct *tty, struct uart_state *state,
171 */ 171 */
172 uart_change_speed(tty, state, NULL); 172 uart_change_speed(tty, state, NULL);
173 173
174 if (init_hw) { 174 /*
175 /* 175 * Setup the RTS and DTR signals once the
176 * Setup the RTS and DTR signals once the 176 * port is open and ready to respond.
177 * port is open and ready to respond. 177 */
178 */ 178 if (init_hw && C_BAUD(tty))
179 if (tty->termios.c_cflag & CBAUD) 179 uart_set_mctrl(uport, TIOCM_RTS | TIOCM_DTR);
180 uart_set_mctrl(uport, TIOCM_RTS | TIOCM_DTR);
181 }
182 } 180 }
183 181
184 /* 182 /*
@@ -240,7 +238,7 @@ static void uart_shutdown(struct tty_struct *tty, struct uart_state *state)
240 if (uart_console(uport) && tty) 238 if (uart_console(uport) && tty)
241 uport->cons->cflag = tty->termios.c_cflag; 239 uport->cons->cflag = tty->termios.c_cflag;
242 240
243 if (!tty || (tty->termios.c_cflag & HUPCL)) 241 if (!tty || C_HUPCL(tty))
244 uart_clear_mctrl(uport, TIOCM_DTR | TIOCM_RTS); 242 uart_clear_mctrl(uport, TIOCM_DTR | TIOCM_RTS);
245 243
246 uart_port_shutdown(port); 244 uart_port_shutdown(port);
@@ -639,7 +637,7 @@ static void uart_throttle(struct tty_struct *tty)
639 637
640 if (I_IXOFF(tty)) 638 if (I_IXOFF(tty))
641 mask |= UPSTAT_AUTOXOFF; 639 mask |= UPSTAT_AUTOXOFF;
642 if (tty->termios.c_cflag & CRTSCTS) 640 if (C_CRTSCTS(tty))
643 mask |= UPSTAT_AUTORTS; 641 mask |= UPSTAT_AUTORTS;
644 642
645 if (port->status & mask) { 643 if (port->status & mask) {
@@ -662,7 +660,7 @@ static void uart_unthrottle(struct tty_struct *tty)
662 660
663 if (I_IXOFF(tty)) 661 if (I_IXOFF(tty))
664 mask |= UPSTAT_AUTOXOFF; 662 mask |= UPSTAT_AUTOXOFF;
665 if (tty->termios.c_cflag & CRTSCTS) 663 if (C_CRTSCTS(tty))
666 mask |= UPSTAT_AUTORTS; 664 mask |= UPSTAT_AUTORTS;
667 665
668 if (port->status & mask) { 666 if (port->status & mask) {
diff --git a/drivers/tty/synclink.c b/drivers/tty/synclink.c
index 6188059fd523..f5476e270734 100644
--- a/drivers/tty/synclink.c
+++ b/drivers/tty/synclink.c
@@ -2363,7 +2363,7 @@ static void mgsl_throttle(struct tty_struct * tty)
2363 if (I_IXOFF(tty)) 2363 if (I_IXOFF(tty))
2364 mgsl_send_xchar(tty, STOP_CHAR(tty)); 2364 mgsl_send_xchar(tty, STOP_CHAR(tty));
2365 2365
2366 if (tty->termios.c_cflag & CRTSCTS) { 2366 if (C_CRTSCTS(tty)) {
2367 spin_lock_irqsave(&info->irq_spinlock,flags); 2367 spin_lock_irqsave(&info->irq_spinlock,flags);
2368 info->serial_signals &= ~SerialSignal_RTS; 2368 info->serial_signals &= ~SerialSignal_RTS;
2369 usc_set_serial_signals(info); 2369 usc_set_serial_signals(info);
@@ -2397,7 +2397,7 @@ static void mgsl_unthrottle(struct tty_struct * tty)
2397 mgsl_send_xchar(tty, START_CHAR(tty)); 2397 mgsl_send_xchar(tty, START_CHAR(tty));
2398 } 2398 }
2399 2399
2400 if (tty->termios.c_cflag & CRTSCTS) { 2400 if (C_CRTSCTS(tty)) {
2401 spin_lock_irqsave(&info->irq_spinlock,flags); 2401 spin_lock_irqsave(&info->irq_spinlock,flags);
2402 info->serial_signals |= SerialSignal_RTS; 2402 info->serial_signals |= SerialSignal_RTS;
2403 usc_set_serial_signals(info); 2403 usc_set_serial_signals(info);
@@ -3039,30 +3039,25 @@ static void mgsl_set_termios(struct tty_struct *tty, struct ktermios *old_termio
3039 mgsl_change_params(info); 3039 mgsl_change_params(info);
3040 3040
3041 /* Handle transition to B0 status */ 3041 /* Handle transition to B0 status */
3042 if (old_termios->c_cflag & CBAUD && 3042 if ((old_termios->c_cflag & CBAUD) && !C_BAUD(tty)) {
3043 !(tty->termios.c_cflag & CBAUD)) {
3044 info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); 3043 info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR);
3045 spin_lock_irqsave(&info->irq_spinlock,flags); 3044 spin_lock_irqsave(&info->irq_spinlock,flags);
3046 usc_set_serial_signals(info); 3045 usc_set_serial_signals(info);
3047 spin_unlock_irqrestore(&info->irq_spinlock,flags); 3046 spin_unlock_irqrestore(&info->irq_spinlock,flags);
3048 } 3047 }
3049 3048
3050 /* Handle transition away from B0 status */ 3049 /* Handle transition away from B0 status */
3051 if (!(old_termios->c_cflag & CBAUD) && 3050 if (!(old_termios->c_cflag & CBAUD) && C_BAUD(tty)) {
3052 tty->termios.c_cflag & CBAUD) {
3053 info->serial_signals |= SerialSignal_DTR; 3051 info->serial_signals |= SerialSignal_DTR;
3054 if (!(tty->termios.c_cflag & CRTSCTS) || 3052 if (!C_CRTSCTS(tty) || !test_bit(TTY_THROTTLED, &tty->flags))
3055 !test_bit(TTY_THROTTLED, &tty->flags)) {
3056 info->serial_signals |= SerialSignal_RTS; 3053 info->serial_signals |= SerialSignal_RTS;
3057 }
3058 spin_lock_irqsave(&info->irq_spinlock,flags); 3054 spin_lock_irqsave(&info->irq_spinlock,flags);
3059 usc_set_serial_signals(info); 3055 usc_set_serial_signals(info);
3060 spin_unlock_irqrestore(&info->irq_spinlock,flags); 3056 spin_unlock_irqrestore(&info->irq_spinlock,flags);
3061 } 3057 }
3062 3058
3063 /* Handle turning off CRTSCTS */ 3059 /* Handle turning off CRTSCTS */
3064 if (old_termios->c_cflag & CRTSCTS && 3060 if (old_termios->c_cflag & CRTSCTS && !C_CRTSCTS(tty)) {
3065 !(tty->termios.c_cflag & CRTSCTS)) {
3066 tty->hw_stopped = 0; 3061 tty->hw_stopped = 0;
3067 mgsl_start(tty); 3062 mgsl_start(tty);
3068 } 3063 }
@@ -3281,7 +3276,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
3281 return 0; 3276 return 0;
3282 } 3277 }
3283 3278
3284 if (tty->termios.c_cflag & CLOCAL) 3279 if (C_CLOCAL(tty))
3285 do_clocal = true; 3280 do_clocal = true;
3286 3281
3287 /* Wait for carrier detect and the line to become 3282 /* Wait for carrier detect and the line to become
diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c
index 5505ea842179..c0a2f5a1b1c2 100644
--- a/drivers/tty/synclink_gt.c
+++ b/drivers/tty/synclink_gt.c
@@ -774,8 +774,7 @@ static void set_termios(struct tty_struct *tty, struct ktermios *old_termios)
774 change_params(info); 774 change_params(info);
775 775
776 /* Handle transition to B0 status */ 776 /* Handle transition to B0 status */
777 if (old_termios->c_cflag & CBAUD && 777 if ((old_termios->c_cflag & CBAUD) && !C_BAUD(tty)) {
778 !(tty->termios.c_cflag & CBAUD)) {
779 info->signals &= ~(SerialSignal_RTS | SerialSignal_DTR); 778 info->signals &= ~(SerialSignal_RTS | SerialSignal_DTR);
780 spin_lock_irqsave(&info->lock,flags); 779 spin_lock_irqsave(&info->lock,flags);
781 set_signals(info); 780 set_signals(info);
@@ -783,21 +782,17 @@ static void set_termios(struct tty_struct *tty, struct ktermios *old_termios)
783 } 782 }
784 783
785 /* Handle transition away from B0 status */ 784 /* Handle transition away from B0 status */
786 if (!(old_termios->c_cflag & CBAUD) && 785 if (!(old_termios->c_cflag & CBAUD) && C_BAUD(tty)) {
787 tty->termios.c_cflag & CBAUD) {
788 info->signals |= SerialSignal_DTR; 786 info->signals |= SerialSignal_DTR;
789 if (!(tty->termios.c_cflag & CRTSCTS) || 787 if (!C_CRTSCTS(tty) || !test_bit(TTY_THROTTLED, &tty->flags))
790 !test_bit(TTY_THROTTLED, &tty->flags)) {
791 info->signals |= SerialSignal_RTS; 788 info->signals |= SerialSignal_RTS;
792 }
793 spin_lock_irqsave(&info->lock,flags); 789 spin_lock_irqsave(&info->lock,flags);
794 set_signals(info); 790 set_signals(info);
795 spin_unlock_irqrestore(&info->lock,flags); 791 spin_unlock_irqrestore(&info->lock,flags);
796 } 792 }
797 793
798 /* Handle turning off CRTSCTS */ 794 /* Handle turning off CRTSCTS */
799 if (old_termios->c_cflag & CRTSCTS && 795 if ((old_termios->c_cflag & CRTSCTS) && !C_CRTSCTS(tty)) {
800 !(tty->termios.c_cflag & CRTSCTS)) {
801 tty->hw_stopped = 0; 796 tty->hw_stopped = 0;
802 tx_release(tty); 797 tx_release(tty);
803 } 798 }
@@ -1362,7 +1357,7 @@ static void throttle(struct tty_struct * tty)
1362 DBGINFO(("%s throttle\n", info->device_name)); 1357 DBGINFO(("%s throttle\n", info->device_name));
1363 if (I_IXOFF(tty)) 1358 if (I_IXOFF(tty))
1364 send_xchar(tty, STOP_CHAR(tty)); 1359 send_xchar(tty, STOP_CHAR(tty));
1365 if (tty->termios.c_cflag & CRTSCTS) { 1360 if (C_CRTSCTS(tty)) {
1366 spin_lock_irqsave(&info->lock,flags); 1361 spin_lock_irqsave(&info->lock,flags);
1367 info->signals &= ~SerialSignal_RTS; 1362 info->signals &= ~SerialSignal_RTS;
1368 set_signals(info); 1363 set_signals(info);
@@ -1387,7 +1382,7 @@ static void unthrottle(struct tty_struct * tty)
1387 else 1382 else
1388 send_xchar(tty, START_CHAR(tty)); 1383 send_xchar(tty, START_CHAR(tty));
1389 } 1384 }
1390 if (tty->termios.c_cflag & CRTSCTS) { 1385 if (C_CRTSCTS(tty)) {
1391 spin_lock_irqsave(&info->lock,flags); 1386 spin_lock_irqsave(&info->lock,flags);
1392 info->signals |= SerialSignal_RTS; 1387 info->signals |= SerialSignal_RTS;
1393 set_signals(info); 1388 set_signals(info);
@@ -3280,7 +3275,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
3280 return 0; 3275 return 0;
3281 } 3276 }
3282 3277
3283 if (tty->termios.c_cflag & CLOCAL) 3278 if (C_CLOCAL(tty))
3284 do_clocal = true; 3279 do_clocal = true;
3285 3280
3286 /* Wait for carrier detect and the line to become 3281 /* Wait for carrier detect and the line to become
diff --git a/drivers/tty/synclinkmp.c b/drivers/tty/synclinkmp.c
index fb00a06dfa4b..4b314b63a2ed 100644
--- a/drivers/tty/synclinkmp.c
+++ b/drivers/tty/synclinkmp.c
@@ -871,8 +871,7 @@ static void set_termios(struct tty_struct *tty, struct ktermios *old_termios)
871 change_params(info); 871 change_params(info);
872 872
873 /* Handle transition to B0 status */ 873 /* Handle transition to B0 status */
874 if (old_termios->c_cflag & CBAUD && 874 if ((old_termios->c_cflag & CBAUD) && !C_BAUD(tty)) {
875 !(tty->termios.c_cflag & CBAUD)) {
876 info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); 875 info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR);
877 spin_lock_irqsave(&info->lock,flags); 876 spin_lock_irqsave(&info->lock,flags);
878 set_signals(info); 877 set_signals(info);
@@ -880,21 +879,17 @@ static void set_termios(struct tty_struct *tty, struct ktermios *old_termios)
880 } 879 }
881 880
882 /* Handle transition away from B0 status */ 881 /* Handle transition away from B0 status */
883 if (!(old_termios->c_cflag & CBAUD) && 882 if (!(old_termios->c_cflag & CBAUD) && C_BAUD(tty)) {
884 tty->termios.c_cflag & CBAUD) {
885 info->serial_signals |= SerialSignal_DTR; 883 info->serial_signals |= SerialSignal_DTR;
886 if (!(tty->termios.c_cflag & CRTSCTS) || 884 if (!C_CRTSCTS(tty) || !test_bit(TTY_THROTTLED, &tty->flags))
887 !test_bit(TTY_THROTTLED, &tty->flags)) {
888 info->serial_signals |= SerialSignal_RTS; 885 info->serial_signals |= SerialSignal_RTS;
889 }
890 spin_lock_irqsave(&info->lock,flags); 886 spin_lock_irqsave(&info->lock,flags);
891 set_signals(info); 887 set_signals(info);
892 spin_unlock_irqrestore(&info->lock,flags); 888 spin_unlock_irqrestore(&info->lock,flags);
893 } 889 }
894 890
895 /* Handle turning off CRTSCTS */ 891 /* Handle turning off CRTSCTS */
896 if (old_termios->c_cflag & CRTSCTS && 892 if (old_termios->c_cflag & CRTSCTS && !C_CRTSCTS(tty)) {
897 !(tty->termios.c_cflag & CRTSCTS)) {
898 tty->hw_stopped = 0; 893 tty->hw_stopped = 0;
899 tx_release(tty); 894 tx_release(tty);
900 } 895 }
@@ -1472,7 +1467,7 @@ static void throttle(struct tty_struct * tty)
1472 if (I_IXOFF(tty)) 1467 if (I_IXOFF(tty))
1473 send_xchar(tty, STOP_CHAR(tty)); 1468 send_xchar(tty, STOP_CHAR(tty));
1474 1469
1475 if (tty->termios.c_cflag & CRTSCTS) { 1470 if (C_CRTSCTS(tty)) {
1476 spin_lock_irqsave(&info->lock,flags); 1471 spin_lock_irqsave(&info->lock,flags);
1477 info->serial_signals &= ~SerialSignal_RTS; 1472 info->serial_signals &= ~SerialSignal_RTS;
1478 set_signals(info); 1473 set_signals(info);
@@ -1501,7 +1496,7 @@ static void unthrottle(struct tty_struct * tty)
1501 send_xchar(tty, START_CHAR(tty)); 1496 send_xchar(tty, START_CHAR(tty));
1502 } 1497 }
1503 1498
1504 if (tty->termios.c_cflag & CRTSCTS) { 1499 if (C_CRTSCTS(tty)) {
1505 spin_lock_irqsave(&info->lock,flags); 1500 spin_lock_irqsave(&info->lock,flags);
1506 info->serial_signals |= SerialSignal_RTS; 1501 info->serial_signals |= SerialSignal_RTS;
1507 set_signals(info); 1502 set_signals(info);
@@ -3297,7 +3292,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
3297 return 0; 3292 return 0;
3298 } 3293 }
3299 3294
3300 if (tty->termios.c_cflag & CLOCAL) 3295 if (C_CLOCAL(tty))
3301 do_clocal = true; 3296 do_clocal = true;
3302 3297
3303 /* Wait for carrier detect and the line to become 3298 /* Wait for carrier detect and the line to become
diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c
index 0ea351388724..23bf5bb1d8bf 100644
--- a/drivers/tty/tty_ioctl.c
+++ b/drivers/tty/tty_ioctl.c
@@ -719,16 +719,16 @@ static int get_sgflags(struct tty_struct *tty)
719{ 719{
720 int flags = 0; 720 int flags = 0;
721 721
722 if (!(tty->termios.c_lflag & ICANON)) { 722 if (!L_ICANON(tty)) {
723 if (tty->termios.c_lflag & ISIG) 723 if (L_ISIG(tty))
724 flags |= 0x02; /* cbreak */ 724 flags |= 0x02; /* cbreak */
725 else 725 else
726 flags |= 0x20; /* raw */ 726 flags |= 0x20; /* raw */
727 } 727 }
728 if (tty->termios.c_lflag & ECHO) 728 if (L_ECHO(tty))
729 flags |= 0x08; /* echo */ 729 flags |= 0x08; /* echo */
730 if (tty->termios.c_oflag & OPOST) 730 if (O_OPOST(tty))
731 if (tty->termios.c_oflag & ONLCR) 731 if (O_ONLCR(tty))
732 flags |= 0x10; /* crmod */ 732 flags |= 0x10; /* crmod */
733 return flags; 733 return flags;
734} 734}
@@ -908,7 +908,7 @@ static int tty_change_softcar(struct tty_struct *tty, int arg)
908 tty->termios.c_cflag |= bit; 908 tty->termios.c_cflag |= bit;
909 if (tty->ops->set_termios) 909 if (tty->ops->set_termios)
910 tty->ops->set_termios(tty, &old); 910 tty->ops->set_termios(tty, &old);
911 if ((tty->termios.c_cflag & CLOCAL) != bit) 911 if (C_CLOCAL(tty) != bit)
912 ret = -EINVAL; 912 ret = -EINVAL;
913 up_write(&tty->termios_rwsem); 913 up_write(&tty->termios_rwsem);
914 return ret; 914 return ret;
diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c
index a76aec2ca480..0473fc7543f7 100644
--- a/drivers/tty/tty_port.c
+++ b/drivers/tty/tty_port.c
@@ -370,7 +370,7 @@ int tty_port_block_til_ready(struct tty_port *port,
370 } 370 }
371 if (filp->f_flags & O_NONBLOCK) { 371 if (filp->f_flags & O_NONBLOCK) {
372 /* Indicate we are open */ 372 /* Indicate we are open */
373 if (tty->termios.c_cflag & CBAUD) 373 if (C_BAUD(tty))
374 tty_port_raise_dtr_rts(port); 374 tty_port_raise_dtr_rts(port);
375 port->flags |= ASYNC_NORMAL_ACTIVE; 375 port->flags |= ASYNC_NORMAL_ACTIVE;
376 return 0; 376 return 0;
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
index 01bf53392819..b283eb8b86d6 100644
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
@@ -1165,8 +1165,7 @@ static void cypress_read_int_callback(struct urb *urb)
1165 1165
1166 /* hangup, as defined in acm.c... this might be a bad place for it 1166 /* hangup, as defined in acm.c... this might be a bad place for it
1167 * though */ 1167 * though */
1168 if (tty && !(tty->termios.c_cflag & CLOCAL) && 1168 if (tty && !C_CLOCAL(tty) && !(priv->current_status & UART_CD)) {
1169 !(priv->current_status & UART_CD)) {
1170 dev_dbg(dev, "%s - calling hangup\n", __func__); 1169 dev_dbg(dev, "%s - calling hangup\n", __func__);
1171 tty_hangup(tty); 1170 tty_hangup(tty);
1172 goto continue_read; 1171 goto continue_read;
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
index 12b0e67473ba..010a42a92688 100644
--- a/drivers/usb/serial/digi_acceleport.c
+++ b/drivers/usb/serial/digi_acceleport.c
@@ -695,11 +695,11 @@ static void digi_set_termios(struct tty_struct *tty,
695 arg = -1; 695 arg = -1;
696 696
697 /* reassert DTR and (maybe) RTS on transition from B0 */ 697 /* reassert DTR and (maybe) RTS on transition from B0 */
698 if ((old_cflag&CBAUD) == B0) { 698 if ((old_cflag & CBAUD) == B0) {
699 /* don't set RTS if using hardware flow control */ 699 /* don't set RTS if using hardware flow control */
700 /* and throttling input */ 700 /* and throttling input */
701 modem_signals = TIOCM_DTR; 701 modem_signals = TIOCM_DTR;
702 if (!(tty->termios.c_cflag & CRTSCTS) || 702 if (!C_CRTSCTS(tty) ||
703 !test_bit(TTY_THROTTLED, &tty->flags)) 703 !test_bit(TTY_THROTTLED, &tty->flags))
704 modem_signals |= TIOCM_RTS; 704 modem_signals |= TIOCM_RTS;
705 digi_set_modem_signals(port, modem_signals, 1); 705 digi_set_modem_signals(port, modem_signals, 1);
@@ -1491,8 +1491,8 @@ static int digi_read_oob_callback(struct urb *urb)
1491 1491
1492 rts = 0; 1492 rts = 0;
1493 if (tty) 1493 if (tty)
1494 rts = tty->termios.c_cflag & CRTSCTS; 1494 rts = C_CRTSCTS(tty);
1495 1495
1496 if (tty && opcode == DIGI_CMD_READ_INPUT_SIGNALS) { 1496 if (tty && opcode == DIGI_CMD_READ_INPUT_SIGNALS) {
1497 spin_lock(&priv->dp_port_lock); 1497 spin_lock(&priv->dp_port_lock);
1498 /* convert from digi flags to termiox flags */ 1498 /* convert from digi flags to termiox flags */
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index f49327d20ee8..f3007ecdd1b4 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -1398,7 +1398,7 @@ static void edge_throttle(struct tty_struct *tty)
1398 } 1398 }
1399 1399
1400 /* if we are implementing RTS/CTS, toggle that line */ 1400 /* if we are implementing RTS/CTS, toggle that line */
1401 if (tty->termios.c_cflag & CRTSCTS) { 1401 if (C_CRTSCTS(tty)) {
1402 edge_port->shadowMCR &= ~MCR_RTS; 1402 edge_port->shadowMCR &= ~MCR_RTS;
1403 status = send_cmd_write_uart_register(edge_port, MCR, 1403 status = send_cmd_write_uart_register(edge_port, MCR,
1404 edge_port->shadowMCR); 1404 edge_port->shadowMCR);
@@ -1435,7 +1435,7 @@ static void edge_unthrottle(struct tty_struct *tty)
1435 return; 1435 return;
1436 } 1436 }
1437 /* if we are implementing RTS/CTS, toggle that line */ 1437 /* if we are implementing RTS/CTS, toggle that line */
1438 if (tty->termios.c_cflag & CRTSCTS) { 1438 if (C_CRTSCTS(tty)) {
1439 edge_port->shadowMCR |= MCR_RTS; 1439 edge_port->shadowMCR |= MCR_RTS;
1440 send_cmd_write_uart_register(edge_port, MCR, 1440 send_cmd_write_uart_register(edge_port, MCR,
1441 edge_port->shadowMCR); 1441 edge_port->shadowMCR);
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
index fd707d6a10e2..4446b8d70ac2 100644
--- a/drivers/usb/serial/mct_u232.c
+++ b/drivers/usb/serial/mct_u232.c
@@ -428,7 +428,7 @@ static int mct_u232_open(struct tty_struct *tty, struct usb_serial_port *port)
428 * either. 428 * either.
429 */ 429 */
430 spin_lock_irqsave(&priv->lock, flags); 430 spin_lock_irqsave(&priv->lock, flags);
431 if (tty && (tty->termios.c_cflag & CBAUD)) 431 if (tty && C_BAUD(tty))
432 priv->control_state = TIOCM_DTR | TIOCM_RTS; 432 priv->control_state = TIOCM_DTR | TIOCM_RTS;
433 else 433 else
434 priv->control_state = 0; 434 priv->control_state = 0;
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index 78b4f64c6b00..2eddbe538cda 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -1308,7 +1308,7 @@ static void mos7720_throttle(struct tty_struct *tty)
1308 } 1308 }
1309 1309
1310 /* if we are implementing RTS/CTS, toggle that line */ 1310 /* if we are implementing RTS/CTS, toggle that line */
1311 if (tty->termios.c_cflag & CRTSCTS) { 1311 if (C_CRTSCTS(tty)) {
1312 mos7720_port->shadowMCR &= ~UART_MCR_RTS; 1312 mos7720_port->shadowMCR &= ~UART_MCR_RTS;
1313 write_mos_reg(port->serial, port->port_number, MOS7720_MCR, 1313 write_mos_reg(port->serial, port->port_number, MOS7720_MCR,
1314 mos7720_port->shadowMCR); 1314 mos7720_port->shadowMCR);
@@ -1338,7 +1338,7 @@ static void mos7720_unthrottle(struct tty_struct *tty)
1338 } 1338 }
1339 1339
1340 /* if we are implementing RTS/CTS, toggle that line */ 1340 /* if we are implementing RTS/CTS, toggle that line */
1341 if (tty->termios.c_cflag & CRTSCTS) { 1341 if (C_CRTSCTS(tty)) {
1342 mos7720_port->shadowMCR |= UART_MCR_RTS; 1342 mos7720_port->shadowMCR |= UART_MCR_RTS;
1343 write_mos_reg(port->serial, port->port_number, MOS7720_MCR, 1343 write_mos_reg(port->serial, port->port_number, MOS7720_MCR,
1344 mos7720_port->shadowMCR); 1344 mos7720_port->shadowMCR);
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 2c69bfcdacc6..02ea975754f5 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -1425,7 +1425,7 @@ static void mos7840_throttle(struct tty_struct *tty)
1425 return; 1425 return;
1426 } 1426 }
1427 /* if we are implementing RTS/CTS, toggle that line */ 1427 /* if we are implementing RTS/CTS, toggle that line */
1428 if (tty->termios.c_cflag & CRTSCTS) { 1428 if (C_CRTSCTS(tty)) {
1429 mos7840_port->shadowMCR &= ~MCR_RTS; 1429 mos7840_port->shadowMCR &= ~MCR_RTS;
1430 status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER, 1430 status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER,
1431 mos7840_port->shadowMCR); 1431 mos7840_port->shadowMCR);
@@ -1466,7 +1466,7 @@ static void mos7840_unthrottle(struct tty_struct *tty)
1466 } 1466 }
1467 1467
1468 /* if we are implementing RTS/CTS, toggle that line */ 1468 /* if we are implementing RTS/CTS, toggle that line */
1469 if (tty->termios.c_cflag & CRTSCTS) { 1469 if (C_CRTSCTS(tty)) {
1470 mos7840_port->shadowMCR |= MCR_RTS; 1470 mos7840_port->shadowMCR |= MCR_RTS;
1471 status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER, 1471 status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER,
1472 mos7840_port->shadowMCR); 1472 mos7840_port->shadowMCR);