diff options
author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2008-01-03 11:57:33 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-02-01 17:35:00 -0500 |
commit | d5f5bcd425b771c0b7ff5a650b2ce061ac8bbb87 (patch) | |
tree | ecff8e29d62111338f1e1a4435cd7ea669572a2c /drivers/usb/serial/io_ti.c | |
parent | 537699ef53f8b97546f0845bf51a49c9ab114a13 (diff) |
USB: io_ti: clean up termios handling
Don't pass NULL into termios functions when calling them internally
Remove all the crap which then checks for NULL which can't occur now
Clear CMSPAR as it is not supported
Report the baud rate back to the caller properly (See FIXME someone with
the docs)
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/io_ti.c')
-rw-r--r-- | drivers/usb/serial/io_ti.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index f7fdf1ce6bf3..cd3405953f74 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c | |||
@@ -1979,7 +1979,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) | |||
1979 | } | 1979 | } |
1980 | 1980 | ||
1981 | /* set up the port settings */ | 1981 | /* set up the port settings */ |
1982 | edge_set_termios (port, NULL); | 1982 | edge_set_termios (port, port->tty->termios); |
1983 | 1983 | ||
1984 | /* open up the port */ | 1984 | /* open up the port */ |
1985 | 1985 | ||
@@ -2394,11 +2394,6 @@ static void change_port_settings (struct edgeport_port *edge_port, struct ktermi | |||
2394 | dbg("%s - port %d", __FUNCTION__, edge_port->port->number); | 2394 | dbg("%s - port %d", __FUNCTION__, edge_port->port->number); |
2395 | 2395 | ||
2396 | tty = edge_port->port->tty; | 2396 | tty = edge_port->port->tty; |
2397 | if ((!tty) || | ||
2398 | (!tty->termios)) { | ||
2399 | dbg("%s - no tty structures", __FUNCTION__); | ||
2400 | return; | ||
2401 | } | ||
2402 | 2397 | ||
2403 | config = kmalloc (sizeof (*config), GFP_KERNEL); | 2398 | config = kmalloc (sizeof (*config), GFP_KERNEL); |
2404 | if (!config) { | 2399 | if (!config) { |
@@ -2493,15 +2488,21 @@ static void change_port_settings (struct edgeport_port *edge_port, struct ktermi | |||
2493 | } | 2488 | } |
2494 | } | 2489 | } |
2495 | 2490 | ||
2491 | tty->termios->c_cflag &= ~CMSPAR; | ||
2492 | |||
2496 | /* Round the baud rate */ | 2493 | /* Round the baud rate */ |
2497 | baud = tty_get_baud_rate(tty); | 2494 | baud = tty_get_baud_rate(tty); |
2498 | if (!baud) { | 2495 | if (!baud) { |
2499 | /* pick a default, any default... */ | 2496 | /* pick a default, any default... */ |
2500 | baud = 9600; | 2497 | baud = 9600; |
2501 | } | 2498 | } else |
2499 | tty_encode_baud_rate(tty, baud, baud); | ||
2500 | |||
2502 | edge_port->baud_rate = baud; | 2501 | edge_port->baud_rate = baud; |
2503 | config->wBaudRate = (__u16)((461550L + baud/2) / baud); | 2502 | config->wBaudRate = (__u16)((461550L + baud/2) / baud); |
2504 | 2503 | ||
2504 | /* FIXME: Recompute actual baud from divisor here */ | ||
2505 | |||
2505 | dbg ("%s - baud rate = %d, wBaudRate = %d", __FUNCTION__, baud, config->wBaudRate); | 2506 | dbg ("%s - baud rate = %d, wBaudRate = %d", __FUNCTION__, baud, config->wBaudRate); |
2506 | 2507 | ||
2507 | dbg ("wBaudRate: %d", (int)(461550L / config->wBaudRate)); | 2508 | dbg ("wBaudRate: %d", (int)(461550L / config->wBaudRate)); |
@@ -2539,19 +2540,12 @@ static void edge_set_termios (struct usb_serial_port *port, struct ktermios *old | |||
2539 | struct tty_struct *tty = port->tty; | 2540 | struct tty_struct *tty = port->tty; |
2540 | unsigned int cflag; | 2541 | unsigned int cflag; |
2541 | 2542 | ||
2542 | if (!port->tty || !port->tty->termios) { | ||
2543 | dbg ("%s - no tty or termios", __FUNCTION__); | ||
2544 | return; | ||
2545 | } | ||
2546 | |||
2547 | cflag = tty->termios->c_cflag; | 2543 | cflag = tty->termios->c_cflag; |
2548 | 2544 | ||
2549 | dbg("%s - clfag %08x iflag %08x", __FUNCTION__, | 2545 | dbg("%s - clfag %08x iflag %08x", __FUNCTION__, |
2550 | tty->termios->c_cflag, tty->termios->c_iflag); | 2546 | tty->termios->c_cflag, tty->termios->c_iflag); |
2551 | if (old_termios) { | 2547 | dbg("%s - old clfag %08x old iflag %08x", __FUNCTION__, |
2552 | dbg("%s - old clfag %08x old iflag %08x", __FUNCTION__, | 2548 | old_termios->c_cflag, old_termios->c_iflag); |
2553 | old_termios->c_cflag, old_termios->c_iflag); | ||
2554 | } | ||
2555 | 2549 | ||
2556 | dbg("%s - port %d", __FUNCTION__, port->number); | 2550 | dbg("%s - port %d", __FUNCTION__, port->number); |
2557 | 2551 | ||