diff options
Diffstat (limited to 'drivers/usb/serial/kobil_sct.c')
-rw-r--r-- | drivers/usb/serial/kobil_sct.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c index 6db0e561f680..45ea694b3ae6 100644 --- a/drivers/usb/serial/kobil_sct.c +++ b/drivers/usb/serial/kobil_sct.c | |||
@@ -70,8 +70,7 @@ static int debug; | |||
70 | /* Function prototypes */ | 70 | /* Function prototypes */ |
71 | static int kobil_startup(struct usb_serial *serial); | 71 | static int kobil_startup(struct usb_serial *serial); |
72 | static void kobil_release(struct usb_serial *serial); | 72 | static void kobil_release(struct usb_serial *serial); |
73 | static int kobil_open(struct tty_struct *tty, | 73 | static int kobil_open(struct tty_struct *tty, struct usb_serial_port *port); |
74 | struct usb_serial_port *port, struct file *filp); | ||
75 | static void kobil_close(struct usb_serial_port *port); | 74 | static void kobil_close(struct usb_serial_port *port); |
76 | static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port, | 75 | static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port, |
77 | const unsigned char *buf, int count); | 76 | const unsigned char *buf, int count); |
@@ -85,7 +84,7 @@ static void kobil_read_int_callback(struct urb *urb); | |||
85 | static void kobil_write_callback(struct urb *purb); | 84 | static void kobil_write_callback(struct urb *purb); |
86 | static void kobil_set_termios(struct tty_struct *tty, | 85 | static void kobil_set_termios(struct tty_struct *tty, |
87 | struct usb_serial_port *port, struct ktermios *old); | 86 | struct usb_serial_port *port, struct ktermios *old); |
88 | 87 | static void kobil_init_termios(struct tty_struct *tty); | |
89 | 88 | ||
90 | static struct usb_device_id id_table [] = { | 89 | static struct usb_device_id id_table [] = { |
91 | { USB_DEVICE(KOBIL_VENDOR_ID, KOBIL_ADAPTER_B_PRODUCT_ID) }, | 90 | { USB_DEVICE(KOBIL_VENDOR_ID, KOBIL_ADAPTER_B_PRODUCT_ID) }, |
@@ -120,6 +119,7 @@ static struct usb_serial_driver kobil_device = { | |||
120 | .release = kobil_release, | 119 | .release = kobil_release, |
121 | .ioctl = kobil_ioctl, | 120 | .ioctl = kobil_ioctl, |
122 | .set_termios = kobil_set_termios, | 121 | .set_termios = kobil_set_termios, |
122 | .init_termios = kobil_init_termios, | ||
123 | .tiocmget = kobil_tiocmget, | 123 | .tiocmget = kobil_tiocmget, |
124 | .tiocmset = kobil_tiocmset, | 124 | .tiocmset = kobil_tiocmset, |
125 | .open = kobil_open, | 125 | .open = kobil_open, |
@@ -210,9 +210,17 @@ static void kobil_release(struct usb_serial *serial) | |||
210 | kfree(usb_get_serial_port_data(serial->port[i])); | 210 | kfree(usb_get_serial_port_data(serial->port[i])); |
211 | } | 211 | } |
212 | 212 | ||
213 | static void kobil_init_termios(struct tty_struct *tty) | ||
214 | { | ||
215 | /* Default to echo off and other sane device settings */ | ||
216 | tty->termios->c_lflag = 0; | ||
217 | tty->termios->c_lflag &= ~(ISIG | ICANON | ECHO | IEXTEN | XCASE); | ||
218 | tty->termios->c_iflag = IGNBRK | IGNPAR | IXOFF; | ||
219 | /* do NOT translate CR to CR-NL (0x0A -> 0x0A 0x0D) */ | ||
220 | tty->termios->c_oflag &= ~ONLCR; | ||
221 | } | ||
213 | 222 | ||
214 | static int kobil_open(struct tty_struct *tty, | 223 | static int kobil_open(struct tty_struct *tty, struct usb_serial_port *port) |
215 | struct usb_serial_port *port, struct file *filp) | ||
216 | { | 224 | { |
217 | int result = 0; | 225 | int result = 0; |
218 | struct kobil_private *priv; | 226 | struct kobil_private *priv; |
@@ -226,16 +234,6 @@ static int kobil_open(struct tty_struct *tty, | |||
226 | /* someone sets the dev to 0 if the close method has been called */ | 234 | /* someone sets the dev to 0 if the close method has been called */ |
227 | port->interrupt_in_urb->dev = port->serial->dev; | 235 | port->interrupt_in_urb->dev = port->serial->dev; |
228 | 236 | ||
229 | if (tty) { | ||
230 | |||
231 | /* Default to echo off and other sane device settings */ | ||
232 | tty->termios->c_lflag = 0; | ||
233 | tty->termios->c_lflag &= ~(ISIG | ICANON | ECHO | IEXTEN | | ||
234 | XCASE); | ||
235 | tty->termios->c_iflag = IGNBRK | IGNPAR | IXOFF; | ||
236 | /* do NOT translate CR to CR-NL (0x0A -> 0x0A 0x0D) */ | ||
237 | tty->termios->c_oflag &= ~ONLCR; | ||
238 | } | ||
239 | /* allocate memory for transfer buffer */ | 237 | /* allocate memory for transfer buffer */ |
240 | transfer_buffer = kzalloc(transfer_buffer_length, GFP_KERNEL); | 238 | transfer_buffer = kzalloc(transfer_buffer_length, GFP_KERNEL); |
241 | if (!transfer_buffer) | 239 | if (!transfer_buffer) |