aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/spcp8x5.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/spcp8x5.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/spcp8x5.c')
-rw-r--r--drivers/usb/serial/spcp8x5.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c
index 8b312a05a353..61e7c40b94fb 100644
--- a/drivers/usb/serial/spcp8x5.c
+++ b/drivers/usb/serial/spcp8x5.c
@@ -299,7 +299,6 @@ struct spcp8x5_private {
299 wait_queue_head_t delta_msr_wait; 299 wait_queue_head_t delta_msr_wait;
300 u8 line_control; 300 u8 line_control;
301 u8 line_status; 301 u8 line_status;
302 u8 termios_initialized;
303}; 302};
304 303
305/* desc : when device plug in,this function would be called. 304/* desc : when device plug in,this function would be called.
@@ -498,6 +497,15 @@ static void spcp8x5_close(struct usb_serial_port *port)
498 dev_dbg(&port->dev, "usb_unlink_urb(read_urb) = %d\n", result); 497 dev_dbg(&port->dev, "usb_unlink_urb(read_urb) = %d\n", result);
499} 498}
500 499
500static void spcp8x5_init_termios(struct tty_struct *tty)
501{
502 /* for the 1st time call this function */
503 *(tty->termios) = tty_std_termios;
504 tty->termios->c_cflag = B115200 | CS8 | CREAD | HUPCL | CLOCAL;
505 tty->termios->c_ispeed = 115200;
506 tty->termios->c_ospeed = 115200;
507}
508
501/* set the serial param for transfer. we should check if we really need to 509/* set the serial param for transfer. we should check if we really need to
502 * transfer. if we set flow control we should do this too. */ 510 * transfer. if we set flow control we should do this too. */
503static void spcp8x5_set_termios(struct tty_struct *tty, 511static void spcp8x5_set_termios(struct tty_struct *tty,
@@ -514,16 +522,6 @@ static void spcp8x5_set_termios(struct tty_struct *tty,
514 int i; 522 int i;
515 u8 control; 523 u8 control;
516 524
517 /* for the 1st time call this function */
518 spin_lock_irqsave(&priv->lock, flags);
519 if (!priv->termios_initialized) {
520 *(tty->termios) = tty_std_termios;
521 tty->termios->c_cflag = B115200 | CS8 | CREAD | HUPCL | CLOCAL;
522 tty->termios->c_ispeed = 115200;
523 tty->termios->c_ospeed = 115200;
524 priv->termios_initialized = 1;
525 }
526 spin_unlock_irqrestore(&priv->lock, flags);
527 525
528 /* check that they really want us to change something */ 526 /* check that they really want us to change something */
529 if (!tty_termios_hw_change(tty->termios, old_termios)) 527 if (!tty_termios_hw_change(tty->termios, old_termios))
@@ -1008,6 +1006,7 @@ static struct usb_serial_driver spcp8x5_device = {
1008 .carrier_raised = spcp8x5_carrier_raised, 1006 .carrier_raised = spcp8x5_carrier_raised,
1009 .write = spcp8x5_write, 1007 .write = spcp8x5_write,
1010 .set_termios = spcp8x5_set_termios, 1008 .set_termios = spcp8x5_set_termios,
1009 .init_termios = spcp8x5_init_termios,
1011 .ioctl = spcp8x5_ioctl, 1010 .ioctl = spcp8x5_ioctl,
1012 .tiocmget = spcp8x5_tiocmget, 1011 .tiocmget = spcp8x5_tiocmget,
1013 .tiocmset = spcp8x5_tiocmset, 1012 .tiocmset = spcp8x5_tiocmset,