aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/oti6858.c
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2009-09-19 16:13:33 -0400
committerLive-CD User <linux@linux.site>2009-09-19 16:13:33 -0400
commitfe1ae7fdd2ee603f2d95f04e09a68f7f79045127 (patch)
tree1234647e3bd970cfb105dab1c4f0ad2cd14ce179 /drivers/usb/serial/oti6858.c
parentba15ab0e8de0d4439a91342ad52d55ca9e313f3d (diff)
tty: USB serial termios bits
Various drivers have hacks to mangle termios structures. This stems from the fact there is no nice setup hook for configuring the termios settings when the port is created Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/oti6858.c')
-rw-r--r--drivers/usb/serial/oti6858.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c
index e90f88a3b040..0f4a70ce3823 100644
--- a/drivers/usb/serial/oti6858.c
+++ b/drivers/usb/serial/oti6858.c
@@ -145,6 +145,7 @@ static int oti6858_open(struct tty_struct *tty, struct usb_serial_port *port);
145static void oti6858_close(struct usb_serial_port *port); 145static void oti6858_close(struct usb_serial_port *port);
146static void oti6858_set_termios(struct tty_struct *tty, 146static void oti6858_set_termios(struct tty_struct *tty,
147 struct usb_serial_port *port, struct ktermios *old); 147 struct usb_serial_port *port, struct ktermios *old);
148static void oti6858_init_termios(struct tty_struct *tty);
148static int oti6858_ioctl(struct tty_struct *tty, struct file *file, 149static int oti6858_ioctl(struct tty_struct *tty, struct file *file,
149 unsigned int cmd, unsigned long arg); 150 unsigned int cmd, unsigned long arg);
150static void oti6858_read_int_callback(struct urb *urb); 151static void oti6858_read_int_callback(struct urb *urb);
@@ -185,6 +186,7 @@ static struct usb_serial_driver oti6858_device = {
185 .write = oti6858_write, 186 .write = oti6858_write,
186 .ioctl = oti6858_ioctl, 187 .ioctl = oti6858_ioctl,
187 .set_termios = oti6858_set_termios, 188 .set_termios = oti6858_set_termios,
189 .init_termios = oti6858_init_termios,
188 .tiocmget = oti6858_tiocmget, 190 .tiocmget = oti6858_tiocmget,
189 .tiocmset = oti6858_tiocmset, 191 .tiocmset = oti6858_tiocmset,
190 .read_bulk_callback = oti6858_read_bulk_callback, 192 .read_bulk_callback = oti6858_read_bulk_callback,
@@ -205,7 +207,6 @@ struct oti6858_private {
205 struct { 207 struct {
206 u8 read_urb_in_use; 208 u8 read_urb_in_use;
207 u8 write_urb_in_use; 209 u8 write_urb_in_use;
208 u8 termios_initialized;
209 } flags; 210 } flags;
210 struct delayed_work delayed_write_work; 211 struct delayed_work delayed_write_work;
211 212
@@ -446,6 +447,14 @@ static int oti6858_chars_in_buffer(struct tty_struct *tty)
446 return chars; 447 return chars;
447} 448}
448 449
450static void oti6858_init_termios(struct tty_struct *tty)
451{
452 *(tty->termios) = tty_std_termios;
453 tty->termios->c_cflag = B38400 | CS8 | CREAD | HUPCL | CLOCAL;
454 tty->termios->c_ispeed = 38400;
455 tty->termios->c_ospeed = 38400;
456}
457
449static void oti6858_set_termios(struct tty_struct *tty, 458static void oti6858_set_termios(struct tty_struct *tty,
450 struct usb_serial_port *port, struct ktermios *old_termios) 459 struct usb_serial_port *port, struct ktermios *old_termios)
451{ 460{
@@ -463,16 +472,6 @@ static void oti6858_set_termios(struct tty_struct *tty,
463 return; 472 return;
464 } 473 }
465 474
466 spin_lock_irqsave(&priv->lock, flags);
467 if (!priv->flags.termios_initialized) {
468 *(tty->termios) = tty_std_termios;
469 tty->termios->c_cflag = B38400 | CS8 | CREAD | HUPCL | CLOCAL;
470 tty->termios->c_ispeed = 38400;
471 tty->termios->c_ospeed = 38400;
472 priv->flags.termios_initialized = 1;
473 }
474 spin_unlock_irqrestore(&priv->lock, flags);
475
476 cflag = tty->termios->c_cflag; 475 cflag = tty->termios->c_cflag;
477 476
478 spin_lock_irqsave(&priv->lock, flags); 477 spin_lock_irqsave(&priv->lock, flags);