aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2009-01-02 08:47:45 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-02 13:19:41 -0500
commitac9720c37e8795317e8be3adad63cb0d5522a640 (patch)
treedc95934f775b7867552ef230756fa6726740216b /drivers/net
parente136e3036bf27569dbfeae245cc09c7167cdc749 (diff)
tty: Fix the HSO termios handling a bit
Init the tty structure once Don't set ->low_latency twice in a row Don't force bits we should be leaving to the user Don't allocate termios arrays as these are in fact allocated by the tty layer for you and just overwrite the ones allocated in the driver Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/usb/hso.c55
1 files changed, 31 insertions, 24 deletions
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index d345a6eec4ca..7373fb6b3f88 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -362,8 +362,6 @@ static struct tty_driver *tty_drv;
362static struct hso_device *serial_table[HSO_SERIAL_TTY_MINORS]; 362static struct hso_device *serial_table[HSO_SERIAL_TTY_MINORS];
363static struct hso_device *network_table[HSO_MAX_NET_DEVICES]; 363static struct hso_device *network_table[HSO_MAX_NET_DEVICES];
364static spinlock_t serial_table_lock; 364static spinlock_t serial_table_lock;
365static struct ktermios *hso_serial_termios[HSO_SERIAL_TTY_MINORS];
366static struct ktermios *hso_serial_termios_locked[HSO_SERIAL_TTY_MINORS];
367 365
368static const s32 default_port_spec[] = { 366static const s32 default_port_spec[] = {
369 HSO_INTF_MUX | HSO_PORT_NETWORK, 367 HSO_INTF_MUX | HSO_PORT_NETWORK,
@@ -1009,23 +1007,11 @@ static void read_bulk_callback(struct urb *urb)
1009 1007
1010/* Serial driver functions */ 1008/* Serial driver functions */
1011 1009
1012static void _hso_serial_set_termios(struct tty_struct *tty, 1010static void hso_init_termios(struct ktermios *termios)
1013 struct ktermios *old)
1014{ 1011{
1015 struct hso_serial *serial = get_serial_by_tty(tty);
1016 struct ktermios *termios;
1017
1018 if (!serial) {
1019 printk(KERN_ERR "%s: no tty structures", __func__);
1020 return;
1021 }
1022
1023 D4("port %d", serial->minor);
1024
1025 /* 1012 /*
1026 * The default requirements for this device are: 1013 * The default requirements for this device are:
1027 */ 1014 */
1028 termios = tty->termios;
1029 termios->c_iflag &= 1015 termios->c_iflag &=
1030 ~(IGNBRK /* disable ignore break */ 1016 ~(IGNBRK /* disable ignore break */
1031 | BRKINT /* disable break causes interrupt */ 1017 | BRKINT /* disable break causes interrupt */
@@ -1057,15 +1043,38 @@ static void _hso_serial_set_termios(struct tty_struct *tty,
1057 termios->c_cflag |= CS8; /* character size 8 bits */ 1043 termios->c_cflag |= CS8; /* character size 8 bits */
1058 1044
1059 /* baud rate 115200 */ 1045 /* baud rate 115200 */
1060 tty_encode_baud_rate(tty, 115200, 115200); 1046 tty_termios_encode_baud_rate(termios, 115200, 115200);
1047}
1048
1049static void _hso_serial_set_termios(struct tty_struct *tty,
1050 struct ktermios *old)
1051{
1052 struct hso_serial *serial = get_serial_by_tty(tty);
1053 struct ktermios *termios;
1054
1055 if (!serial) {
1056 printk(KERN_ERR "%s: no tty structures", __func__);
1057 return;
1058 }
1059
1060 D4("port %d", serial->minor);
1061 1061
1062 /* 1062 /*
1063 * Force low_latency on; otherwise the pushes are scheduled; 1063 * Fix up unsupported bits
1064 * this is bad as it opens up the possibility of dropping bytes
1065 * on the floor. We don't want to drop bytes on the floor. :)
1066 */ 1064 */
1067 tty->low_latency = 1; 1065 termios = tty->termios;
1068 return; 1066 termios->c_iflag &= ~IXON; /* disable enable XON/XOFF flow control */
1067
1068 termios->c_cflag &=
1069 ~(CSIZE /* no size */
1070 | PARENB /* disable parity bit */
1071 | CBAUD /* clear current baud rate */
1072 | CBAUDEX); /* clear current buad rate */
1073
1074 termios->c_cflag |= CS8; /* character size 8 bits */
1075
1076 /* baud rate 115200 */
1077 tty_encode_baud_rate(tty, 115200, 115200);
1069} 1078}
1070 1079
1071static void hso_resubmit_rx_bulk_urb(struct hso_serial *serial, struct urb *urb) 1080static void hso_resubmit_rx_bulk_urb(struct hso_serial *serial, struct urb *urb)
@@ -2969,9 +2978,7 @@ static int __init hso_init(void)
2969 tty_drv->subtype = SERIAL_TYPE_NORMAL; 2978 tty_drv->subtype = SERIAL_TYPE_NORMAL;
2970 tty_drv->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; 2979 tty_drv->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
2971 tty_drv->init_termios = tty_std_termios; 2980 tty_drv->init_termios = tty_std_termios;
2972 tty_drv->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; 2981 hso_init_termios(&tty_drv->init_termios);
2973 tty_drv->termios = hso_serial_termios;
2974 tty_drv->termios_locked = hso_serial_termios_locked;
2975 tty_set_operations(tty_drv, &hso_serial_ops); 2982 tty_set_operations(tty_drv, &hso_serial_ops);
2976 2983
2977 /* register the tty driver */ 2984 /* register the tty driver */