diff options
author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2007-10-18 04:24:17 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-10-25 15:18:40 -0400 |
commit | adb5dca17dde297b685d57ec68fa0e5490feee8b (patch) | |
tree | 473157128883bf2fe66f3d90cc179832f930eecc /drivers/usb/serial/ark3116.c | |
parent | 149b36eae2ab6aa6056664f4bc461f3d3affc9c1 (diff) |
USB: ark3116: update termios handling
- Set the i/ospeed in the initial termios properly
- Use the tty_encode_baud_rate functions to report resulting rates properly
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/ark3116.c')
-rw-r--r-- | drivers/usb/serial/ark3116.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index 2a8e537cb046..ddfee918000d 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c | |||
@@ -161,7 +161,8 @@ static void ark3116_set_termios(struct usb_serial_port *port, | |||
161 | { | 161 | { |
162 | struct usb_serial *serial = port->serial; | 162 | struct usb_serial *serial = port->serial; |
163 | struct ark3116_private *priv = usb_get_serial_port_data(port); | 163 | struct ark3116_private *priv = usb_get_serial_port_data(port); |
164 | unsigned int cflag = port->tty->termios->c_cflag; | 164 | struct ktermios *termios = port->tty->termios; |
165 | unsigned int cflag = termios->c_cflag; | ||
165 | unsigned long flags; | 166 | unsigned long flags; |
166 | int baud; | 167 | int baud; |
167 | int ark3116_baud; | 168 | int ark3116_baud; |
@@ -177,11 +178,14 @@ static void ark3116_set_termios(struct usb_serial_port *port, | |||
177 | *(port->tty->termios) = tty_std_termios; | 178 | *(port->tty->termios) = tty_std_termios; |
178 | port->tty->termios->c_cflag = B9600 | CS8 | 179 | port->tty->termios->c_cflag = B9600 | CS8 |
179 | | CREAD | HUPCL | CLOCAL; | 180 | | CREAD | HUPCL | CLOCAL; |
181 | termios->c_ispeed = 9600; | ||
182 | termios->c_ospeed = 9600; | ||
180 | priv->termios_initialized = 1; | 183 | priv->termios_initialized = 1; |
181 | } | 184 | } |
182 | spin_unlock_irqrestore(&priv->lock, flags); | 185 | spin_unlock_irqrestore(&priv->lock, flags); |
183 | 186 | ||
184 | cflag = port->tty->termios->c_cflag; | 187 | cflag = termios->c_cflag; |
188 | termios->c_cflag &= ~(CMSPAR|CRTSCTS); | ||
185 | 189 | ||
186 | buf = kmalloc(1, GFP_KERNEL); | 190 | buf = kmalloc(1, GFP_KERNEL); |
187 | if (!buf) { | 191 | if (!buf) { |
@@ -254,9 +258,13 @@ static void ark3116_set_termios(struct usb_serial_port *port, | |||
254 | case 115200: | 258 | case 115200: |
255 | case 230400: | 259 | case 230400: |
256 | case 460800: | 260 | case 460800: |
261 | /* Report the resulting rate back to the caller */ | ||
262 | tty_encode_baud_rate(port->tty, baud, baud); | ||
257 | break; | 263 | break; |
258 | /* set 9600 as default (if given baudrate is invalid for example) */ | 264 | /* set 9600 as default (if given baudrate is invalid for example) */ |
259 | default: | 265 | default: |
266 | tty_encode_baud_rate(port->tty, 9600, 9600); | ||
267 | case 0: | ||
260 | baud = 9600; | 268 | baud = 9600; |
261 | } | 269 | } |
262 | 270 | ||
@@ -302,6 +310,7 @@ static void ark3116_set_termios(struct usb_serial_port *port, | |||
302 | /* TEST ARK3116_SND(154, 0xFE, 0x40, 0xFFFF, 0x0006); */ | 310 | /* TEST ARK3116_SND(154, 0xFE, 0x40, 0xFFFF, 0x0006); */ |
303 | 311 | ||
304 | kfree(buf); | 312 | kfree(buf); |
313 | |||
305 | return; | 314 | return; |
306 | } | 315 | } |
307 | 316 | ||