aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/tty_io.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/tty_io.c')
-rw-r--r--drivers/tty/tty_io.c26
1 files changed, 8 insertions, 18 deletions
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;