diff options
author | Alan Cox <alan@linux.intel.com> | 2012-07-14 10:31:47 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-07-16 16:00:41 -0400 |
commit | adc8d746caa67fff4b53ba3e5163a6cbacc3b523 (patch) | |
tree | e3f6c05f27c163b369ddd4da5f31d2a61bde6d3a /drivers/net | |
parent | 6d31a88cb2e01d46c0cb74aa5da529e1f92ae3db (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/net')
-rw-r--r-- | drivers/net/irda/irtty-sir.c | 10 | ||||
-rw-r--r-- | drivers/net/usb/hso.c | 12 |
2 files changed, 10 insertions, 12 deletions
diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c index 3352b2443e58..30087ca23a0f 100644 --- a/drivers/net/irda/irtty-sir.c +++ b/drivers/net/irda/irtty-sir.c | |||
@@ -124,8 +124,8 @@ static int irtty_change_speed(struct sir_dev *dev, unsigned speed) | |||
124 | tty = priv->tty; | 124 | tty = priv->tty; |
125 | 125 | ||
126 | mutex_lock(&tty->termios_mutex); | 126 | mutex_lock(&tty->termios_mutex); |
127 | old_termios = *(tty->termios); | 127 | old_termios = tty->termios; |
128 | cflag = tty->termios->c_cflag; | 128 | cflag = tty->termios.c_cflag; |
129 | tty_encode_baud_rate(tty, speed, speed); | 129 | tty_encode_baud_rate(tty, speed, speed); |
130 | if (tty->ops->set_termios) | 130 | if (tty->ops->set_termios) |
131 | tty->ops->set_termios(tty, &old_termios); | 131 | tty->ops->set_termios(tty, &old_termios); |
@@ -281,15 +281,15 @@ static inline void irtty_stop_receiver(struct tty_struct *tty, int stop) | |||
281 | int cflag; | 281 | int cflag; |
282 | 282 | ||
283 | mutex_lock(&tty->termios_mutex); | 283 | mutex_lock(&tty->termios_mutex); |
284 | old_termios = *(tty->termios); | 284 | old_termios = tty->termios; |
285 | cflag = tty->termios->c_cflag; | 285 | cflag = tty->termios.c_cflag; |
286 | 286 | ||
287 | if (stop) | 287 | if (stop) |
288 | cflag &= ~CREAD; | 288 | cflag &= ~CREAD; |
289 | else | 289 | else |
290 | cflag |= CREAD; | 290 | cflag |= CREAD; |
291 | 291 | ||
292 | tty->termios->c_cflag = cflag; | 292 | tty->termios.c_cflag = cflag; |
293 | if (tty->ops->set_termios) | 293 | if (tty->ops->set_termios) |
294 | tty->ops->set_termios(tty, &old_termios); | 294 | tty->ops->set_termios(tty, &old_termios); |
295 | mutex_unlock(&tty->termios_mutex); | 295 | mutex_unlock(&tty->termios_mutex); |
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index 62f30b46fa42..7736af75e12b 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c | |||
@@ -1107,7 +1107,6 @@ static void _hso_serial_set_termios(struct tty_struct *tty, | |||
1107 | struct ktermios *old) | 1107 | struct ktermios *old) |
1108 | { | 1108 | { |
1109 | struct hso_serial *serial = tty->driver_data; | 1109 | struct hso_serial *serial = tty->driver_data; |
1110 | struct ktermios *termios; | ||
1111 | 1110 | ||
1112 | if (!serial) { | 1111 | if (!serial) { |
1113 | printk(KERN_ERR "%s: no tty structures", __func__); | 1112 | printk(KERN_ERR "%s: no tty structures", __func__); |
@@ -1119,16 +1118,15 @@ static void _hso_serial_set_termios(struct tty_struct *tty, | |||
1119 | /* | 1118 | /* |
1120 | * Fix up unsupported bits | 1119 | * Fix up unsupported bits |
1121 | */ | 1120 | */ |
1122 | termios = tty->termios; | 1121 | tty->termios.c_iflag &= ~IXON; /* disable enable XON/XOFF flow control */ |
1123 | termios->c_iflag &= ~IXON; /* disable enable XON/XOFF flow control */ | ||
1124 | 1122 | ||
1125 | termios->c_cflag &= | 1123 | tty->termios.c_cflag &= |
1126 | ~(CSIZE /* no size */ | 1124 | ~(CSIZE /* no size */ |
1127 | | PARENB /* disable parity bit */ | 1125 | | PARENB /* disable parity bit */ |
1128 | | CBAUD /* clear current baud rate */ | 1126 | | CBAUD /* clear current baud rate */ |
1129 | | CBAUDEX); /* clear current buad rate */ | 1127 | | CBAUDEX); /* clear current buad rate */ |
1130 | 1128 | ||
1131 | termios->c_cflag |= CS8; /* character size 8 bits */ | 1129 | tty->termios.c_cflag |= CS8; /* character size 8 bits */ |
1132 | 1130 | ||
1133 | /* baud rate 115200 */ | 1131 | /* baud rate 115200 */ |
1134 | tty_encode_baud_rate(tty, 115200, 115200); | 1132 | tty_encode_baud_rate(tty, 115200, 115200); |
@@ -1425,14 +1423,14 @@ static void hso_serial_set_termios(struct tty_struct *tty, struct ktermios *old) | |||
1425 | 1423 | ||
1426 | if (old) | 1424 | if (old) |
1427 | D5("Termios called with: cflags new[%d] - old[%d]", | 1425 | D5("Termios called with: cflags new[%d] - old[%d]", |
1428 | tty->termios->c_cflag, old->c_cflag); | 1426 | tty->termios.c_cflag, old->c_cflag); |
1429 | 1427 | ||
1430 | /* the actual setup */ | 1428 | /* the actual setup */ |
1431 | spin_lock_irqsave(&serial->serial_lock, flags); | 1429 | spin_lock_irqsave(&serial->serial_lock, flags); |
1432 | if (serial->port.count) | 1430 | if (serial->port.count) |
1433 | _hso_serial_set_termios(tty, old); | 1431 | _hso_serial_set_termios(tty, old); |
1434 | else | 1432 | else |
1435 | tty->termios = old; | 1433 | tty->termios = *old; |
1436 | spin_unlock_irqrestore(&serial->serial_lock, flags); | 1434 | spin_unlock_irqrestore(&serial->serial_lock, flags); |
1437 | 1435 | ||
1438 | /* done */ | 1436 | /* done */ |