aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/iuu_phoenix.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/iuu_phoenix.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/iuu_phoenix.c')
-rw-r--r--drivers/usb/serial/iuu_phoenix.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c
index f3f9be0469c5..6138c1cda35f 100644
--- a/drivers/usb/serial/iuu_phoenix.c
+++ b/drivers/usb/serial/iuu_phoenix.c
@@ -71,7 +71,6 @@ struct iuu_private {
71 spinlock_t lock; /* store irq state */ 71 spinlock_t lock; /* store irq state */
72 wait_queue_head_t delta_msr_wait; 72 wait_queue_head_t delta_msr_wait;
73 u8 line_status; 73 u8 line_status;
74 u8 termios_initialized;
75 int tiostatus; /* store IUART SIGNAL for tiocmget call */ 74 int tiostatus; /* store IUART SIGNAL for tiocmget call */
76 u8 reset; /* if 1 reset is needed */ 75 u8 reset; /* if 1 reset is needed */
77 int poll; /* number of poll */ 76 int poll; /* number of poll */
@@ -1018,13 +1017,24 @@ static void iuu_close(struct usb_serial_port *port)
1018 } 1017 }
1019} 1018}
1020 1019
1020static void iuu_init_termios(struct tty_struct *tty)
1021{
1022 *(tty->termios) = tty_std_termios;
1023 tty->termios->c_cflag = CLOCAL | CREAD | CS8 | B9600
1024 | TIOCM_CTS | CSTOPB | PARENB;
1025 tty->termios->c_ispeed = 9600;
1026 tty->termios->c_ospeed = 9600;
1027 tty->termios->c_lflag = 0;
1028 tty->termios->c_oflag = 0;
1029 tty->termios->c_iflag = 0;
1030}
1031
1021static int iuu_open(struct tty_struct *tty, struct usb_serial_port *port) 1032static int iuu_open(struct tty_struct *tty, struct usb_serial_port *port)
1022{ 1033{
1023 struct usb_serial *serial = port->serial; 1034 struct usb_serial *serial = port->serial;
1024 u8 *buf; 1035 u8 *buf;
1025 int result; 1036 int result;
1026 u32 actual; 1037 u32 actual;
1027 unsigned long flags;
1028 struct iuu_private *priv = usb_get_serial_port_data(port); 1038 struct iuu_private *priv = usb_get_serial_port_data(port);
1029 1039
1030 dbg("%s - port %d", __func__, port->number); 1040 dbg("%s - port %d", __func__, port->number);
@@ -1063,21 +1073,7 @@ static int iuu_open(struct tty_struct *tty, struct usb_serial_port *port)
1063 port->bulk_in_buffer, 512, 1073 port->bulk_in_buffer, 512,
1064 NULL, NULL); 1074 NULL, NULL);
1065 1075
1066 /* set the termios structure */ 1076 priv->poll = 0;
1067 spin_lock_irqsave(&priv->lock, flags);
1068 if (tty && !priv->termios_initialized) {
1069 *(tty->termios) = tty_std_termios;
1070 tty->termios->c_cflag = CLOCAL | CREAD | CS8 | B9600
1071 | TIOCM_CTS | CSTOPB | PARENB;
1072 tty->termios->c_ispeed = 9600;
1073 tty->termios->c_ospeed = 9600;
1074 tty->termios->c_lflag = 0;
1075 tty->termios->c_oflag = 0;
1076 tty->termios->c_iflag = 0;
1077 priv->termios_initialized = 1;
1078 priv->poll = 0;
1079 }
1080 spin_unlock_irqrestore(&priv->lock, flags);
1081 1077
1082 /* initialize writebuf */ 1078 /* initialize writebuf */
1083#define FISH(a, b, c, d) do { \ 1079#define FISH(a, b, c, d) do { \
@@ -1200,6 +1196,7 @@ static struct usb_serial_driver iuu_device = {
1200 .tiocmget = iuu_tiocmget, 1196 .tiocmget = iuu_tiocmget,
1201 .tiocmset = iuu_tiocmset, 1197 .tiocmset = iuu_tiocmset,
1202 .set_termios = iuu_set_termios, 1198 .set_termios = iuu_set_termios,
1199 .init_termios = iuu_init_termios,
1203 .attach = iuu_startup, 1200 .attach = iuu_startup,
1204 .release = iuu_release, 1201 .release = iuu_release,
1205}; 1202};