aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2012-07-14 10:31:47 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-07-16 16:00:41 -0400
commitadc8d746caa67fff4b53ba3e5163a6cbacc3b523 (patch)
treee3f6c05f27c163b369ddd4da5f31d2a61bde6d3a /drivers/tty
parent6d31a88cb2e01d46c0cb74aa5da529e1f92ae3db (diff)
tty: move the termios object into the tty
This will let us sort out a whole pile of tty related races. The alternative would be to keep points and refcount the termios objects. However 1. They are tiny anyway 2. Many devices don't use the stored copies 3. We can remove a pty special case Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/amiserial.c20
-rw-r--r--drivers/tty/cyclades.c19
-rw-r--r--drivers/tty/hvc/hvsi_lib.c2
-rw-r--r--drivers/tty/isicom.c8
-rw-r--r--drivers/tty/moxa.c10
-rw-r--r--drivers/tty/mxser.c20
-rw-r--r--drivers/tty/n_gsm.c8
-rw-r--r--drivers/tty/n_tty.c2
-rw-r--r--drivers/tty/pty.c23
-rw-r--r--drivers/tty/rocket.c18
-rw-r--r--drivers/tty/serial/bfin_uart.c2
-rw-r--r--drivers/tty/serial/crisv10.c26
-rw-r--r--drivers/tty/serial/ioc4_serial.c2
-rw-r--r--drivers/tty/serial/jsm/jsm_tty.c8
-rw-r--r--drivers/tty/serial/samsung.c2
-rw-r--r--drivers/tty/serial/serial_core.c28
-rw-r--r--drivers/tty/synclink.c36
-rw-r--r--drivers/tty/synclink_gt.c24
-rw-r--r--drivers/tty/synclinkmp.c24
-rw-r--r--drivers/tty/tty_io.c26
-rw-r--r--drivers/tty/tty_ioctl.c124
-rw-r--r--drivers/tty/tty_ldisc.c10
-rw-r--r--drivers/tty/tty_port.c6
-rw-r--r--drivers/tty/vt/vt.c4
24 files changed, 214 insertions, 238 deletions
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
index 6cc4358f68c1..0e8441e73ee0 100644
--- a/drivers/tty/amiserial.c
+++ b/drivers/tty/amiserial.c
@@ -646,7 +646,7 @@ static void shutdown(struct tty_struct *tty, struct serial_state *info)
646 custom.adkcon = AC_UARTBRK; 646 custom.adkcon = AC_UARTBRK;
647 mb(); 647 mb();
648 648
649 if (tty->termios->c_cflag & HUPCL) 649 if (tty->termios.c_cflag & HUPCL)
650 info->MCR &= ~(SER_DTR|SER_RTS); 650 info->MCR &= ~(SER_DTR|SER_RTS);
651 rtsdtr_ctrl(info->MCR); 651 rtsdtr_ctrl(info->MCR);
652 652
@@ -670,7 +670,7 @@ static void change_speed(struct tty_struct *tty, struct serial_state *info,
670 int bits; 670 int bits;
671 unsigned long flags; 671 unsigned long flags;
672 672
673 cflag = tty->termios->c_cflag; 673 cflag = tty->termios.c_cflag;
674 674
675 /* Byte size is always 8 bits plus parity bit if requested */ 675 /* Byte size is always 8 bits plus parity bit if requested */
676 676
@@ -707,8 +707,8 @@ static void change_speed(struct tty_struct *tty, struct serial_state *info,
707 /* If the quotient is zero refuse the change */ 707 /* If the quotient is zero refuse the change */
708 if (!quot && old_termios) { 708 if (!quot && old_termios) {
709 /* FIXME: Will need updating for new tty in the end */ 709 /* FIXME: Will need updating for new tty in the end */
710 tty->termios->c_cflag &= ~CBAUD; 710 tty->termios.c_cflag &= ~CBAUD;
711 tty->termios->c_cflag |= (old_termios->c_cflag & CBAUD); 711 tty->termios.c_cflag |= (old_termios->c_cflag & CBAUD);
712 baud = tty_get_baud_rate(tty); 712 baud = tty_get_baud_rate(tty);
713 if (!baud) 713 if (!baud)
714 baud = 9600; 714 baud = 9600;
@@ -984,7 +984,7 @@ static void rs_throttle(struct tty_struct * tty)
984 if (I_IXOFF(tty)) 984 if (I_IXOFF(tty))
985 rs_send_xchar(tty, STOP_CHAR(tty)); 985 rs_send_xchar(tty, STOP_CHAR(tty));
986 986
987 if (tty->termios->c_cflag & CRTSCTS) 987 if (tty->termios.c_cflag & CRTSCTS)
988 info->MCR &= ~SER_RTS; 988 info->MCR &= ~SER_RTS;
989 989
990 local_irq_save(flags); 990 local_irq_save(flags);
@@ -1012,7 +1012,7 @@ static void rs_unthrottle(struct tty_struct * tty)
1012 else 1012 else
1013 rs_send_xchar(tty, START_CHAR(tty)); 1013 rs_send_xchar(tty, START_CHAR(tty));
1014 } 1014 }
1015 if (tty->termios->c_cflag & CRTSCTS) 1015 if (tty->termios.c_cflag & CRTSCTS)
1016 info->MCR |= SER_RTS; 1016 info->MCR |= SER_RTS;
1017 local_irq_save(flags); 1017 local_irq_save(flags);
1018 rtsdtr_ctrl(info->MCR); 1018 rtsdtr_ctrl(info->MCR);
@@ -1330,7 +1330,7 @@ static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
1330{ 1330{
1331 struct serial_state *info = tty->driver_data; 1331 struct serial_state *info = tty->driver_data;
1332 unsigned long flags; 1332 unsigned long flags;
1333 unsigned int cflag = tty->termios->c_cflag; 1333 unsigned int cflag = tty->termios.c_cflag;
1334 1334
1335 change_speed(tty, info, old_termios); 1335 change_speed(tty, info, old_termios);
1336 1336
@@ -1347,7 +1347,7 @@ static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
1347 if (!(old_termios->c_cflag & CBAUD) && 1347 if (!(old_termios->c_cflag & CBAUD) &&
1348 (cflag & CBAUD)) { 1348 (cflag & CBAUD)) {
1349 info->MCR |= SER_DTR; 1349 info->MCR |= SER_DTR;
1350 if (!(tty->termios->c_cflag & CRTSCTS) || 1350 if (!(tty->termios.c_cflag & CRTSCTS) ||
1351 !test_bit(TTY_THROTTLED, &tty->flags)) { 1351 !test_bit(TTY_THROTTLED, &tty->flags)) {
1352 info->MCR |= SER_RTS; 1352 info->MCR |= SER_RTS;
1353 } 1353 }
@@ -1358,7 +1358,7 @@ static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
1358 1358
1359 /* Handle turning off CRTSCTS */ 1359 /* Handle turning off CRTSCTS */
1360 if ((old_termios->c_cflag & CRTSCTS) && 1360 if ((old_termios->c_cflag & CRTSCTS) &&
1361 !(tty->termios->c_cflag & CRTSCTS)) { 1361 !(tty->termios.c_cflag & CRTSCTS)) {
1362 tty->hw_stopped = 0; 1362 tty->hw_stopped = 0;
1363 rs_start(tty); 1363 rs_start(tty);
1364 } 1364 }
@@ -1371,7 +1371,7 @@ static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
1371 * or not. Hence, this may change..... 1371 * or not. Hence, this may change.....
1372 */ 1372 */
1373 if (!(old_termios->c_cflag & CLOCAL) && 1373 if (!(old_termios->c_cflag & CLOCAL) &&
1374 (tty->termios->c_cflag & CLOCAL)) 1374 (tty->termios.c_cflag & CLOCAL))
1375 wake_up_interruptible(&info->open_wait); 1375 wake_up_interruptible(&info->open_wait);
1376#endif 1376#endif
1377} 1377}
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
index cff546839db9..e77db714ab26 100644
--- a/drivers/tty/cyclades.c
+++ b/drivers/tty/cyclades.c
@@ -1459,7 +1459,7 @@ static void cy_shutdown(struct cyclades_port *info, struct tty_struct *tty)
1459 info->port.xmit_buf = NULL; 1459 info->port.xmit_buf = NULL;
1460 free_page((unsigned long)temp); 1460 free_page((unsigned long)temp);
1461 } 1461 }
1462 if (tty->termios->c_cflag & HUPCL) 1462 if (tty->termios.c_cflag & HUPCL)
1463 cyy_change_rts_dtr(info, 0, TIOCM_RTS | TIOCM_DTR); 1463 cyy_change_rts_dtr(info, 0, TIOCM_RTS | TIOCM_DTR);
1464 1464
1465 cyy_issue_cmd(info, CyCHAN_CTL | CyDIS_RCVR); 1465 cyy_issue_cmd(info, CyCHAN_CTL | CyDIS_RCVR);
@@ -1488,7 +1488,7 @@ static void cy_shutdown(struct cyclades_port *info, struct tty_struct *tty)
1488 free_page((unsigned long)temp); 1488 free_page((unsigned long)temp);
1489 } 1489 }
1490 1490
1491 if (tty->termios->c_cflag & HUPCL) 1491 if (tty->termios.c_cflag & HUPCL)
1492 tty_port_lower_dtr_rts(&info->port); 1492 tty_port_lower_dtr_rts(&info->port);
1493 1493
1494 set_bit(TTY_IO_ERROR, &tty->flags); 1494 set_bit(TTY_IO_ERROR, &tty->flags);
@@ -1999,14 +1999,11 @@ static void cy_set_line_char(struct cyclades_port *info, struct tty_struct *tty)
1999 int baud, baud_rate = 0; 1999 int baud, baud_rate = 0;
2000 int i; 2000 int i;
2001 2001
2002 if (!tty->termios) /* XXX can this happen at all? */
2003 return;
2004
2005 if (info->line == -1) 2002 if (info->line == -1)
2006 return; 2003 return;
2007 2004
2008 cflag = tty->termios->c_cflag; 2005 cflag = tty->termios.c_cflag;
2009 iflag = tty->termios->c_iflag; 2006 iflag = tty->termios.c_iflag;
2010 2007
2011 /* 2008 /*
2012 * Set up the tty->alt_speed kludge 2009 * Set up the tty->alt_speed kludge
@@ -2825,7 +2822,7 @@ static void cy_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
2825 cy_set_line_char(info, tty); 2822 cy_set_line_char(info, tty);
2826 2823
2827 if ((old_termios->c_cflag & CRTSCTS) && 2824 if ((old_termios->c_cflag & CRTSCTS) &&
2828 !(tty->termios->c_cflag & CRTSCTS)) { 2825 !(tty->termios.c_cflag & CRTSCTS)) {
2829 tty->hw_stopped = 0; 2826 tty->hw_stopped = 0;
2830 cy_start(tty); 2827 cy_start(tty);
2831 } 2828 }
@@ -2837,7 +2834,7 @@ static void cy_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
2837 * or not. Hence, this may change..... 2834 * or not. Hence, this may change.....
2838 */ 2835 */
2839 if (!(old_termios->c_cflag & CLOCAL) && 2836 if (!(old_termios->c_cflag & CLOCAL) &&
2840 (tty->termios->c_cflag & CLOCAL)) 2837 (tty->termios.c_cflag & CLOCAL))
2841 wake_up_interruptible(&info->port.open_wait); 2838 wake_up_interruptible(&info->port.open_wait);
2842#endif 2839#endif
2843} /* cy_set_termios */ 2840} /* cy_set_termios */
@@ -2899,7 +2896,7 @@ static void cy_throttle(struct tty_struct *tty)
2899 info->throttle = 1; 2896 info->throttle = 1;
2900 } 2897 }
2901 2898
2902 if (tty->termios->c_cflag & CRTSCTS) { 2899 if (tty->termios.c_cflag & CRTSCTS) {
2903 if (!cy_is_Z(card)) { 2900 if (!cy_is_Z(card)) {
2904 spin_lock_irqsave(&card->card_lock, flags); 2901 spin_lock_irqsave(&card->card_lock, flags);
2905 cyy_change_rts_dtr(info, 0, TIOCM_RTS); 2902 cyy_change_rts_dtr(info, 0, TIOCM_RTS);
@@ -2938,7 +2935,7 @@ static void cy_unthrottle(struct tty_struct *tty)
2938 cy_send_xchar(tty, START_CHAR(tty)); 2935 cy_send_xchar(tty, START_CHAR(tty));
2939 } 2936 }
2940 2937
2941 if (tty->termios->c_cflag & CRTSCTS) { 2938 if (tty->termios.c_cflag & CRTSCTS) {
2942 card = info->card; 2939 card = info->card;
2943 if (!cy_is_Z(card)) { 2940 if (!cy_is_Z(card)) {
2944 spin_lock_irqsave(&card->card_lock, flags); 2941 spin_lock_irqsave(&card->card_lock, flags);
diff --git a/drivers/tty/hvc/hvsi_lib.c b/drivers/tty/hvc/hvsi_lib.c
index 59c135dd5d20..3396eb9d57a3 100644
--- a/drivers/tty/hvc/hvsi_lib.c
+++ b/drivers/tty/hvc/hvsi_lib.c
@@ -400,7 +400,7 @@ void hvsilib_close(struct hvsi_priv *pv, struct hvc_struct *hp)
400 spin_unlock_irqrestore(&hp->lock, flags); 400 spin_unlock_irqrestore(&hp->lock, flags);
401 401
402 /* Clear our own DTR */ 402 /* Clear our own DTR */
403 if (!pv->tty || (pv->tty->termios->c_cflag & HUPCL)) 403 if (!pv->tty || (pv->tty->termios.c_cflag & HUPCL))
404 hvsilib_write_mctrl(pv, 0); 404 hvsilib_write_mctrl(pv, 0);
405 405
406 /* Tear down the connection */ 406 /* Tear down the connection */
diff --git a/drivers/tty/isicom.c b/drivers/tty/isicom.c
index e1235accab74..d593a7d18ad5 100644
--- a/drivers/tty/isicom.c
+++ b/drivers/tty/isicom.c
@@ -702,7 +702,7 @@ static void isicom_config_port(struct tty_struct *tty)
702 702
703 /* 1,2,3,4 => 57.6, 115.2, 230, 460 kbps resp. */ 703 /* 1,2,3,4 => 57.6, 115.2, 230, 460 kbps resp. */
704 if (baud < 1 || baud > 4) 704 if (baud < 1 || baud > 4)
705 tty->termios->c_cflag &= ~CBAUDEX; 705 tty->termios.c_cflag &= ~CBAUDEX;
706 else 706 else
707 baud += 15; 707 baud += 15;
708 } 708 }
@@ -1196,8 +1196,8 @@ static void isicom_set_termios(struct tty_struct *tty,
1196 if (isicom_paranoia_check(port, tty->name, "isicom_set_termios")) 1196 if (isicom_paranoia_check(port, tty->name, "isicom_set_termios"))
1197 return; 1197 return;
1198 1198
1199 if (tty->termios->c_cflag == old_termios->c_cflag && 1199 if (tty->termios.c_cflag == old_termios->c_cflag &&
1200 tty->termios->c_iflag == old_termios->c_iflag) 1200 tty->termios.c_iflag == old_termios->c_iflag)
1201 return; 1201 return;
1202 1202
1203 spin_lock_irqsave(&port->card->card_lock, flags); 1203 spin_lock_irqsave(&port->card->card_lock, flags);
@@ -1205,7 +1205,7 @@ static void isicom_set_termios(struct tty_struct *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) &&
1208 !(tty->termios->c_cflag & CRTSCTS)) { 1208 !(tty->termios.c_cflag & CRTSCTS)) {
1209 tty->hw_stopped = 0; 1209 tty->hw_stopped = 0;
1210 isicom_start(tty); 1210 isicom_start(tty);
1211 } 1211 }
diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c
index 324467d28a54..89cc9344325b 100644
--- a/drivers/tty/moxa.c
+++ b/drivers/tty/moxa.c
@@ -367,10 +367,10 @@ static int moxa_ioctl(struct tty_struct *tty,
367 tmp.dcd = 1; 367 tmp.dcd = 1;
368 368
369 ttyp = tty_port_tty_get(&p->port); 369 ttyp = tty_port_tty_get(&p->port);
370 if (!ttyp || !ttyp->termios) 370 if (!ttyp)
371 tmp.cflag = p->cflag; 371 tmp.cflag = p->cflag;
372 else 372 else
373 tmp.cflag = ttyp->termios->c_cflag; 373 tmp.cflag = ttyp->termios.c_cflag;
374 tty_kref_put(ttyp); 374 tty_kref_put(ttyp);
375copy: 375copy:
376 if (copy_to_user(argm, &tmp, sizeof(tmp))) 376 if (copy_to_user(argm, &tmp, sizeof(tmp)))
@@ -1178,7 +1178,7 @@ static int moxa_open(struct tty_struct *tty, struct file *filp)
1178 mutex_lock(&ch->port.mutex); 1178 mutex_lock(&ch->port.mutex);
1179 if (!(ch->port.flags & ASYNC_INITIALIZED)) { 1179 if (!(ch->port.flags & ASYNC_INITIALIZED)) {
1180 ch->statusflags = 0; 1180 ch->statusflags = 0;
1181 moxa_set_tty_param(tty, tty->termios); 1181 moxa_set_tty_param(tty, &tty->termios);
1182 MoxaPortLineCtrl(ch, 1, 1); 1182 MoxaPortLineCtrl(ch, 1, 1);
1183 MoxaPortEnable(ch); 1183 MoxaPortEnable(ch);
1184 MoxaSetFifo(ch, ch->type == PORT_16550A); 1184 MoxaSetFifo(ch, ch->type == PORT_16550A);
@@ -1193,7 +1193,7 @@ static int moxa_open(struct tty_struct *tty, struct file *filp)
1193static void moxa_close(struct tty_struct *tty, struct file *filp) 1193static void moxa_close(struct tty_struct *tty, struct file *filp)
1194{ 1194{
1195 struct moxa_port *ch = tty->driver_data; 1195 struct moxa_port *ch = tty->driver_data;
1196 ch->cflag = tty->termios->c_cflag; 1196 ch->cflag = tty->termios.c_cflag;
1197 tty_port_close(&ch->port, tty, filp); 1197 tty_port_close(&ch->port, tty, filp);
1198} 1198}
1199 1199
@@ -1464,7 +1464,7 @@ static void moxa_poll(unsigned long ignored)
1464 1464
1465static void moxa_set_tty_param(struct tty_struct *tty, struct ktermios *old_termios) 1465static void moxa_set_tty_param(struct tty_struct *tty, struct ktermios *old_termios)
1466{ 1466{
1467 register struct ktermios *ts = tty->termios; 1467 register struct ktermios *ts = &tty->termios;
1468 struct moxa_port *ch = tty->driver_data; 1468 struct moxa_port *ch = tty->driver_data;
1469 int rts, cts, txflow, rxflow, xany, baud; 1469 int rts, cts, txflow, rxflow, xany, baud;
1470 1470
diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c
index 90cc680c4f0e..c162ee931167 100644
--- a/drivers/tty/mxser.c
+++ b/drivers/tty/mxser.c
@@ -643,7 +643,7 @@ static int mxser_change_speed(struct tty_struct *tty,
643 int ret = 0; 643 int ret = 0;
644 unsigned char status; 644 unsigned char status;
645 645
646 cflag = tty->termios->c_cflag; 646 cflag = tty->termios.c_cflag;
647 if (!info->ioaddr) 647 if (!info->ioaddr)
648 return ret; 648 return ret;
649 649
@@ -1520,10 +1520,10 @@ static int mxser_ioctl_special(unsigned int cmd, void __user *argp)
1520 1520
1521 tty = tty_port_tty_get(port); 1521 tty = tty_port_tty_get(port);
1522 1522
1523 if (!tty || !tty->termios) 1523 if (!tty)
1524 ms.cflag = ip->normal_termios.c_cflag; 1524 ms.cflag = ip->normal_termios.c_cflag;
1525 else 1525 else
1526 ms.cflag = tty->termios->c_cflag; 1526 ms.cflag = tty->termios.c_cflag;
1527 tty_kref_put(tty); 1527 tty_kref_put(tty);
1528 spin_lock_irq(&ip->slock); 1528 spin_lock_irq(&ip->slock);
1529 status = inb(ip->ioaddr + UART_MSR); 1529 status = inb(ip->ioaddr + UART_MSR);
@@ -1589,13 +1589,13 @@ static int mxser_ioctl_special(unsigned int cmd, void __user *argp)
1589 1589
1590 tty = tty_port_tty_get(&ip->port); 1590 tty = tty_port_tty_get(&ip->port);
1591 1591
1592 if (!tty || !tty->termios) { 1592 if (!tty) {
1593 cflag = ip->normal_termios.c_cflag; 1593 cflag = ip->normal_termios.c_cflag;
1594 iflag = ip->normal_termios.c_iflag; 1594 iflag = ip->normal_termios.c_iflag;
1595 me->baudrate[p] = tty_termios_baud_rate(&ip->normal_termios); 1595 me->baudrate[p] = tty_termios_baud_rate(&ip->normal_termios);
1596 } else { 1596 } else {
1597 cflag = tty->termios->c_cflag; 1597 cflag = tty->termios.c_cflag;
1598 iflag = tty->termios->c_iflag; 1598 iflag = tty->termios.c_iflag;
1599 me->baudrate[p] = tty_get_baud_rate(tty); 1599 me->baudrate[p] = tty_get_baud_rate(tty);
1600 } 1600 }
1601 tty_kref_put(tty); 1601 tty_kref_put(tty);
@@ -1853,7 +1853,7 @@ static void mxser_stoprx(struct tty_struct *tty)
1853 } 1853 }
1854 } 1854 }
1855 1855
1856 if (tty->termios->c_cflag & CRTSCTS) { 1856 if (tty->termios.c_cflag & CRTSCTS) {
1857 info->MCR &= ~UART_MCR_RTS; 1857 info->MCR &= ~UART_MCR_RTS;
1858 outb(info->MCR, info->ioaddr + UART_MCR); 1858 outb(info->MCR, info->ioaddr + UART_MCR);
1859 } 1859 }
@@ -1890,7 +1890,7 @@ static void mxser_unthrottle(struct tty_struct *tty)
1890 } 1890 }
1891 } 1891 }
1892 1892
1893 if (tty->termios->c_cflag & CRTSCTS) { 1893 if (tty->termios.c_cflag & CRTSCTS) {
1894 info->MCR |= UART_MCR_RTS; 1894 info->MCR |= UART_MCR_RTS;
1895 outb(info->MCR, info->ioaddr + UART_MCR); 1895 outb(info->MCR, info->ioaddr + UART_MCR);
1896 } 1896 }
@@ -1939,14 +1939,14 @@ static void mxser_set_termios(struct tty_struct *tty, struct ktermios *old_termi
1939 spin_unlock_irqrestore(&info->slock, flags); 1939 spin_unlock_irqrestore(&info->slock, flags);
1940 1940
1941 if ((old_termios->c_cflag & CRTSCTS) && 1941 if ((old_termios->c_cflag & CRTSCTS) &&
1942 !(tty->termios->c_cflag & CRTSCTS)) { 1942 !(tty->termios.c_cflag & CRTSCTS)) {
1943 tty->hw_stopped = 0; 1943 tty->hw_stopped = 0;
1944 mxser_start(tty); 1944 mxser_start(tty);
1945 } 1945 }
1946 1946
1947 /* Handle sw stopped */ 1947 /* Handle sw stopped */
1948 if ((old_termios->c_iflag & IXON) && 1948 if ((old_termios->c_iflag & IXON) &&
1949 !(tty->termios->c_iflag & IXON)) { 1949 !(tty->termios.c_iflag & IXON)) {
1950 tty->stopped = 0; 1950 tty->stopped = 0;
1951 1951
1952 if (info->board->chip_flag) { 1952 if (info->board->chip_flag) {
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index c43b683b6eb8..7a4bf3053a15 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -1061,7 +1061,7 @@ static void gsm_process_modem(struct tty_struct *tty, struct gsm_dlci *dlci,
1061 /* Carrier drop -> hangup */ 1061 /* Carrier drop -> hangup */
1062 if (tty) { 1062 if (tty) {
1063 if ((mlines & TIOCM_CD) == 0 && (dlci->modem_rx & TIOCM_CD)) 1063 if ((mlines & TIOCM_CD) == 0 && (dlci->modem_rx & TIOCM_CD))
1064 if (!(tty->termios->c_cflag & CLOCAL)) 1064 if (!(tty->termios.c_cflag & CLOCAL))
1065 tty_hangup(tty); 1065 tty_hangup(tty);
1066 if (brk & 0x01) 1066 if (brk & 0x01)
1067 tty_insert_flip_char(tty, 0, TTY_BREAK); 1067 tty_insert_flip_char(tty, 0, TTY_BREAK);
@@ -3043,13 +3043,13 @@ static void gsmtty_set_termios(struct tty_struct *tty, struct ktermios *old)
3043 the RPN control message. This however rapidly gets nasty as we 3043 the RPN control message. This however rapidly gets nasty as we
3044 then have to remap modem signals each way according to whether 3044 then have to remap modem signals each way according to whether
3045 our virtual cable is null modem etc .. */ 3045 our virtual cable is null modem etc .. */
3046 tty_termios_copy_hw(tty->termios, old); 3046 tty_termios_copy_hw(&tty->termios, old);
3047} 3047}
3048 3048
3049static void gsmtty_throttle(struct tty_struct *tty) 3049static void gsmtty_throttle(struct tty_struct *tty)
3050{ 3050{
3051 struct gsm_dlci *dlci = tty->driver_data; 3051 struct gsm_dlci *dlci = tty->driver_data;
3052 if (tty->termios->c_cflag & CRTSCTS) 3052 if (tty->termios.c_cflag & CRTSCTS)
3053 dlci->modem_tx &= ~TIOCM_DTR; 3053 dlci->modem_tx &= ~TIOCM_DTR;
3054 dlci->throttled = 1; 3054 dlci->throttled = 1;
3055 /* Send an MSC with DTR cleared */ 3055 /* Send an MSC with DTR cleared */
@@ -3059,7 +3059,7 @@ static void gsmtty_throttle(struct tty_struct *tty)
3059static void gsmtty_unthrottle(struct tty_struct *tty) 3059static void gsmtty_unthrottle(struct tty_struct *tty)
3060{ 3060{
3061 struct gsm_dlci *dlci = tty->driver_data; 3061 struct gsm_dlci *dlci = tty->driver_data;
3062 if (tty->termios->c_cflag & CRTSCTS) 3062 if (tty->termios.c_cflag & CRTSCTS)
3063 dlci->modem_tx |= TIOCM_DTR; 3063 dlci->modem_tx |= TIOCM_DTR;
3064 dlci->throttled = 0; 3064 dlci->throttled = 0;
3065 /* Send an MSC with DTR set */ 3065 /* Send an MSC with DTR set */
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 4f34491b65c6..101790cea4ae 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -1466,7 +1466,7 @@ static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
1466 BUG_ON(!tty); 1466 BUG_ON(!tty);
1467 1467
1468 if (old) 1468 if (old)
1469 canon_change = (old->c_lflag ^ tty->termios->c_lflag) & ICANON; 1469 canon_change = (old->c_lflag ^ tty->termios.c_lflag) & ICANON;
1470 if (canon_change) { 1470 if (canon_change) {
1471 memset(&tty->read_flags, 0, sizeof tty->read_flags); 1471 memset(&tty->read_flags, 0, sizeof tty->read_flags);
1472 tty->canon_head = tty->read_tail; 1472 tty->canon_head = tty->read_tail;
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index b50fc1c01415..5ad7ccc49f74 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -231,8 +231,8 @@ out:
231static void pty_set_termios(struct tty_struct *tty, 231static void pty_set_termios(struct tty_struct *tty,
232 struct ktermios *old_termios) 232 struct ktermios *old_termios)
233{ 233{
234 tty->termios->c_cflag &= ~(CSIZE | PARENB); 234 tty->termios.c_cflag &= ~(CSIZE | PARENB);
235 tty->termios->c_cflag |= (CS8 | CREAD); 235 tty->termios.c_cflag |= (CS8 | CREAD);
236} 236}
237 237
238/** 238/**
@@ -315,18 +315,10 @@ static int pty_common_install(struct tty_driver *driver, struct tty_struct *tty,
315 driver->other->ttys[idx] = o_tty; 315 driver->other->ttys[idx] = o_tty;
316 driver->ttys[idx] = tty; 316 driver->ttys[idx] = tty;
317 } else { 317 } else {
318 tty->termios = kzalloc(sizeof(struct ktermios[2]), GFP_KERNEL); 318 memset(&tty->termios_locked, 0, sizeof(tty->termios_locked));
319 if (tty->termios == NULL) 319 tty->termios = driver->init_termios;
320 goto err_deinit_tty; 320 memset(&o_tty->termios_locked, 0, sizeof(tty->termios_locked));
321 *tty->termios = driver->init_termios; 321 o_tty->termios = driver->other->init_termios;
322 tty->termios_locked = tty->termios + 1;
323
324 o_tty->termios = kzalloc(sizeof(struct ktermios[2]),
325 GFP_KERNEL);
326 if (o_tty->termios == NULL)
327 goto err_free_termios;
328 *o_tty->termios = driver->other->init_termios;
329 o_tty->termios_locked = o_tty->termios + 1;
330 } 322 }
331 323
332 /* 324 /*
@@ -349,8 +341,6 @@ static int pty_common_install(struct tty_driver *driver, struct tty_struct *tty,
349err_free_termios: 341err_free_termios:
350 if (legacy) 342 if (legacy)
351 tty_free_termios(tty); 343 tty_free_termios(tty);
352 else
353 kfree(tty->termios);
354err_deinit_tty: 344err_deinit_tty:
355 deinitialize_tty_struct(o_tty); 345 deinitialize_tty_struct(o_tty);
356 module_put(o_tty->driver->owner); 346 module_put(o_tty->driver->owner);
@@ -541,7 +531,6 @@ static void pty_unix98_shutdown(struct tty_struct *tty)
541{ 531{
542 tty_driver_remove_tty(tty->driver, tty); 532 tty_driver_remove_tty(tty->driver, tty);
543 /* We have our own method as we don't use the tty index */ 533 /* We have our own method as we don't use the tty index */
544 kfree(tty->termios);
545} 534}
546 535
547/* We have no need to install and remove our tty objects as devpts does all 536/* We have no need to install and remove our tty objects as devpts does all
diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c
index 777d5f9cf6cc..016984a460e0 100644
--- a/drivers/tty/rocket.c
+++ b/drivers/tty/rocket.c
@@ -720,7 +720,7 @@ static void configure_r_port(struct tty_struct *tty, struct r_port *info,
720 unsigned rocketMode; 720 unsigned rocketMode;
721 int bits, baud, divisor; 721 int bits, baud, divisor;
722 CHANNEL_t *cp; 722 CHANNEL_t *cp;
723 struct ktermios *t = tty->termios; 723 struct ktermios *t = &tty->termios;
724 724
725 cp = &info->channel; 725 cp = &info->channel;
726 cflag = t->c_cflag; 726 cflag = t->c_cflag;
@@ -978,7 +978,7 @@ static int rp_open(struct tty_struct *tty, struct file *filp)
978 tty->alt_speed = 460800; 978 tty->alt_speed = 460800;
979 979
980 configure_r_port(tty, info, NULL); 980 configure_r_port(tty, info, NULL);
981 if (tty->termios->c_cflag & CBAUD) { 981 if (tty->termios.c_cflag & CBAUD) {
982 sSetDTR(cp); 982 sSetDTR(cp);
983 sSetRTS(cp); 983 sSetRTS(cp);
984 } 984 }
@@ -1089,35 +1089,35 @@ static void rp_set_termios(struct tty_struct *tty,
1089 if (rocket_paranoia_check(info, "rp_set_termios")) 1089 if (rocket_paranoia_check(info, "rp_set_termios"))
1090 return; 1090 return;
1091 1091
1092 cflag = tty->termios->c_cflag; 1092 cflag = tty->termios.c_cflag;
1093 1093
1094 /* 1094 /*
1095 * This driver doesn't support CS5 or CS6 1095 * This driver doesn't support CS5 or CS6
1096 */ 1096 */
1097 if (((cflag & CSIZE) == CS5) || ((cflag & CSIZE) == CS6)) 1097 if (((cflag & CSIZE) == CS5) || ((cflag & CSIZE) == CS6))
1098 tty->termios->c_cflag = 1098 tty->termios.c_cflag =
1099 ((cflag & ~CSIZE) | (old_termios->c_cflag & CSIZE)); 1099 ((cflag & ~CSIZE) | (old_termios->c_cflag & CSIZE));
1100 /* Or CMSPAR */ 1100 /* Or CMSPAR */
1101 tty->termios->c_cflag &= ~CMSPAR; 1101 tty->termios.c_cflag &= ~CMSPAR;
1102 1102
1103 configure_r_port(tty, info, old_termios); 1103 configure_r_port(tty, info, old_termios);
1104 1104
1105 cp = &info->channel; 1105 cp = &info->channel;
1106 1106
1107 /* Handle transition to B0 status */ 1107 /* Handle transition to B0 status */
1108 if ((old_termios->c_cflag & CBAUD) && !(tty->termios->c_cflag & CBAUD)) { 1108 if ((old_termios->c_cflag & CBAUD) && !(tty->termios.c_cflag & CBAUD)) {
1109 sClrDTR(cp); 1109 sClrDTR(cp);
1110 sClrRTS(cp); 1110 sClrRTS(cp);
1111 } 1111 }
1112 1112
1113 /* Handle transition away from B0 status */ 1113 /* Handle transition away from B0 status */
1114 if (!(old_termios->c_cflag & CBAUD) && (tty->termios->c_cflag & CBAUD)) { 1114 if (!(old_termios->c_cflag & CBAUD) && (tty->termios.c_cflag & CBAUD)) {
1115 if (!tty->hw_stopped || !(tty->termios->c_cflag & CRTSCTS)) 1115 if (!tty->hw_stopped || !(tty->termios.c_cflag & CRTSCTS))
1116 sSetRTS(cp); 1116 sSetRTS(cp);
1117 sSetDTR(cp); 1117 sSetDTR(cp);
1118 } 1118 }
1119 1119
1120 if ((old_termios->c_cflag & CRTSCTS) && !(tty->termios->c_cflag & CRTSCTS)) { 1120 if ((old_termios->c_cflag & CRTSCTS) && !(tty->termios.c_cflag & CRTSCTS)) {
1121 tty->hw_stopped = 0; 1121 tty->hw_stopped = 0;
1122 rp_start(tty); 1122 rp_start(tty);
1123 } 1123 }
diff --git a/drivers/tty/serial/bfin_uart.c b/drivers/tty/serial/bfin_uart.c
index bd97db23985b..9242d56ba267 100644
--- a/drivers/tty/serial/bfin_uart.c
+++ b/drivers/tty/serial/bfin_uart.c
@@ -182,7 +182,7 @@ static void bfin_serial_start_tx(struct uart_port *port)
182 * To avoid losting RX interrupt, we reset IR function 182 * To avoid losting RX interrupt, we reset IR function
183 * before sending data. 183 * before sending data.
184 */ 184 */
185 if (tty->termios->c_line == N_IRDA) 185 if (tty->termios.c_line == N_IRDA)
186 bfin_serial_reset_irda(port); 186 bfin_serial_reset_irda(port);
187 187
188#ifdef CONFIG_SERIAL_BFIN_DMA 188#ifdef CONFIG_SERIAL_BFIN_DMA
diff --git a/drivers/tty/serial/crisv10.c b/drivers/tty/serial/crisv10.c
index 80b6b1b1f725..6b705b243522 100644
--- a/drivers/tty/serial/crisv10.c
+++ b/drivers/tty/serial/crisv10.c
@@ -955,7 +955,7 @@ static const struct control_pins e100_modem_pins[NR_PORTS] =
955/* Calculate the chartime depending on baudrate, numbor of bits etc. */ 955/* Calculate the chartime depending on baudrate, numbor of bits etc. */
956static void update_char_time(struct e100_serial * info) 956static void update_char_time(struct e100_serial * info)
957{ 957{
958 tcflag_t cflags = info->port.tty->termios->c_cflag; 958 tcflag_t cflags = info->port.tty->termios.c_cflag;
959 int bits; 959 int bits;
960 960
961 /* calc. number of bits / data byte */ 961 /* calc. number of bits / data byte */
@@ -1473,7 +1473,7 @@ rs_stop(struct tty_struct *tty)
1473 xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, 1473 xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char,
1474 STOP_CHAR(info->port.tty)); 1474 STOP_CHAR(info->port.tty));
1475 xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, stop); 1475 xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, stop);
1476 if (tty->termios->c_iflag & IXON ) { 1476 if (tty->termios.c_iflag & IXON ) {
1477 xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable); 1477 xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable);
1478 } 1478 }
1479 1479
@@ -1496,7 +1496,7 @@ rs_start(struct tty_struct *tty)
1496 info->xmit.tail,SERIAL_XMIT_SIZE))); 1496 info->xmit.tail,SERIAL_XMIT_SIZE)));
1497 xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, STOP_CHAR(tty)); 1497 xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, STOP_CHAR(tty));
1498 xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, enable); 1498 xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, enable);
1499 if (tty->termios->c_iflag & IXON ) { 1499 if (tty->termios.c_iflag & IXON ) {
1500 xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable); 1500 xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable);
1501 } 1501 }
1502 1502
@@ -2929,7 +2929,7 @@ shutdown(struct e100_serial * info)
2929 descr[i].buf = 0; 2929 descr[i].buf = 0;
2930 } 2930 }
2931 2931
2932 if (!info->port.tty || (info->port.tty->termios->c_cflag & HUPCL)) { 2932 if (!info->port.tty || (info->port.tty->termios.c_cflag & HUPCL)) {
2933 /* hang up DTR and RTS if HUPCL is enabled */ 2933 /* hang up DTR and RTS if HUPCL is enabled */
2934 e100_dtr(info, 0); 2934 e100_dtr(info, 0);
2935 e100_rts(info, 0); /* could check CRTSCTS before doing this */ 2935 e100_rts(info, 0); /* could check CRTSCTS before doing this */
@@ -2953,12 +2953,12 @@ change_speed(struct e100_serial *info)
2953 unsigned long flags; 2953 unsigned long flags;
2954 /* first some safety checks */ 2954 /* first some safety checks */
2955 2955
2956 if (!info->port.tty || !info->port.tty->termios) 2956 if (!info->port.tty)
2957 return; 2957 return;
2958 if (!info->ioport) 2958 if (!info->ioport)
2959 return; 2959 return;
2960 2960
2961 cflag = info->port.tty->termios->c_cflag; 2961 cflag = info->port.tty->termios.c_cflag;
2962 2962
2963 /* possibly, the tx/rx should be disabled first to do this safely */ 2963 /* possibly, the tx/rx should be disabled first to do this safely */
2964 2964
@@ -3088,7 +3088,7 @@ change_speed(struct e100_serial *info)
3088 info->ioport[REG_REC_CTRL] = info->rx_ctrl; 3088 info->ioport[REG_REC_CTRL] = info->rx_ctrl;
3089 xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, STOP_CHAR(info->port.tty)); 3089 xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, STOP_CHAR(info->port.tty));
3090 xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, enable); 3090 xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, enable);
3091 if (info->port.tty->termios->c_iflag & IXON ) { 3091 if (info->port.tty->termios.c_iflag & IXON ) {
3092 DFLOW(DEBUG_LOG(info->line, "FLOW XOFF enabled 0x%02X\n", 3092 DFLOW(DEBUG_LOG(info->line, "FLOW XOFF enabled 0x%02X\n",
3093 STOP_CHAR(info->port.tty))); 3093 STOP_CHAR(info->port.tty)));
3094 xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable); 3094 xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable);
@@ -3355,7 +3355,7 @@ rs_throttle(struct tty_struct * tty)
3355 DFLOW(DEBUG_LOG(info->line,"rs_throttle %lu\n", tty->ldisc.chars_in_buffer(tty))); 3355 DFLOW(DEBUG_LOG(info->line,"rs_throttle %lu\n", tty->ldisc.chars_in_buffer(tty)));
3356 3356
3357 /* Do RTS before XOFF since XOFF might take some time */ 3357 /* Do RTS before XOFF since XOFF might take some time */
3358 if (tty->termios->c_cflag & CRTSCTS) { 3358 if (tty->termios.c_cflag & CRTSCTS) {
3359 /* Turn off RTS line */ 3359 /* Turn off RTS line */
3360 e100_rts(info, 0); 3360 e100_rts(info, 0);
3361 } 3361 }
@@ -3377,7 +3377,7 @@ rs_unthrottle(struct tty_struct * tty)
3377 DFLOW(DEBUG_LOG(info->line,"rs_unthrottle ldisc %d\n", tty->ldisc.chars_in_buffer(tty))); 3377 DFLOW(DEBUG_LOG(info->line,"rs_unthrottle ldisc %d\n", tty->ldisc.chars_in_buffer(tty)));
3378 DFLOW(DEBUG_LOG(info->line,"rs_unthrottle flip.count: %i\n", tty->flip.count)); 3378 DFLOW(DEBUG_LOG(info->line,"rs_unthrottle flip.count: %i\n", tty->flip.count));
3379 /* Do RTS before XOFF since XOFF might take some time */ 3379 /* Do RTS before XOFF since XOFF might take some time */
3380 if (tty->termios->c_cflag & CRTSCTS) { 3380 if (tty->termios.c_cflag & CRTSCTS) {
3381 /* Assert RTS line */ 3381 /* Assert RTS line */
3382 e100_rts(info, 1); 3382 e100_rts(info, 1);
3383 } 3383 }
@@ -3748,7 +3748,7 @@ rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
3748 3748
3749 /* Handle turning off CRTSCTS */ 3749 /* Handle turning off CRTSCTS */
3750 if ((old_termios->c_cflag & CRTSCTS) && 3750 if ((old_termios->c_cflag & CRTSCTS) &&
3751 !(tty->termios->c_cflag & CRTSCTS)) { 3751 !(tty->termios.c_cflag & CRTSCTS)) {
3752 tty->hw_stopped = 0; 3752 tty->hw_stopped = 0;
3753 rs_start(tty); 3753 rs_start(tty);
3754 } 3754 }
@@ -3815,7 +3815,7 @@ rs_close(struct tty_struct *tty, struct file * filp)
3815 * separate termios for callout and dialin. 3815 * separate termios for callout and dialin.
3816 */ 3816 */
3817 if (info->flags & ASYNC_NORMAL_ACTIVE) 3817 if (info->flags & ASYNC_NORMAL_ACTIVE)
3818 info->normal_termios = *tty->termios; 3818 info->normal_termios = tty->termios;
3819 /* 3819 /*
3820 * Now we wait for the transmit buffer to clear; and we notify 3820 * Now we wait for the transmit buffer to clear; and we notify
3821 * the line discipline to only process XON/XOFF characters. 3821 * the line discipline to only process XON/XOFF characters.
@@ -3998,7 +3998,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
3998 return 0; 3998 return 0;
3999 } 3999 }
4000 4000
4001 if (tty->termios->c_cflag & CLOCAL) { 4001 if (tty->termios.c_cflag & CLOCAL) {
4002 do_clocal = 1; 4002 do_clocal = 1;
4003 } 4003 }
4004 4004
@@ -4219,7 +4219,7 @@ rs_open(struct tty_struct *tty, struct file * filp)
4219 } 4219 }
4220 4220
4221 if ((info->count == 1) && (info->flags & ASYNC_SPLIT_TERMIOS)) { 4221 if ((info->count == 1) && (info->flags & ASYNC_SPLIT_TERMIOS)) {
4222 *tty->termios = info->normal_termios; 4222 tty->termios = info->normal_termios;
4223 change_speed(info); 4223 change_speed(info);
4224 } 4224 }
4225 4225
diff --git a/drivers/tty/serial/ioc4_serial.c b/drivers/tty/serial/ioc4_serial.c
index e16894fb2ca3..cc5aca78ad9b 100644
--- a/drivers/tty/serial/ioc4_serial.c
+++ b/drivers/tty/serial/ioc4_serial.c
@@ -1803,7 +1803,7 @@ static inline int ic4_startup_local(struct uart_port *the_port)
1803 ioc4_set_proto(port, the_port->mapbase); 1803 ioc4_set_proto(port, the_port->mapbase);
1804 1804
1805 /* set the speed of the serial port */ 1805 /* set the speed of the serial port */
1806 ioc4_change_speed(the_port, state->port.tty->termios, 1806 ioc4_change_speed(the_port, &state->port.tty->termios,
1807 (struct ktermios *)0); 1807 (struct ktermios *)0);
1808 1808
1809 return 0; 1809 return 0;
diff --git a/drivers/tty/serial/jsm/jsm_tty.c b/drivers/tty/serial/jsm/jsm_tty.c
index 434bd881fcae..71397961773c 100644
--- a/drivers/tty/serial/jsm/jsm_tty.c
+++ b/drivers/tty/serial/jsm/jsm_tty.c
@@ -161,7 +161,7 @@ static void jsm_tty_send_xchar(struct uart_port *port, char ch)
161 struct ktermios *termios; 161 struct ktermios *termios;
162 162
163 spin_lock_irqsave(&port->lock, lock_flags); 163 spin_lock_irqsave(&port->lock, lock_flags);
164 termios = port->state->port.tty->termios; 164 termios = &port->state->port.tty->termios;
165 if (ch == termios->c_cc[VSTART]) 165 if (ch == termios->c_cc[VSTART])
166 channel->ch_bd->bd_ops->send_start_character(channel); 166 channel->ch_bd->bd_ops->send_start_character(channel);
167 167
@@ -250,7 +250,7 @@ static int jsm_tty_open(struct uart_port *port)
250 channel->ch_cached_lsr = 0; 250 channel->ch_cached_lsr = 0;
251 channel->ch_stops_sent = 0; 251 channel->ch_stops_sent = 0;
252 252
253 termios = port->state->port.tty->termios; 253 termios = &port->state->port.tty->termios;
254 channel->ch_c_cflag = termios->c_cflag; 254 channel->ch_c_cflag = termios->c_cflag;
255 channel->ch_c_iflag = termios->c_iflag; 255 channel->ch_c_iflag = termios->c_iflag;
256 channel->ch_c_oflag = termios->c_oflag; 256 channel->ch_c_oflag = termios->c_oflag;
@@ -283,7 +283,7 @@ static void jsm_tty_close(struct uart_port *port)
283 jsm_printk(CLOSE, INFO, &channel->ch_bd->pci_dev, "start\n"); 283 jsm_printk(CLOSE, INFO, &channel->ch_bd->pci_dev, "start\n");
284 284
285 bd = channel->ch_bd; 285 bd = channel->ch_bd;
286 ts = port->state->port.tty->termios; 286 ts = &port->state->port.tty->termios;
287 287
288 channel->ch_flags &= ~(CH_STOPI); 288 channel->ch_flags &= ~(CH_STOPI);
289 289
@@ -567,7 +567,7 @@ void jsm_input(struct jsm_channel *ch)
567 *input data and return immediately. 567 *input data and return immediately.
568 */ 568 */
569 if (!tp || 569 if (!tp ||
570 !(tp->termios->c_cflag & CREAD) ) { 570 !(tp->termios.c_cflag & CREAD) ) {
571 571
572 jsm_printk(READ, INFO, &ch->ch_bd->pci_dev, 572 jsm_printk(READ, INFO, &ch->ch_bd->pci_dev,
573 "input. dropping %d bytes on port %d...\n", data_len, ch->ch_portnum); 573 "input. dropping %d bytes on port %d...\n", data_len, ch->ch_portnum);
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index d57f165d6be8..5c5e7e09f23e 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -1035,7 +1035,7 @@ static int s3c24xx_serial_cpufreq_transition(struct notifier_block *nb,
1035 if (tty == NULL) 1035 if (tty == NULL)
1036 goto exit; 1036 goto exit;
1037 1037
1038 termios = tty->termios; 1038 termios = &tty->termios;
1039 1039
1040 if (termios == NULL) { 1040 if (termios == NULL) {
1041 printk(KERN_WARNING "%s: no termios?\n", __func__); 1041 printk(KERN_WARNING "%s: no termios?\n", __func__);
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index a21dc8e3b7c0..d98b1bd407f6 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -159,7 +159,7 @@ static int uart_port_startup(struct tty_struct *tty, struct uart_state *state,
159 retval = uport->ops->startup(uport); 159 retval = uport->ops->startup(uport);
160 if (retval == 0) { 160 if (retval == 0) {
161 if (uart_console(uport) && uport->cons->cflag) { 161 if (uart_console(uport) && uport->cons->cflag) {
162 tty->termios->c_cflag = uport->cons->cflag; 162 tty->termios.c_cflag = uport->cons->cflag;
163 uport->cons->cflag = 0; 163 uport->cons->cflag = 0;
164 } 164 }
165 /* 165 /*
@@ -172,7 +172,7 @@ static int uart_port_startup(struct tty_struct *tty, struct uart_state *state,
172 * Setup the RTS and DTR signals once the 172 * Setup the RTS and DTR signals once the
173 * port is open and ready to respond. 173 * port is open and ready to respond.
174 */ 174 */
175 if (tty->termios->c_cflag & CBAUD) 175 if (tty->termios.c_cflag & CBAUD)
176 uart_set_mctrl(uport, TIOCM_RTS | TIOCM_DTR); 176 uart_set_mctrl(uport, TIOCM_RTS | TIOCM_DTR);
177 } 177 }
178 178
@@ -240,7 +240,7 @@ static void uart_shutdown(struct tty_struct *tty, struct uart_state *state)
240 /* 240 /*
241 * Turn off DTR and RTS early. 241 * Turn off DTR and RTS early.
242 */ 242 */
243 if (!tty || (tty->termios->c_cflag & HUPCL)) 243 if (!tty || (tty->termios.c_cflag & HUPCL))
244 uart_clear_mctrl(uport, TIOCM_DTR | TIOCM_RTS); 244 uart_clear_mctrl(uport, TIOCM_DTR | TIOCM_RTS);
245 245
246 uart_port_shutdown(port); 246 uart_port_shutdown(port);
@@ -440,10 +440,10 @@ static void uart_change_speed(struct tty_struct *tty, struct uart_state *state,
440 * If we have no tty, termios, or the port does not exist, 440 * If we have no tty, termios, or the port does not exist,
441 * then we can't set the parameters for this port. 441 * then we can't set the parameters for this port.
442 */ 442 */
443 if (!tty || !tty->termios || uport->type == PORT_UNKNOWN) 443 if (!tty || uport->type == PORT_UNKNOWN)
444 return; 444 return;
445 445
446 termios = tty->termios; 446 termios = &tty->termios;
447 447
448 /* 448 /*
449 * Set flags based on termios cflag 449 * Set flags based on termios cflag
@@ -614,7 +614,7 @@ static void uart_throttle(struct tty_struct *tty)
614 if (I_IXOFF(tty)) 614 if (I_IXOFF(tty))
615 uart_send_xchar(tty, STOP_CHAR(tty)); 615 uart_send_xchar(tty, STOP_CHAR(tty));
616 616
617 if (tty->termios->c_cflag & CRTSCTS) 617 if (tty->termios.c_cflag & CRTSCTS)
618 uart_clear_mctrl(state->uart_port, TIOCM_RTS); 618 uart_clear_mctrl(state->uart_port, TIOCM_RTS);
619} 619}
620 620
@@ -630,7 +630,7 @@ static void uart_unthrottle(struct tty_struct *tty)
630 uart_send_xchar(tty, START_CHAR(tty)); 630 uart_send_xchar(tty, START_CHAR(tty));
631 } 631 }
632 632
633 if (tty->termios->c_cflag & CRTSCTS) 633 if (tty->termios.c_cflag & CRTSCTS)
634 uart_set_mctrl(port, TIOCM_RTS); 634 uart_set_mctrl(port, TIOCM_RTS);
635} 635}
636 636
@@ -1187,7 +1187,7 @@ static void uart_set_ldisc(struct tty_struct *tty)
1187 struct uart_port *uport = state->uart_port; 1187 struct uart_port *uport = state->uart_port;
1188 1188
1189 if (uport->ops->set_ldisc) 1189 if (uport->ops->set_ldisc)
1190 uport->ops->set_ldisc(uport, tty->termios->c_line); 1190 uport->ops->set_ldisc(uport, tty->termios.c_line);
1191} 1191}
1192 1192
1193static void uart_set_termios(struct tty_struct *tty, 1193static void uart_set_termios(struct tty_struct *tty,
@@ -1195,7 +1195,7 @@ static void uart_set_termios(struct tty_struct *tty,
1195{ 1195{
1196 struct uart_state *state = tty->driver_data; 1196 struct uart_state *state = tty->driver_data;
1197 unsigned long flags; 1197 unsigned long flags;
1198 unsigned int cflag = tty->termios->c_cflag; 1198 unsigned int cflag = tty->termios.c_cflag;
1199 1199
1200 1200
1201 /* 1201 /*
@@ -1206,9 +1206,9 @@ static void uart_set_termios(struct tty_struct *tty,
1206 */ 1206 */
1207#define RELEVANT_IFLAG(iflag) ((iflag) & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) 1207#define RELEVANT_IFLAG(iflag) ((iflag) & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
1208 if ((cflag ^ old_termios->c_cflag) == 0 && 1208 if ((cflag ^ old_termios->c_cflag) == 0 &&
1209 tty->termios->c_ospeed == old_termios->c_ospeed && 1209 tty->termios.c_ospeed == old_termios->c_ospeed &&
1210 tty->termios->c_ispeed == old_termios->c_ispeed && 1210 tty->termios.c_ispeed == old_termios->c_ispeed &&
1211 RELEVANT_IFLAG(tty->termios->c_iflag ^ old_termios->c_iflag) == 0) { 1211 RELEVANT_IFLAG(tty->termios.c_iflag ^ old_termios->c_iflag) == 0) {
1212 return; 1212 return;
1213 } 1213 }
1214 1214
@@ -1960,8 +1960,8 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)
1960 /* 1960 /*
1961 * If that's unset, use the tty termios setting. 1961 * If that's unset, use the tty termios setting.
1962 */ 1962 */
1963 if (port->tty && port->tty->termios && termios.c_cflag == 0) 1963 if (port->tty && termios.c_cflag == 0)
1964 termios = *(port->tty->termios); 1964 termios = port->tty->termios;
1965 1965
1966 if (console_suspend_enabled) 1966 if (console_suspend_enabled)
1967 uart_change_pm(state, 0); 1967 uart_change_pm(state, 0);
diff --git a/drivers/tty/synclink.c b/drivers/tty/synclink.c
index 593d40ad0a6b..bdeeb3133f62 100644
--- a/drivers/tty/synclink.c
+++ b/drivers/tty/synclink.c
@@ -1840,22 +1840,22 @@ static void shutdown(struct mgsl_struct * info)
1840 usc_DisableInterrupts(info,RECEIVE_DATA + RECEIVE_STATUS + 1840 usc_DisableInterrupts(info,RECEIVE_DATA + RECEIVE_STATUS +
1841 TRANSMIT_DATA + TRANSMIT_STATUS + IO_PIN + MISC ); 1841 TRANSMIT_DATA + TRANSMIT_STATUS + IO_PIN + MISC );
1842 usc_DisableDmaInterrupts(info,DICR_MASTER + DICR_TRANSMIT + DICR_RECEIVE); 1842 usc_DisableDmaInterrupts(info,DICR_MASTER + DICR_TRANSMIT + DICR_RECEIVE);
1843 1843
1844 /* Disable DMAEN (Port 7, Bit 14) */ 1844 /* Disable DMAEN (Port 7, Bit 14) */
1845 /* This disconnects the DMA request signal from the ISA bus */ 1845 /* This disconnects the DMA request signal from the ISA bus */
1846 /* on the ISA adapter. This has no effect for the PCI adapter */ 1846 /* on the ISA adapter. This has no effect for the PCI adapter */
1847 usc_OutReg(info, PCR, (u16)((usc_InReg(info, PCR) | BIT15) | BIT14)); 1847 usc_OutReg(info, PCR, (u16)((usc_InReg(info, PCR) | BIT15) | BIT14));
1848 1848
1849 /* Disable INTEN (Port 6, Bit12) */ 1849 /* Disable INTEN (Port 6, Bit12) */
1850 /* This disconnects the IRQ request signal to the ISA bus */ 1850 /* This disconnects the IRQ request signal to the ISA bus */
1851 /* on the ISA adapter. This has no effect for the PCI adapter */ 1851 /* on the ISA adapter. This has no effect for the PCI adapter */
1852 usc_OutReg(info, PCR, (u16)((usc_InReg(info, PCR) | BIT13) | BIT12)); 1852 usc_OutReg(info, PCR, (u16)((usc_InReg(info, PCR) | BIT13) | BIT12));
1853 1853
1854 if (!info->port.tty || info->port.tty->termios->c_cflag & HUPCL) { 1854 if (!info->port.tty || info->port.tty->termios.c_cflag & HUPCL) {
1855 info->serial_signals &= ~(SerialSignal_DTR + SerialSignal_RTS); 1855 info->serial_signals &= ~(SerialSignal_DTR + SerialSignal_RTS);
1856 usc_set_serial_signals(info); 1856 usc_set_serial_signals(info);
1857 } 1857 }
1858 1858
1859 spin_unlock_irqrestore(&info->irq_spinlock,flags); 1859 spin_unlock_irqrestore(&info->irq_spinlock,flags);
1860 1860
1861 mgsl_release_resources(info); 1861 mgsl_release_resources(info);
@@ -1895,7 +1895,7 @@ static void mgsl_program_hw(struct mgsl_struct *info)
1895 usc_EnableInterrupts(info, IO_PIN); 1895 usc_EnableInterrupts(info, IO_PIN);
1896 usc_get_serial_signals(info); 1896 usc_get_serial_signals(info);
1897 1897
1898 if (info->netcount || info->port.tty->termios->c_cflag & CREAD) 1898 if (info->netcount || info->port.tty->termios.c_cflag & CREAD)
1899 usc_start_receiver(info); 1899 usc_start_receiver(info);
1900 1900
1901 spin_unlock_irqrestore(&info->irq_spinlock,flags); 1901 spin_unlock_irqrestore(&info->irq_spinlock,flags);
@@ -1908,14 +1908,14 @@ static void mgsl_change_params(struct mgsl_struct *info)
1908 unsigned cflag; 1908 unsigned cflag;
1909 int bits_per_char; 1909 int bits_per_char;
1910 1910
1911 if (!info->port.tty || !info->port.tty->termios) 1911 if (!info->port.tty)
1912 return; 1912 return;
1913 1913
1914 if (debug_level >= DEBUG_LEVEL_INFO) 1914 if (debug_level >= DEBUG_LEVEL_INFO)
1915 printk("%s(%d):mgsl_change_params(%s)\n", 1915 printk("%s(%d):mgsl_change_params(%s)\n",
1916 __FILE__,__LINE__, info->device_name ); 1916 __FILE__,__LINE__, info->device_name );
1917 1917
1918 cflag = info->port.tty->termios->c_cflag; 1918 cflag = info->port.tty->termios.c_cflag;
1919 1919
1920 /* if B0 rate (hangup) specified then negate DTR and RTS */ 1920 /* if B0 rate (hangup) specified then negate DTR and RTS */
1921 /* otherwise assert DTR and RTS */ 1921 /* otherwise assert DTR and RTS */
@@ -2367,8 +2367,8 @@ static void mgsl_throttle(struct tty_struct * tty)
2367 2367
2368 if (I_IXOFF(tty)) 2368 if (I_IXOFF(tty))
2369 mgsl_send_xchar(tty, STOP_CHAR(tty)); 2369 mgsl_send_xchar(tty, STOP_CHAR(tty));
2370 2370
2371 if (tty->termios->c_cflag & CRTSCTS) { 2371 if (tty->termios.c_cflag & CRTSCTS) {
2372 spin_lock_irqsave(&info->irq_spinlock,flags); 2372 spin_lock_irqsave(&info->irq_spinlock,flags);
2373 info->serial_signals &= ~SerialSignal_RTS; 2373 info->serial_signals &= ~SerialSignal_RTS;
2374 usc_set_serial_signals(info); 2374 usc_set_serial_signals(info);
@@ -2401,8 +2401,8 @@ static void mgsl_unthrottle(struct tty_struct * tty)
2401 else 2401 else
2402 mgsl_send_xchar(tty, START_CHAR(tty)); 2402 mgsl_send_xchar(tty, START_CHAR(tty));
2403 } 2403 }
2404 2404
2405 if (tty->termios->c_cflag & CRTSCTS) { 2405 if (tty->termios.c_cflag & CRTSCTS) {
2406 spin_lock_irqsave(&info->irq_spinlock,flags); 2406 spin_lock_irqsave(&info->irq_spinlock,flags);
2407 info->serial_signals |= SerialSignal_RTS; 2407 info->serial_signals |= SerialSignal_RTS;
2408 usc_set_serial_signals(info); 2408 usc_set_serial_signals(info);
@@ -3045,7 +3045,7 @@ static void mgsl_set_termios(struct tty_struct *tty, struct ktermios *old_termio
3045 3045
3046 /* Handle transition to B0 status */ 3046 /* Handle transition to B0 status */
3047 if (old_termios->c_cflag & CBAUD && 3047 if (old_termios->c_cflag & CBAUD &&
3048 !(tty->termios->c_cflag & CBAUD)) { 3048 !(tty->termios.c_cflag & CBAUD)) {
3049 info->serial_signals &= ~(SerialSignal_RTS + SerialSignal_DTR); 3049 info->serial_signals &= ~(SerialSignal_RTS + SerialSignal_DTR);
3050 spin_lock_irqsave(&info->irq_spinlock,flags); 3050 spin_lock_irqsave(&info->irq_spinlock,flags);
3051 usc_set_serial_signals(info); 3051 usc_set_serial_signals(info);
@@ -3054,9 +3054,9 @@ static void mgsl_set_termios(struct tty_struct *tty, struct ktermios *old_termio
3054 3054
3055 /* Handle transition away from B0 status */ 3055 /* Handle transition away from B0 status */
3056 if (!(old_termios->c_cflag & CBAUD) && 3056 if (!(old_termios->c_cflag & CBAUD) &&
3057 tty->termios->c_cflag & CBAUD) { 3057 tty->termios.c_cflag & CBAUD) {
3058 info->serial_signals |= SerialSignal_DTR; 3058 info->serial_signals |= SerialSignal_DTR;
3059 if (!(tty->termios->c_cflag & CRTSCTS) || 3059 if (!(tty->termios.c_cflag & CRTSCTS) ||
3060 !test_bit(TTY_THROTTLED, &tty->flags)) { 3060 !test_bit(TTY_THROTTLED, &tty->flags)) {
3061 info->serial_signals |= SerialSignal_RTS; 3061 info->serial_signals |= SerialSignal_RTS;
3062 } 3062 }
@@ -3067,7 +3067,7 @@ static void mgsl_set_termios(struct tty_struct *tty, struct ktermios *old_termio
3067 3067
3068 /* Handle turning off CRTSCTS */ 3068 /* Handle turning off CRTSCTS */
3069 if (old_termios->c_cflag & CRTSCTS && 3069 if (old_termios->c_cflag & CRTSCTS &&
3070 !(tty->termios->c_cflag & CRTSCTS)) { 3070 !(tty->termios.c_cflag & CRTSCTS)) {
3071 tty->hw_stopped = 0; 3071 tty->hw_stopped = 0;
3072 mgsl_start(tty); 3072 mgsl_start(tty);
3073 } 3073 }
@@ -3287,7 +3287,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
3287 return 0; 3287 return 0;
3288 } 3288 }
3289 3289
3290 if (tty->termios->c_cflag & CLOCAL) 3290 if (tty->termios.c_cflag & CLOCAL)
3291 do_clocal = true; 3291 do_clocal = true;
3292 3292
3293 /* Wait for carrier detect and the line to become 3293 /* Wait for carrier detect and the line to become
@@ -3313,7 +3313,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
3313 port->blocked_open++; 3313 port->blocked_open++;
3314 3314
3315 while (1) { 3315 while (1) {
3316 if (tty->termios->c_cflag & CBAUD) 3316 if (tty->termios.c_cflag & CBAUD)
3317 tty_port_raise_dtr_rts(port); 3317 tty_port_raise_dtr_rts(port);
3318 3318
3319 set_current_state(TASK_INTERRUPTIBLE); 3319 set_current_state(TASK_INTERRUPTIBLE);
diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c
index aa1debf97cc7..f02d18a391e5 100644
--- a/drivers/tty/synclink_gt.c
+++ b/drivers/tty/synclink_gt.c
@@ -785,7 +785,7 @@ static void set_termios(struct tty_struct *tty, struct ktermios *old_termios)
785 785
786 /* Handle transition to B0 status */ 786 /* Handle transition to B0 status */
787 if (old_termios->c_cflag & CBAUD && 787 if (old_termios->c_cflag & CBAUD &&
788 !(tty->termios->c_cflag & CBAUD)) { 788 !(tty->termios.c_cflag & CBAUD)) {
789 info->signals &= ~(SerialSignal_RTS + SerialSignal_DTR); 789 info->signals &= ~(SerialSignal_RTS + SerialSignal_DTR);
790 spin_lock_irqsave(&info->lock,flags); 790 spin_lock_irqsave(&info->lock,flags);
791 set_signals(info); 791 set_signals(info);
@@ -794,9 +794,9 @@ static void set_termios(struct tty_struct *tty, struct ktermios *old_termios)
794 794
795 /* Handle transition away from B0 status */ 795 /* Handle transition away from B0 status */
796 if (!(old_termios->c_cflag & CBAUD) && 796 if (!(old_termios->c_cflag & CBAUD) &&
797 tty->termios->c_cflag & CBAUD) { 797 tty->termios.c_cflag & CBAUD) {
798 info->signals |= SerialSignal_DTR; 798 info->signals |= SerialSignal_DTR;
799 if (!(tty->termios->c_cflag & CRTSCTS) || 799 if (!(tty->termios.c_cflag & CRTSCTS) ||
800 !test_bit(TTY_THROTTLED, &tty->flags)) { 800 !test_bit(TTY_THROTTLED, &tty->flags)) {
801 info->signals |= SerialSignal_RTS; 801 info->signals |= SerialSignal_RTS;
802 } 802 }
@@ -807,7 +807,7 @@ static void set_termios(struct tty_struct *tty, struct ktermios *old_termios)
807 807
808 /* Handle turning off CRTSCTS */ 808 /* Handle turning off CRTSCTS */
809 if (old_termios->c_cflag & CRTSCTS && 809 if (old_termios->c_cflag & CRTSCTS &&
810 !(tty->termios->c_cflag & CRTSCTS)) { 810 !(tty->termios.c_cflag & CRTSCTS)) {
811 tty->hw_stopped = 0; 811 tty->hw_stopped = 0;
812 tx_release(tty); 812 tx_release(tty);
813 } 813 }
@@ -1372,7 +1372,7 @@ static void throttle(struct tty_struct * tty)
1372 DBGINFO(("%s throttle\n", info->device_name)); 1372 DBGINFO(("%s throttle\n", info->device_name));
1373 if (I_IXOFF(tty)) 1373 if (I_IXOFF(tty))
1374 send_xchar(tty, STOP_CHAR(tty)); 1374 send_xchar(tty, STOP_CHAR(tty));
1375 if (tty->termios->c_cflag & CRTSCTS) { 1375 if (tty->termios.c_cflag & CRTSCTS) {
1376 spin_lock_irqsave(&info->lock,flags); 1376 spin_lock_irqsave(&info->lock,flags);
1377 info->signals &= ~SerialSignal_RTS; 1377 info->signals &= ~SerialSignal_RTS;
1378 set_signals(info); 1378 set_signals(info);
@@ -1397,7 +1397,7 @@ static void unthrottle(struct tty_struct * tty)
1397 else 1397 else
1398 send_xchar(tty, START_CHAR(tty)); 1398 send_xchar(tty, START_CHAR(tty));
1399 } 1399 }
1400 if (tty->termios->c_cflag & CRTSCTS) { 1400 if (tty->termios.c_cflag & CRTSCTS) {
1401 spin_lock_irqsave(&info->lock,flags); 1401 spin_lock_irqsave(&info->lock,flags);
1402 info->signals |= SerialSignal_RTS; 1402 info->signals |= SerialSignal_RTS;
1403 set_signals(info); 1403 set_signals(info);
@@ -2493,7 +2493,7 @@ static void shutdown(struct slgt_info *info)
2493 2493
2494 slgt_irq_off(info, IRQ_ALL | IRQ_MASTER); 2494 slgt_irq_off(info, IRQ_ALL | IRQ_MASTER);
2495 2495
2496 if (!info->port.tty || info->port.tty->termios->c_cflag & HUPCL) { 2496 if (!info->port.tty || info->port.tty->termios.c_cflag & HUPCL) {
2497 info->signals &= ~(SerialSignal_DTR + SerialSignal_RTS); 2497 info->signals &= ~(SerialSignal_DTR + SerialSignal_RTS);
2498 set_signals(info); 2498 set_signals(info);
2499 } 2499 }
@@ -2534,7 +2534,7 @@ static void program_hw(struct slgt_info *info)
2534 get_signals(info); 2534 get_signals(info);
2535 2535
2536 if (info->netcount || 2536 if (info->netcount ||
2537 (info->port.tty && info->port.tty->termios->c_cflag & CREAD)) 2537 (info->port.tty && info->port.tty->termios.c_cflag & CREAD))
2538 rx_start(info); 2538 rx_start(info);
2539 2539
2540 spin_unlock_irqrestore(&info->lock,flags); 2540 spin_unlock_irqrestore(&info->lock,flags);
@@ -2548,11 +2548,11 @@ static void change_params(struct slgt_info *info)
2548 unsigned cflag; 2548 unsigned cflag;
2549 int bits_per_char; 2549 int bits_per_char;
2550 2550
2551 if (!info->port.tty || !info->port.tty->termios) 2551 if (!info->port.tty)
2552 return; 2552 return;
2553 DBGINFO(("%s change_params\n", info->device_name)); 2553 DBGINFO(("%s change_params\n", info->device_name));
2554 2554
2555 cflag = info->port.tty->termios->c_cflag; 2555 cflag = info->port.tty->termios.c_cflag;
2556 2556
2557 /* if B0 rate (hangup) specified then negate DTR and RTS */ 2557 /* if B0 rate (hangup) specified then negate DTR and RTS */
2558 /* otherwise assert DTR and RTS */ 2558 /* otherwise assert DTR and RTS */
@@ -3292,7 +3292,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
3292 return 0; 3292 return 0;
3293 } 3293 }
3294 3294
3295 if (tty->termios->c_cflag & CLOCAL) 3295 if (tty->termios.c_cflag & CLOCAL)
3296 do_clocal = true; 3296 do_clocal = true;
3297 3297
3298 /* Wait for carrier detect and the line to become 3298 /* Wait for carrier detect and the line to become
@@ -3314,7 +3314,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
3314 port->blocked_open++; 3314 port->blocked_open++;
3315 3315
3316 while (1) { 3316 while (1) {
3317 if ((tty->termios->c_cflag & CBAUD)) 3317 if ((tty->termios.c_cflag & CBAUD))
3318 tty_port_raise_dtr_rts(port); 3318 tty_port_raise_dtr_rts(port);
3319 3319
3320 set_current_state(TASK_INTERRUPTIBLE); 3320 set_current_state(TASK_INTERRUPTIBLE);
diff --git a/drivers/tty/synclinkmp.c b/drivers/tty/synclinkmp.c
index a3dddc12d2fe..ae75a3c21fd3 100644
--- a/drivers/tty/synclinkmp.c
+++ b/drivers/tty/synclinkmp.c
@@ -873,7 +873,7 @@ static void set_termios(struct tty_struct *tty, struct ktermios *old_termios)
873 873
874 /* Handle transition to B0 status */ 874 /* Handle transition to B0 status */
875 if (old_termios->c_cflag & CBAUD && 875 if (old_termios->c_cflag & CBAUD &&
876 !(tty->termios->c_cflag & CBAUD)) { 876 !(tty->termios.c_cflag & CBAUD)) {
877 info->serial_signals &= ~(SerialSignal_RTS + SerialSignal_DTR); 877 info->serial_signals &= ~(SerialSignal_RTS + SerialSignal_DTR);
878 spin_lock_irqsave(&info->lock,flags); 878 spin_lock_irqsave(&info->lock,flags);
879 set_signals(info); 879 set_signals(info);
@@ -882,9 +882,9 @@ static void set_termios(struct tty_struct *tty, struct ktermios *old_termios)
882 882
883 /* Handle transition away from B0 status */ 883 /* Handle transition away from B0 status */
884 if (!(old_termios->c_cflag & CBAUD) && 884 if (!(old_termios->c_cflag & CBAUD) &&
885 tty->termios->c_cflag & CBAUD) { 885 tty->termios.c_cflag & CBAUD) {
886 info->serial_signals |= SerialSignal_DTR; 886 info->serial_signals |= SerialSignal_DTR;
887 if (!(tty->termios->c_cflag & CRTSCTS) || 887 if (!(tty->termios.c_cflag & CRTSCTS) ||
888 !test_bit(TTY_THROTTLED, &tty->flags)) { 888 !test_bit(TTY_THROTTLED, &tty->flags)) {
889 info->serial_signals |= SerialSignal_RTS; 889 info->serial_signals |= SerialSignal_RTS;
890 } 890 }
@@ -895,7 +895,7 @@ static void set_termios(struct tty_struct *tty, struct ktermios *old_termios)
895 895
896 /* Handle turning off CRTSCTS */ 896 /* Handle turning off CRTSCTS */
897 if (old_termios->c_cflag & CRTSCTS && 897 if (old_termios->c_cflag & CRTSCTS &&
898 !(tty->termios->c_cflag & CRTSCTS)) { 898 !(tty->termios.c_cflag & CRTSCTS)) {
899 tty->hw_stopped = 0; 899 tty->hw_stopped = 0;
900 tx_release(tty); 900 tx_release(tty);
901 } 901 }
@@ -1473,7 +1473,7 @@ static void throttle(struct tty_struct * tty)
1473 if (I_IXOFF(tty)) 1473 if (I_IXOFF(tty))
1474 send_xchar(tty, STOP_CHAR(tty)); 1474 send_xchar(tty, STOP_CHAR(tty));
1475 1475
1476 if (tty->termios->c_cflag & CRTSCTS) { 1476 if (tty->termios.c_cflag & CRTSCTS) {
1477 spin_lock_irqsave(&info->lock,flags); 1477 spin_lock_irqsave(&info->lock,flags);
1478 info->serial_signals &= ~SerialSignal_RTS; 1478 info->serial_signals &= ~SerialSignal_RTS;
1479 set_signals(info); 1479 set_signals(info);
@@ -1502,7 +1502,7 @@ static void unthrottle(struct tty_struct * tty)
1502 send_xchar(tty, START_CHAR(tty)); 1502 send_xchar(tty, START_CHAR(tty));
1503 } 1503 }
1504 1504
1505 if (tty->termios->c_cflag & CRTSCTS) { 1505 if (tty->termios.c_cflag & CRTSCTS) {
1506 spin_lock_irqsave(&info->lock,flags); 1506 spin_lock_irqsave(&info->lock,flags);
1507 info->serial_signals |= SerialSignal_RTS; 1507 info->serial_signals |= SerialSignal_RTS;
1508 set_signals(info); 1508 set_signals(info);
@@ -2708,7 +2708,7 @@ static void shutdown(SLMP_INFO * info)
2708 2708
2709 reset_port(info); 2709 reset_port(info);
2710 2710
2711 if (!info->port.tty || info->port.tty->termios->c_cflag & HUPCL) { 2711 if (!info->port.tty || info->port.tty->termios.c_cflag & HUPCL) {
2712 info->serial_signals &= ~(SerialSignal_DTR + SerialSignal_RTS); 2712 info->serial_signals &= ~(SerialSignal_DTR + SerialSignal_RTS);
2713 set_signals(info); 2713 set_signals(info);
2714 } 2714 }
@@ -2749,7 +2749,7 @@ static void program_hw(SLMP_INFO *info)
2749 2749
2750 get_signals(info); 2750 get_signals(info);
2751 2751
2752 if (info->netcount || (info->port.tty && info->port.tty->termios->c_cflag & CREAD) ) 2752 if (info->netcount || (info->port.tty && info->port.tty->termios.c_cflag & CREAD) )
2753 rx_start(info); 2753 rx_start(info);
2754 2754
2755 spin_unlock_irqrestore(&info->lock,flags); 2755 spin_unlock_irqrestore(&info->lock,flags);
@@ -2762,14 +2762,14 @@ static void change_params(SLMP_INFO *info)
2762 unsigned cflag; 2762 unsigned cflag;
2763 int bits_per_char; 2763 int bits_per_char;
2764 2764
2765 if (!info->port.tty || !info->port.tty->termios) 2765 if (!info->port.tty)
2766 return; 2766 return;
2767 2767
2768 if (debug_level >= DEBUG_LEVEL_INFO) 2768 if (debug_level >= DEBUG_LEVEL_INFO)
2769 printk("%s(%d):%s change_params()\n", 2769 printk("%s(%d):%s change_params()\n",
2770 __FILE__,__LINE__, info->device_name ); 2770 __FILE__,__LINE__, info->device_name );
2771 2771
2772 cflag = info->port.tty->termios->c_cflag; 2772 cflag = info->port.tty->termios.c_cflag;
2773 2773
2774 /* if B0 rate (hangup) specified then negate DTR and RTS */ 2774 /* if B0 rate (hangup) specified then negate DTR and RTS */
2775 /* otherwise assert DTR and RTS */ 2775 /* otherwise assert DTR and RTS */
@@ -3306,7 +3306,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
3306 return 0; 3306 return 0;
3307 } 3307 }
3308 3308
3309 if (tty->termios->c_cflag & CLOCAL) 3309 if (tty->termios.c_cflag & CLOCAL)
3310 do_clocal = true; 3310 do_clocal = true;
3311 3311
3312 /* Wait for carrier detect and the line to become 3312 /* Wait for carrier detect and the line to become
@@ -3332,7 +3332,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
3332 port->blocked_open++; 3332 port->blocked_open++;
3333 3333
3334 while (1) { 3334 while (1) {
3335 if (tty->termios->c_cflag & CBAUD) 3335 if (tty->termios.c_cflag & CBAUD)
3336 tty_port_raise_dtr_rts(port); 3336 tty_port_raise_dtr_rts(port);
3337 3337
3338 set_current_state(TASK_INTERRUPTIBLE); 3338 set_current_state(TASK_INTERRUPTIBLE);
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index ac96f74573d0..cfd12da81218 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -1251,19 +1251,17 @@ int tty_init_termios(struct tty_struct *tty)
1251 1251
1252 tp = tty->driver->termios[idx]; 1252 tp = tty->driver->termios[idx];
1253 if (tp == NULL) { 1253 if (tp == NULL) {
1254 tp = kzalloc(sizeof(struct ktermios[2]), GFP_KERNEL); 1254 tp = kmalloc(sizeof(struct ktermios), GFP_KERNEL);
1255 if (tp == NULL) 1255 if (tp == NULL)
1256 return -ENOMEM; 1256 return -ENOMEM;
1257 memcpy(tp, &tty->driver->init_termios, 1257 *tp = tty->driver->init_termios;
1258 sizeof(struct ktermios));
1259 tty->driver->termios[idx] = tp; 1258 tty->driver->termios[idx] = tp;
1260 } 1259 }
1261 tty->termios = tp; 1260 tty->termios = *tp;
1262 tty->termios_locked = tp + 1;
1263 1261
1264 /* Compatibility until drivers always set this */ 1262 /* Compatibility until drivers always set this */
1265 tty->termios->c_ispeed = tty_termios_input_baud_rate(tty->termios); 1263 tty->termios.c_ispeed = tty_termios_input_baud_rate(&tty->termios);
1266 tty->termios->c_ospeed = tty_termios_baud_rate(tty->termios); 1264 tty->termios.c_ospeed = tty_termios_baud_rate(&tty->termios);
1267 return 0; 1265 return 0;
1268} 1266}
1269EXPORT_SYMBOL_GPL(tty_init_termios); 1267EXPORT_SYMBOL_GPL(tty_init_termios);
@@ -1442,10 +1440,12 @@ void tty_free_termios(struct tty_struct *tty)
1442 /* Kill this flag and push into drivers for locking etc */ 1440 /* Kill this flag and push into drivers for locking etc */
1443 if (tty->driver->flags & TTY_DRIVER_RESET_TERMIOS) { 1441 if (tty->driver->flags & TTY_DRIVER_RESET_TERMIOS) {
1444 /* FIXME: Locking on ->termios array */ 1442 /* FIXME: Locking on ->termios array */
1445 tp = tty->termios; 1443 tp = tty->driver->termios[idx];
1446 tty->driver->termios[idx] = NULL; 1444 tty->driver->termios[idx] = NULL;
1447 kfree(tp); 1445 kfree(tp);
1448 } 1446 }
1447 else
1448 *tty->driver->termios[idx] = tty->termios;
1449} 1449}
1450EXPORT_SYMBOL(tty_free_termios); 1450EXPORT_SYMBOL(tty_free_termios);
1451 1451
@@ -1575,22 +1575,12 @@ static int tty_release_checks(struct tty_struct *tty, struct tty_struct *o_tty,
1575 __func__, idx, tty->name); 1575 __func__, idx, tty->name);
1576 return -1; 1576 return -1;
1577 } 1577 }
1578 if (tty->termios != tty->driver->termios[idx]) {
1579 printk(KERN_DEBUG "%s: driver.termios[%d] not termios for (%s)\n",
1580 __func__, idx, tty->name);
1581 return -1;
1582 }
1583 if (tty->driver->other) { 1578 if (tty->driver->other) {
1584 if (o_tty != tty->driver->other->ttys[idx]) { 1579 if (o_tty != tty->driver->other->ttys[idx]) {
1585 printk(KERN_DEBUG "%s: other->table[%d] not o_tty for (%s)\n", 1580 printk(KERN_DEBUG "%s: other->table[%d] not o_tty for (%s)\n",
1586 __func__, idx, tty->name); 1581 __func__, idx, tty->name);
1587 return -1; 1582 return -1;
1588 } 1583 }
1589 if (o_tty->termios != tty->driver->other->termios[idx]) {
1590 printk(KERN_DEBUG "%s: other->termios[%d] not o_termios for (%s)\n",
1591 __func__, idx, tty->name);
1592 return -1;
1593 }
1594 if (o_tty->link != tty) { 1584 if (o_tty->link != tty) {
1595 printk(KERN_DEBUG "%s: bad pty pointers\n", __func__); 1585 printk(KERN_DEBUG "%s: bad pty pointers\n", __func__);
1596 return -1; 1586 return -1;
diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c
index a1b9a2f68567..d3c2bda1e461 100644
--- a/drivers/tty/tty_ioctl.c
+++ b/drivers/tty/tty_ioctl.c
@@ -410,7 +410,7 @@ EXPORT_SYMBOL_GPL(tty_termios_encode_baud_rate);
410 410
411void tty_encode_baud_rate(struct tty_struct *tty, speed_t ibaud, speed_t obaud) 411void tty_encode_baud_rate(struct tty_struct *tty, speed_t ibaud, speed_t obaud)
412{ 412{
413 tty_termios_encode_baud_rate(tty->termios, ibaud, obaud); 413 tty_termios_encode_baud_rate(&tty->termios, ibaud, obaud);
414} 414}
415EXPORT_SYMBOL_GPL(tty_encode_baud_rate); 415EXPORT_SYMBOL_GPL(tty_encode_baud_rate);
416 416
@@ -427,7 +427,7 @@ EXPORT_SYMBOL_GPL(tty_encode_baud_rate);
427 427
428speed_t tty_get_baud_rate(struct tty_struct *tty) 428speed_t tty_get_baud_rate(struct tty_struct *tty)
429{ 429{
430 speed_t baud = tty_termios_baud_rate(tty->termios); 430 speed_t baud = tty_termios_baud_rate(&tty->termios);
431 431
432 if (baud == 38400 && tty->alt_speed) { 432 if (baud == 38400 && tty->alt_speed) {
433 if (!tty->warned) { 433 if (!tty->warned) {
@@ -509,14 +509,14 @@ int tty_set_termios(struct tty_struct *tty, struct ktermios *new_termios)
509 /* FIXME: we need to decide on some locking/ordering semantics 509 /* FIXME: we need to decide on some locking/ordering semantics
510 for the set_termios notification eventually */ 510 for the set_termios notification eventually */
511 mutex_lock(&tty->termios_mutex); 511 mutex_lock(&tty->termios_mutex);
512 old_termios = *tty->termios; 512 old_termios = tty->termios;
513 *tty->termios = *new_termios; 513 tty->termios = *new_termios;
514 unset_locked_termios(tty->termios, &old_termios, tty->termios_locked); 514 unset_locked_termios(&tty->termios, &old_termios, &tty->termios_locked);
515 515
516 /* See if packet mode change of state. */ 516 /* See if packet mode change of state. */
517 if (tty->link && tty->link->packet) { 517 if (tty->link && tty->link->packet) {
518 int extproc = (old_termios.c_lflag & EXTPROC) | 518 int extproc = (old_termios.c_lflag & EXTPROC) |
519 (tty->termios->c_lflag & EXTPROC); 519 (tty->termios.c_lflag & EXTPROC);
520 int old_flow = ((old_termios.c_iflag & IXON) && 520 int old_flow = ((old_termios.c_iflag & IXON) &&
521 (old_termios.c_cc[VSTOP] == '\023') && 521 (old_termios.c_cc[VSTOP] == '\023') &&
522 (old_termios.c_cc[VSTART] == '\021')); 522 (old_termios.c_cc[VSTART] == '\021'));
@@ -542,7 +542,7 @@ int tty_set_termios(struct tty_struct *tty, struct ktermios *new_termios)
542 if (tty->ops->set_termios) 542 if (tty->ops->set_termios)
543 (*tty->ops->set_termios)(tty, &old_termios); 543 (*tty->ops->set_termios)(tty, &old_termios);
544 else 544 else
545 tty_termios_copy_hw(tty->termios, &old_termios); 545 tty_termios_copy_hw(&tty->termios, &old_termios);
546 546
547 ld = tty_ldisc_ref(tty); 547 ld = tty_ldisc_ref(tty);
548 if (ld != NULL) { 548 if (ld != NULL) {
@@ -578,7 +578,7 @@ static int set_termios(struct tty_struct *tty, void __user *arg, int opt)
578 return retval; 578 return retval;
579 579
580 mutex_lock(&tty->termios_mutex); 580 mutex_lock(&tty->termios_mutex);
581 memcpy(&tmp_termios, tty->termios, sizeof(struct ktermios)); 581 tmp_termios = tty->termios;
582 mutex_unlock(&tty->termios_mutex); 582 mutex_unlock(&tty->termios_mutex);
583 583
584 if (opt & TERMIOS_TERMIO) { 584 if (opt & TERMIOS_TERMIO) {
@@ -632,14 +632,14 @@ static int set_termios(struct tty_struct *tty, void __user *arg, int opt)
632static void copy_termios(struct tty_struct *tty, struct ktermios *kterm) 632static void copy_termios(struct tty_struct *tty, struct ktermios *kterm)
633{ 633{
634 mutex_lock(&tty->termios_mutex); 634 mutex_lock(&tty->termios_mutex);
635 memcpy(kterm, tty->termios, sizeof(struct ktermios)); 635 *kterm = tty->termios;
636 mutex_unlock(&tty->termios_mutex); 636 mutex_unlock(&tty->termios_mutex);
637} 637}
638 638
639static void copy_termios_locked(struct tty_struct *tty, struct ktermios *kterm) 639static void copy_termios_locked(struct tty_struct *tty, struct ktermios *kterm)
640{ 640{
641 mutex_lock(&tty->termios_mutex); 641 mutex_lock(&tty->termios_mutex);
642 memcpy(kterm, tty->termios_locked, sizeof(struct ktermios)); 642 *kterm = tty->termios_locked;
643 mutex_unlock(&tty->termios_mutex); 643 mutex_unlock(&tty->termios_mutex);
644} 644}
645 645
@@ -707,16 +707,16 @@ static int get_sgflags(struct tty_struct *tty)
707{ 707{
708 int flags = 0; 708 int flags = 0;
709 709
710 if (!(tty->termios->c_lflag & ICANON)) { 710 if (!(tty->termios.c_lflag & ICANON)) {
711 if (tty->termios->c_lflag & ISIG) 711 if (tty->termios.c_lflag & ISIG)
712 flags |= 0x02; /* cbreak */ 712 flags |= 0x02; /* cbreak */
713 else 713 else
714 flags |= 0x20; /* raw */ 714 flags |= 0x20; /* raw */
715 } 715 }
716 if (tty->termios->c_lflag & ECHO) 716 if (tty->termios.c_lflag & ECHO)
717 flags |= 0x08; /* echo */ 717 flags |= 0x08; /* echo */
718 if (tty->termios->c_oflag & OPOST) 718 if (tty->termios.c_oflag & OPOST)
719 if (tty->termios->c_oflag & ONLCR) 719 if (tty->termios.c_oflag & ONLCR)
720 flags |= 0x10; /* crmod */ 720 flags |= 0x10; /* crmod */
721 return flags; 721 return flags;
722} 722}
@@ -726,10 +726,10 @@ static int get_sgttyb(struct tty_struct *tty, struct sgttyb __user *sgttyb)
726 struct sgttyb tmp; 726 struct sgttyb tmp;
727 727
728 mutex_lock(&tty->termios_mutex); 728 mutex_lock(&tty->termios_mutex);
729 tmp.sg_ispeed = tty->termios->c_ispeed; 729 tmp.sg_ispeed = tty->termios.c_ispeed;
730 tmp.sg_ospeed = tty->termios->c_ospeed; 730 tmp.sg_ospeed = tty->termios.c_ospeed;
731 tmp.sg_erase = tty->termios->c_cc[VERASE]; 731 tmp.sg_erase = tty->termios.c_cc[VERASE];
732 tmp.sg_kill = tty->termios->c_cc[VKILL]; 732 tmp.sg_kill = tty->termios.c_cc[VKILL];
733 tmp.sg_flags = get_sgflags(tty); 733 tmp.sg_flags = get_sgflags(tty);
734 mutex_unlock(&tty->termios_mutex); 734 mutex_unlock(&tty->termios_mutex);
735 735
@@ -738,27 +738,27 @@ static int get_sgttyb(struct tty_struct *tty, struct sgttyb __user *sgttyb)
738 738
739static void set_sgflags(struct ktermios *termios, int flags) 739static void set_sgflags(struct ktermios *termios, int flags)
740{ 740{
741 termios->c_iflag = ICRNL | IXON; 741 termios.c_iflag = ICRNL | IXON;
742 termios->c_oflag = 0; 742 termios.c_oflag = 0;
743 termios->c_lflag = ISIG | ICANON; 743 termios.c_lflag = ISIG | ICANON;
744 if (flags & 0x02) { /* cbreak */ 744 if (flags & 0x02) { /* cbreak */
745 termios->c_iflag = 0; 745 termios.c_iflag = 0;
746 termios->c_lflag &= ~ICANON; 746 termios.c_lflag &= ~ICANON;
747 } 747 }
748 if (flags & 0x08) { /* echo */ 748 if (flags & 0x08) { /* echo */
749 termios->c_lflag |= ECHO | ECHOE | ECHOK | 749 termios.c_lflag |= ECHO | ECHOE | ECHOK |
750 ECHOCTL | ECHOKE | IEXTEN; 750 ECHOCTL | ECHOKE | IEXTEN;
751 } 751 }
752 if (flags & 0x10) { /* crmod */ 752 if (flags & 0x10) { /* crmod */
753 termios->c_oflag |= OPOST | ONLCR; 753 termios.c_oflag |= OPOST | ONLCR;
754 } 754 }
755 if (flags & 0x20) { /* raw */ 755 if (flags & 0x20) { /* raw */
756 termios->c_iflag = 0; 756 termios.c_iflag = 0;
757 termios->c_lflag &= ~(ISIG | ICANON); 757 termios.c_lflag &= ~(ISIG | ICANON);
758 } 758 }
759 if (!(termios->c_lflag & ICANON)) { 759 if (!(termios.c_lflag & ICANON)) {
760 termios->c_cc[VMIN] = 1; 760 termios.c_cc[VMIN] = 1;
761 termios->c_cc[VTIME] = 0; 761 termios.c_cc[VTIME] = 0;
762 } 762 }
763} 763}
764 764
@@ -787,7 +787,7 @@ static int set_sgttyb(struct tty_struct *tty, struct sgttyb __user *sgttyb)
787 return -EFAULT; 787 return -EFAULT;
788 788
789 mutex_lock(&tty->termios_mutex); 789 mutex_lock(&tty->termios_mutex);
790 termios = *tty->termios; 790 termios = tty->termios;
791 termios.c_cc[VERASE] = tmp.sg_erase; 791 termios.c_cc[VERASE] = tmp.sg_erase;
792 termios.c_cc[VKILL] = tmp.sg_kill; 792 termios.c_cc[VKILL] = tmp.sg_kill;
793 set_sgflags(&termios, tmp.sg_flags); 793 set_sgflags(&termios, tmp.sg_flags);
@@ -808,12 +808,12 @@ static int get_tchars(struct tty_struct *tty, struct tchars __user *tchars)
808 struct tchars tmp; 808 struct tchars tmp;
809 809
810 mutex_lock(&tty->termios_mutex); 810 mutex_lock(&tty->termios_mutex);
811 tmp.t_intrc = tty->termios->c_cc[VINTR]; 811 tmp.t_intrc = tty->termios.c_cc[VINTR];
812 tmp.t_quitc = tty->termios->c_cc[VQUIT]; 812 tmp.t_quitc = tty->termios.c_cc[VQUIT];
813 tmp.t_startc = tty->termios->c_cc[VSTART]; 813 tmp.t_startc = tty->termios.c_cc[VSTART];
814 tmp.t_stopc = tty->termios->c_cc[VSTOP]; 814 tmp.t_stopc = tty->termios.c_cc[VSTOP];
815 tmp.t_eofc = tty->termios->c_cc[VEOF]; 815 tmp.t_eofc = tty->termios.c_cc[VEOF];
816 tmp.t_brkc = tty->termios->c_cc[VEOL2]; /* what is brkc anyway? */ 816 tmp.t_brkc = tty->termios.c_cc[VEOL2]; /* what is brkc anyway? */
817 mutex_unlock(&tty->termios_mutex); 817 mutex_unlock(&tty->termios_mutex);
818 return copy_to_user(tchars, &tmp, sizeof(tmp)) ? -EFAULT : 0; 818 return copy_to_user(tchars, &tmp, sizeof(tmp)) ? -EFAULT : 0;
819} 819}
@@ -825,12 +825,12 @@ static int set_tchars(struct tty_struct *tty, struct tchars __user *tchars)
825 if (copy_from_user(&tmp, tchars, sizeof(tmp))) 825 if (copy_from_user(&tmp, tchars, sizeof(tmp)))
826 return -EFAULT; 826 return -EFAULT;
827 mutex_lock(&tty->termios_mutex); 827 mutex_lock(&tty->termios_mutex);
828 tty->termios->c_cc[VINTR] = tmp.t_intrc; 828 tty->termios.c_cc[VINTR] = tmp.t_intrc;
829 tty->termios->c_cc[VQUIT] = tmp.t_quitc; 829 tty->termios.c_cc[VQUIT] = tmp.t_quitc;
830 tty->termios->c_cc[VSTART] = tmp.t_startc; 830 tty->termios.c_cc[VSTART] = tmp.t_startc;
831 tty->termios->c_cc[VSTOP] = tmp.t_stopc; 831 tty->termios.c_cc[VSTOP] = tmp.t_stopc;
832 tty->termios->c_cc[VEOF] = tmp.t_eofc; 832 tty->termios.c_cc[VEOF] = tmp.t_eofc;
833 tty->termios->c_cc[VEOL2] = tmp.t_brkc; /* what is brkc anyway? */ 833 tty->termios.c_cc[VEOL2] = tmp.t_brkc; /* what is brkc anyway? */
834 mutex_unlock(&tty->termios_mutex); 834 mutex_unlock(&tty->termios_mutex);
835 return 0; 835 return 0;
836} 836}
@@ -842,14 +842,14 @@ static int get_ltchars(struct tty_struct *tty, struct ltchars __user *ltchars)
842 struct ltchars tmp; 842 struct ltchars tmp;
843 843
844 mutex_lock(&tty->termios_mutex); 844 mutex_lock(&tty->termios_mutex);
845 tmp.t_suspc = tty->termios->c_cc[VSUSP]; 845 tmp.t_suspc = tty->termios.c_cc[VSUSP];
846 /* what is dsuspc anyway? */ 846 /* what is dsuspc anyway? */
847 tmp.t_dsuspc = tty->termios->c_cc[VSUSP]; 847 tmp.t_dsuspc = tty->termios.c_cc[VSUSP];
848 tmp.t_rprntc = tty->termios->c_cc[VREPRINT]; 848 tmp.t_rprntc = tty->termios.c_cc[VREPRINT];
849 /* what is flushc anyway? */ 849 /* what is flushc anyway? */
850 tmp.t_flushc = tty->termios->c_cc[VEOL2]; 850 tmp.t_flushc = tty->termios.c_cc[VEOL2];
851 tmp.t_werasc = tty->termios->c_cc[VWERASE]; 851 tmp.t_werasc = tty->termios.c_cc[VWERASE];
852 tmp.t_lnextc = tty->termios->c_cc[VLNEXT]; 852 tmp.t_lnextc = tty->termios.c_cc[VLNEXT];
853 mutex_unlock(&tty->termios_mutex); 853 mutex_unlock(&tty->termios_mutex);
854 return copy_to_user(ltchars, &tmp, sizeof(tmp)) ? -EFAULT : 0; 854 return copy_to_user(ltchars, &tmp, sizeof(tmp)) ? -EFAULT : 0;
855} 855}
@@ -862,14 +862,14 @@ static int set_ltchars(struct tty_struct *tty, struct ltchars __user *ltchars)
862 return -EFAULT; 862 return -EFAULT;
863 863
864 mutex_lock(&tty->termios_mutex); 864 mutex_lock(&tty->termios_mutex);
865 tty->termios->c_cc[VSUSP] = tmp.t_suspc; 865 tty->termios.c_cc[VSUSP] = tmp.t_suspc;
866 /* what is dsuspc anyway? */ 866 /* what is dsuspc anyway? */
867 tty->termios->c_cc[VEOL2] = tmp.t_dsuspc; 867 tty->termios.c_cc[VEOL2] = tmp.t_dsuspc;
868 tty->termios->c_cc[VREPRINT] = tmp.t_rprntc; 868 tty->termios.c_cc[VREPRINT] = tmp.t_rprntc;
869 /* what is flushc anyway? */ 869 /* what is flushc anyway? */
870 tty->termios->c_cc[VEOL2] = tmp.t_flushc; 870 tty->termios.c_cc[VEOL2] = tmp.t_flushc;
871 tty->termios->c_cc[VWERASE] = tmp.t_werasc; 871 tty->termios.c_cc[VWERASE] = tmp.t_werasc;
872 tty->termios->c_cc[VLNEXT] = tmp.t_lnextc; 872 tty->termios.c_cc[VLNEXT] = tmp.t_lnextc;
873 mutex_unlock(&tty->termios_mutex); 873 mutex_unlock(&tty->termios_mutex);
874 return 0; 874 return 0;
875} 875}
@@ -920,12 +920,12 @@ static int tty_change_softcar(struct tty_struct *tty, int arg)
920 struct ktermios old; 920 struct ktermios old;
921 921
922 mutex_lock(&tty->termios_mutex); 922 mutex_lock(&tty->termios_mutex);
923 old = *tty->termios; 923 old = tty->termios;
924 tty->termios->c_cflag &= ~CLOCAL; 924 tty->termios.c_cflag &= ~CLOCAL;
925 tty->termios->c_cflag |= bit; 925 tty->termios.c_cflag |= bit;
926 if (tty->ops->set_termios) 926 if (tty->ops->set_termios)
927 tty->ops->set_termios(tty, &old); 927 tty->ops->set_termios(tty, &old);
928 if ((tty->termios->c_cflag & CLOCAL) != bit) 928 if ((tty->termios.c_cflag & CLOCAL) != bit)
929 ret = -EINVAL; 929 ret = -EINVAL;
930 mutex_unlock(&tty->termios_mutex); 930 mutex_unlock(&tty->termios_mutex);
931 return ret; 931 return ret;
@@ -1031,7 +1031,7 @@ int tty_mode_ioctl(struct tty_struct *tty, struct file *file,
1031 (struct termios __user *) arg)) 1031 (struct termios __user *) arg))
1032 return -EFAULT; 1032 return -EFAULT;
1033 mutex_lock(&real_tty->termios_mutex); 1033 mutex_lock(&real_tty->termios_mutex);
1034 memcpy(real_tty->termios_locked, &kterm, sizeof(struct ktermios)); 1034 real_tty->termios_locked = kterm;
1035 mutex_unlock(&real_tty->termios_mutex); 1035 mutex_unlock(&real_tty->termios_mutex);
1036 return 0; 1036 return 0;
1037#else 1037#else
@@ -1048,7 +1048,7 @@ int tty_mode_ioctl(struct tty_struct *tty, struct file *file,
1048 (struct termios __user *) arg)) 1048 (struct termios __user *) arg))
1049 return -EFAULT; 1049 return -EFAULT;
1050 mutex_lock(&real_tty->termios_mutex); 1050 mutex_lock(&real_tty->termios_mutex);
1051 memcpy(real_tty->termios_locked, &kterm, sizeof(struct ktermios)); 1051 real_tty->termios_locked = kterm;
1052 mutex_unlock(&real_tty->termios_mutex); 1052 mutex_unlock(&real_tty->termios_mutex);
1053 return ret; 1053 return ret;
1054#endif 1054#endif
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
index 6f99c9959f0c..e6156c60d190 100644
--- a/drivers/tty/tty_ldisc.c
+++ b/drivers/tty/tty_ldisc.c
@@ -413,7 +413,7 @@ EXPORT_SYMBOL_GPL(tty_ldisc_flush);
413static void tty_set_termios_ldisc(struct tty_struct *tty, int num) 413static void tty_set_termios_ldisc(struct tty_struct *tty, int num)
414{ 414{
415 mutex_lock(&tty->termios_mutex); 415 mutex_lock(&tty->termios_mutex);
416 tty->termios->c_line = num; 416 tty->termios.c_line = num;
417 mutex_unlock(&tty->termios_mutex); 417 mutex_unlock(&tty->termios_mutex);
418} 418}
419 419
@@ -722,9 +722,9 @@ enable:
722static void tty_reset_termios(struct tty_struct *tty) 722static void tty_reset_termios(struct tty_struct *tty)
723{ 723{
724 mutex_lock(&tty->termios_mutex); 724 mutex_lock(&tty->termios_mutex);
725 *tty->termios = tty->driver->init_termios; 725 tty->termios = tty->driver->init_termios;
726 tty->termios->c_ispeed = tty_termios_input_baud_rate(tty->termios); 726 tty->termios.c_ispeed = tty_termios_input_baud_rate(&tty->termios);
727 tty->termios->c_ospeed = tty_termios_baud_rate(tty->termios); 727 tty->termios.c_ospeed = tty_termios_baud_rate(&tty->termios);
728 mutex_unlock(&tty->termios_mutex); 728 mutex_unlock(&tty->termios_mutex);
729} 729}
730 730
@@ -846,7 +846,7 @@ retry:
846 846
847 if (reset == 0) { 847 if (reset == 0) {
848 848
849 if (!tty_ldisc_reinit(tty, tty->termios->c_line)) 849 if (!tty_ldisc_reinit(tty, tty->termios.c_line))
850 err = tty_ldisc_open(tty, tty->ldisc); 850 err = tty_ldisc_open(tty, tty->ldisc);
851 else 851 else
852 err = 1; 852 err = 1;
diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c
index 4e9d2b291f4a..edcb827c1286 100644
--- a/drivers/tty/tty_port.c
+++ b/drivers/tty/tty_port.c
@@ -255,7 +255,7 @@ int tty_port_block_til_ready(struct tty_port *port,
255 } 255 }
256 if (filp->f_flags & O_NONBLOCK) { 256 if (filp->f_flags & O_NONBLOCK) {
257 /* Indicate we are open */ 257 /* Indicate we are open */
258 if (tty->termios->c_cflag & CBAUD) 258 if (tty->termios.c_cflag & CBAUD)
259 tty_port_raise_dtr_rts(port); 259 tty_port_raise_dtr_rts(port);
260 port->flags |= ASYNC_NORMAL_ACTIVE; 260 port->flags |= ASYNC_NORMAL_ACTIVE;
261 return 0; 261 return 0;
@@ -279,7 +279,7 @@ int tty_port_block_til_ready(struct tty_port *port,
279 279
280 while (1) { 280 while (1) {
281 /* Indicate we are open */ 281 /* Indicate we are open */
282 if (tty->termios->c_cflag & CBAUD) 282 if (tty->termios.c_cflag & CBAUD)
283 tty_port_raise_dtr_rts(port); 283 tty_port_raise_dtr_rts(port);
284 284
285 prepare_to_wait(&port->open_wait, &wait, TASK_INTERRUPTIBLE); 285 prepare_to_wait(&port->open_wait, &wait, TASK_INTERRUPTIBLE);
@@ -378,7 +378,7 @@ int tty_port_close_start(struct tty_port *port,
378 378
379 /* Drop DTR/RTS if HUPCL is set. This causes any attached modem to 379 /* Drop DTR/RTS if HUPCL is set. This causes any attached modem to
380 hang up the line */ 380 hang up the line */
381 if (tty->termios->c_cflag & HUPCL) 381 if (tty->termios.c_cflag & HUPCL)
382 tty_port_lower_dtr_rts(port); 382 tty_port_lower_dtr_rts(port);
383 383
384 /* Don't call port->drop for the last reference. Callers will want 384 /* Don't call port->drop for the last reference. Callers will want
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 7cb53c236339..dbceaeb2c3eb 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -2823,9 +2823,9 @@ static int con_install(struct tty_driver *driver, struct tty_struct *tty)
2823 tty->winsize.ws_col = vc_cons[currcons].d->vc_cols; 2823 tty->winsize.ws_col = vc_cons[currcons].d->vc_cols;
2824 } 2824 }
2825 if (vc->vc_utf) 2825 if (vc->vc_utf)
2826 tty->termios->c_iflag |= IUTF8; 2826 tty->termios.c_iflag |= IUTF8;
2827 else 2827 else
2828 tty->termios->c_iflag &= ~IUTF8; 2828 tty->termios.c_iflag &= ~IUTF8;
2829unlock: 2829unlock:
2830 console_unlock(); 2830 console_unlock();
2831 return ret; 2831 return ret;