aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/oti6858.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/oti6858.c')
-rw-r--r--drivers/usb/serial/oti6858.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c
index 3cece27325e7..0f4a70ce3823 100644
--- a/drivers/usb/serial/oti6858.c
+++ b/drivers/usb/serial/oti6858.c
@@ -141,11 +141,11 @@ struct oti6858_control_pkt {
141 && ((a)->frame_fmt == (priv)->pending_setup.frame_fmt)) 141 && ((a)->frame_fmt == (priv)->pending_setup.frame_fmt))
142 142
143/* function prototypes */ 143/* function prototypes */
144static int oti6858_open(struct tty_struct *tty, 144static int oti6858_open(struct tty_struct *tty, struct usb_serial_port *port);
145 struct usb_serial_port *port, struct file *filp);
146static void oti6858_close(struct usb_serial_port *port); 145static void oti6858_close(struct usb_serial_port *port);
147static void oti6858_set_termios(struct tty_struct *tty, 146static void oti6858_set_termios(struct tty_struct *tty,
148 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);
149static int oti6858_ioctl(struct tty_struct *tty, struct file *file, 149static int oti6858_ioctl(struct tty_struct *tty, struct file *file,
150 unsigned int cmd, unsigned long arg); 150 unsigned int cmd, unsigned long arg);
151static void oti6858_read_int_callback(struct urb *urb); 151static void oti6858_read_int_callback(struct urb *urb);
@@ -186,6 +186,7 @@ static struct usb_serial_driver oti6858_device = {
186 .write = oti6858_write, 186 .write = oti6858_write,
187 .ioctl = oti6858_ioctl, 187 .ioctl = oti6858_ioctl,
188 .set_termios = oti6858_set_termios, 188 .set_termios = oti6858_set_termios,
189 .init_termios = oti6858_init_termios,
189 .tiocmget = oti6858_tiocmget, 190 .tiocmget = oti6858_tiocmget,
190 .tiocmset = oti6858_tiocmset, 191 .tiocmset = oti6858_tiocmset,
191 .read_bulk_callback = oti6858_read_bulk_callback, 192 .read_bulk_callback = oti6858_read_bulk_callback,
@@ -206,7 +207,6 @@ struct oti6858_private {
206 struct { 207 struct {
207 u8 read_urb_in_use; 208 u8 read_urb_in_use;
208 u8 write_urb_in_use; 209 u8 write_urb_in_use;
209 u8 termios_initialized;
210 } flags; 210 } flags;
211 struct delayed_work delayed_write_work; 211 struct delayed_work delayed_write_work;
212 212
@@ -447,6 +447,14 @@ static int oti6858_chars_in_buffer(struct tty_struct *tty)
447 return chars; 447 return chars;
448} 448}
449 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
450static void oti6858_set_termios(struct tty_struct *tty, 458static void oti6858_set_termios(struct tty_struct *tty,
451 struct usb_serial_port *port, struct ktermios *old_termios) 459 struct usb_serial_port *port, struct ktermios *old_termios)
452{ 460{
@@ -464,16 +472,6 @@ static void oti6858_set_termios(struct tty_struct *tty,
464 return; 472 return;
465 } 473 }
466 474
467 spin_lock_irqsave(&priv->lock, flags);
468 if (!priv->flags.termios_initialized) {
469 *(tty->termios) = tty_std_termios;
470 tty->termios->c_cflag = B38400 | CS8 | CREAD | HUPCL | CLOCAL;
471 tty->termios->c_ispeed = 38400;
472 tty->termios->c_ospeed = 38400;
473 priv->flags.termios_initialized = 1;
474 }
475 spin_unlock_irqrestore(&priv->lock, flags);
476
477 cflag = tty->termios->c_cflag; 475 cflag = tty->termios->c_cflag;
478 476
479 spin_lock_irqsave(&priv->lock, flags); 477 spin_lock_irqsave(&priv->lock, flags);
@@ -566,8 +564,7 @@ static void oti6858_set_termios(struct tty_struct *tty,
566 spin_unlock_irqrestore(&priv->lock, flags); 564 spin_unlock_irqrestore(&priv->lock, flags);
567} 565}
568 566
569static int oti6858_open(struct tty_struct *tty, 567static int oti6858_open(struct tty_struct *tty, struct usb_serial_port *port)
570 struct usb_serial_port *port, struct file *filp)
571{ 568{
572 struct oti6858_private *priv = usb_get_serial_port_data(port); 569 struct oti6858_private *priv = usb_get_serial_port_data(port);
573 struct ktermios tmp_termios; 570 struct ktermios tmp_termios;