diff options
author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2007-10-18 04:24:20 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-10-25 15:18:41 -0400 |
commit | 74240b07a908e09e18fa09f2cba44f212be9c4c3 (patch) | |
tree | fcc756264d57bad1fb9fd555f3d5021048aa24ae /drivers/usb | |
parent | 560aac22e1dce7c7e9756a0a4450ca3bae58fcd5 (diff) |
USB: keyspan termios tidy
- Clear unsupported CMSPAR bit
- Clean up long chains of a->b-> a bit
- Encode baud rate back into tty structure 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')
-rw-r--r-- | drivers/usb/serial/keyspan.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index f2a6fce5de1e..6bfdba6a213f 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c | |||
@@ -278,29 +278,35 @@ static void keyspan_set_termios (struct usb_serial_port *port, | |||
278 | struct keyspan_port_private *p_priv; | 278 | struct keyspan_port_private *p_priv; |
279 | const struct keyspan_device_details *d_details; | 279 | const struct keyspan_device_details *d_details; |
280 | unsigned int cflag; | 280 | unsigned int cflag; |
281 | struct tty_struct *tty = port->tty; | ||
281 | 282 | ||
282 | dbg("%s", __FUNCTION__); | 283 | dbg("%s", __FUNCTION__); |
283 | 284 | ||
284 | p_priv = usb_get_serial_port_data(port); | 285 | p_priv = usb_get_serial_port_data(port); |
285 | d_details = p_priv->device_details; | 286 | d_details = p_priv->device_details; |
286 | cflag = port->tty->termios->c_cflag; | 287 | cflag = tty->termios->c_cflag; |
287 | device_port = port->number - port->serial->minor; | 288 | device_port = port->number - port->serial->minor; |
288 | 289 | ||
289 | /* Baud rate calculation takes baud rate as an integer | 290 | /* Baud rate calculation takes baud rate as an integer |
290 | so other rates can be generated if desired. */ | 291 | so other rates can be generated if desired. */ |
291 | baud_rate = tty_get_baud_rate(port->tty); | 292 | baud_rate = tty_get_baud_rate(tty); |
292 | /* If no match or invalid, don't change */ | 293 | /* If no match or invalid, don't change */ |
293 | if (baud_rate >= 0 | 294 | if (d_details->calculate_baud_rate(baud_rate, d_details->baudclk, |
294 | && d_details->calculate_baud_rate(baud_rate, d_details->baudclk, | ||
295 | NULL, NULL, NULL, device_port) == KEYSPAN_BAUD_RATE_OK) { | 295 | NULL, NULL, NULL, device_port) == KEYSPAN_BAUD_RATE_OK) { |
296 | /* FIXME - more to do here to ensure rate changes cleanly */ | 296 | /* FIXME - more to do here to ensure rate changes cleanly */ |
297 | /* FIXME - calcuate exact rate from divisor ? */ | ||
297 | p_priv->baud = baud_rate; | 298 | p_priv->baud = baud_rate; |
298 | } | 299 | } else |
300 | baud_rate = tty_termios_baud_rate(old_termios); | ||
299 | 301 | ||
302 | tty_encode_baud_rate(tty, baud_rate, baud_rate); | ||
300 | /* set CTS/RTS handshake etc. */ | 303 | /* set CTS/RTS handshake etc. */ |
301 | p_priv->cflag = cflag; | 304 | p_priv->cflag = cflag; |
302 | p_priv->flow_control = (cflag & CRTSCTS)? flow_cts: flow_none; | 305 | p_priv->flow_control = (cflag & CRTSCTS)? flow_cts: flow_none; |
303 | 306 | ||
307 | /* Mark/Space not supported */ | ||
308 | tty->termios->c_cflag &= ~CMSPAR; | ||
309 | |||
304 | keyspan_send_setup(port, 0); | 310 | keyspan_send_setup(port, 0); |
305 | } | 311 | } |
306 | 312 | ||