aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/ark3116.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/ark3116.c')
-rw-r--r--drivers/usb/serial/ark3116.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
index 77895c8f8f31..aec61880f36c 100644
--- a/drivers/usb/serial/ark3116.c
+++ b/drivers/usb/serial/ark3116.c
@@ -158,12 +158,13 @@ cleanup:
158 return -ENOMEM; 158 return -ENOMEM;
159} 159}
160 160
161static void ark3116_set_termios(struct usb_serial_port *port, 161static void ark3116_set_termios(struct tty_struct *tty,
162 struct usb_serial_port *port,
162 struct ktermios *old_termios) 163 struct ktermios *old_termios)
163{ 164{
164 struct usb_serial *serial = port->serial; 165 struct usb_serial *serial = port->serial;
165 struct ark3116_private *priv = usb_get_serial_port_data(port); 166 struct ark3116_private *priv = usb_get_serial_port_data(port);
166 struct ktermios *termios = port->tty->termios; 167 struct ktermios *termios = tty->termios;
167 unsigned int cflag = termios->c_cflag; 168 unsigned int cflag = termios->c_cflag;
168 unsigned long flags; 169 unsigned long flags;
169 int baud; 170 int baud;
@@ -177,8 +178,8 @@ static void ark3116_set_termios(struct usb_serial_port *port,
177 178
178 spin_lock_irqsave(&priv->lock, flags); 179 spin_lock_irqsave(&priv->lock, flags);
179 if (!priv->termios_initialized) { 180 if (!priv->termios_initialized) {
180 *(port->tty->termios) = tty_std_termios; 181 *termios = tty_std_termios;
181 port->tty->termios->c_cflag = B9600 | CS8 182 termios->c_cflag = B9600 | CS8
182 | CREAD | HUPCL | CLOCAL; 183 | CREAD | HUPCL | CLOCAL;
183 termios->c_ispeed = 9600; 184 termios->c_ispeed = 9600;
184 termios->c_ospeed = 9600; 185 termios->c_ospeed = 9600;
@@ -192,7 +193,7 @@ static void ark3116_set_termios(struct usb_serial_port *port,
192 buf = kmalloc(1, GFP_KERNEL); 193 buf = kmalloc(1, GFP_KERNEL);
193 if (!buf) { 194 if (!buf) {
194 dbg("error kmalloc"); 195 dbg("error kmalloc");
195 *port->tty->termios = *old_termios; 196 *termios = *old_termios;
196 return; 197 return;
197 } 198 }
198 199
@@ -243,7 +244,7 @@ static void ark3116_set_termios(struct usb_serial_port *port,
243 } 244 }
244 245
245 /* set baudrate */ 246 /* set baudrate */
246 baud = tty_get_baud_rate(port->tty); 247 baud = tty_get_baud_rate(tty);
247 248
248 switch (baud) { 249 switch (baud) {
249 case 75: 250 case 75:
@@ -262,11 +263,11 @@ static void ark3116_set_termios(struct usb_serial_port *port,
262 case 230400: 263 case 230400:
263 case 460800: 264 case 460800:
264 /* Report the resulting rate back to the caller */ 265 /* Report the resulting rate back to the caller */
265 tty_encode_baud_rate(port->tty, baud, baud); 266 tty_encode_baud_rate(tty, baud, baud);
266 break; 267 break;
267 /* set 9600 as default (if given baudrate is invalid for example) */ 268 /* set 9600 as default (if given baudrate is invalid for example) */
268 default: 269 default:
269 tty_encode_baud_rate(port->tty, 9600, 9600); 270 tty_encode_baud_rate(tty, 9600, 9600);
270 case 0: 271 case 0:
271 baud = 9600; 272 baud = 9600;
272 } 273 }
@@ -317,7 +318,8 @@ static void ark3116_set_termios(struct usb_serial_port *port,
317 return; 318 return;
318} 319}
319 320
320static int ark3116_open(struct usb_serial_port *port, struct file *filp) 321static int ark3116_open(struct tty_struct *tty, struct usb_serial_port *port,
322 struct file *filp)
321{ 323{
322 struct ktermios tmp_termios; 324 struct ktermios tmp_termios;
323 struct usb_serial *serial = port->serial; 325 struct usb_serial *serial = port->serial;
@@ -332,7 +334,7 @@ static int ark3116_open(struct usb_serial_port *port, struct file *filp)
332 return -ENOMEM; 334 return -ENOMEM;
333 } 335 }
334 336
335 result = usb_serial_generic_open(port, filp); 337 result = usb_serial_generic_open(tty, port, filp);
336 if (result) 338 if (result)
337 goto err_out; 339 goto err_out;
338 340
@@ -362,8 +364,8 @@ static int ark3116_open(struct usb_serial_port *port, struct file *filp)
362 ARK3116_RCV(serial, 124, 0xFE, 0xC0, 0x0000, 0x0006, 0xFF, buf); 364 ARK3116_RCV(serial, 124, 0xFE, 0xC0, 0x0000, 0x0006, 0xFF, buf);
363 365
364 /* initialise termios */ 366 /* initialise termios */
365 if (port->tty) 367 if (tty)
366 ark3116_set_termios(port, &tmp_termios); 368 ark3116_set_termios(tty, port, &tmp_termios);
367 369
368err_out: 370err_out:
369 kfree(buf); 371 kfree(buf);
@@ -371,9 +373,10 @@ err_out:
371 return result; 373 return result;
372} 374}
373 375
374static int ark3116_ioctl(struct usb_serial_port *port, struct file *file, 376static int ark3116_ioctl(struct tty_struct *tty, struct file *file,
375 unsigned int cmd, unsigned long arg) 377 unsigned int cmd, unsigned long arg)
376{ 378{
379 struct usb_serial_port *port = tty->driver_data;
377 struct serial_struct serstruct; 380 struct serial_struct serstruct;
378 void __user *user_arg = (void __user *)arg; 381 void __user *user_arg = (void __user *)arg;
379 382
@@ -403,8 +406,9 @@ static int ark3116_ioctl(struct usb_serial_port *port, struct file *file,
403 return -ENOIOCTLCMD; 406 return -ENOIOCTLCMD;
404} 407}
405 408
406static int ark3116_tiocmget(struct usb_serial_port *port, struct file *file) 409static int ark3116_tiocmget(struct tty_struct *tty, struct file *file)
407{ 410{
411 struct usb_serial_port *port = tty->driver_data;
408 struct usb_serial *serial = port->serial; 412 struct usb_serial *serial = port->serial;
409 char *buf; 413 char *buf;
410 char temp; 414 char temp;