]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/usb/serial/ark3116.c
USB: Add YISO u893 usb modem vendor and product IDs to option driver
[linux-2.6-omap-h63xx.git] / drivers / usb / serial / ark3116.c
index 599ab2e548a7c3e483abc255471ee5b92838c90e..aec61880f36c0485be60ad6774447937ecc14d42 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/usb.h>
 #include <linux/usb/serial.h>
 #include <linux/serial.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 
 static int debug;
@@ -158,12 +158,13 @@ cleanup:
        return -ENOMEM;
 }
 
-static void ark3116_set_termios(struct usb_serial_port *port,
+static void ark3116_set_termios(struct tty_struct *tty,
+                               struct usb_serial_port *port,
                                struct ktermios *old_termios)
 {
        struct usb_serial *serial = port->serial;
        struct ark3116_private *priv = usb_get_serial_port_data(port);
-       struct ktermios *termios = port->tty->termios;
+       struct ktermios *termios = tty->termios;
        unsigned int cflag = termios->c_cflag;
        unsigned long flags;
        int baud;
@@ -177,8 +178,8 @@ static void ark3116_set_termios(struct usb_serial_port *port,
 
        spin_lock_irqsave(&priv->lock, flags);
        if (!priv->termios_initialized) {
-               *(port->tty->termios) = tty_std_termios;
-               port->tty->termios->c_cflag = B9600 | CS8
+               *termios = tty_std_termios;
+               termios->c_cflag = B9600 | CS8
                                              | CREAD | HUPCL | CLOCAL;
                termios->c_ispeed = 9600;
                termios->c_ospeed = 9600;
@@ -192,7 +193,7 @@ static void ark3116_set_termios(struct usb_serial_port *port,
        buf = kmalloc(1, GFP_KERNEL);
        if (!buf) {
                dbg("error kmalloc");
-               *port->tty->termios = *old_termios;
+               *termios = *old_termios;
                return;
        }
 
@@ -243,32 +244,32 @@ static void ark3116_set_termios(struct usb_serial_port *port,
        }
 
        /* set baudrate */
-       baud = tty_get_baud_rate(port->tty);
+       baud = tty_get_baud_rate(tty);
 
        switch (baud) {
-               case 75:
-               case 150:
-               case 300:
-               case 600:
-               case 1200:
-               case 1800:
-               case 2400:
-               case 4800:
-               case 9600:
-               case 19200:
-               case 38400:
-               case 57600:
-               case 115200:
-               case 230400:
-               case 460800:
-                       /* Report the resulting rate back to the caller */
-                       tty_encode_baud_rate(port->tty, baud, baud);
-                       break;
-               /* set 9600 as default (if given baudrate is invalid for example) */
-               default:
-                       tty_encode_baud_rate(port->tty, 9600, 9600);
-               case 0:
-                       baud = 9600;
+       case 75:
+       case 150:
+       case 300:
+       case 600:
+       case 1200:
+       case 1800:
+       case 2400:
+       case 4800:
+       case 9600:
+       case 19200:
+       case 38400:
+       case 57600:
+       case 115200:
+       case 230400:
+       case 460800:
+               /* Report the resulting rate back to the caller */
+               tty_encode_baud_rate(tty, baud, baud);
+               break;
+       /* set 9600 as default (if given baudrate is invalid for example) */
+       default:
+               tty_encode_baud_rate(tty, 9600, 9600);
+       case 0:
+               baud = 9600;
        }
 
        /*
@@ -317,7 +318,8 @@ static void ark3116_set_termios(struct usb_serial_port *port,
        return;
 }
 
-static int ark3116_open(struct usb_serial_port *port, struct file *filp)
+static int ark3116_open(struct tty_struct *tty, struct usb_serial_port *port,
+                                       struct file *filp)
 {
        struct ktermios tmp_termios;
        struct usb_serial *serial = port->serial;
@@ -332,7 +334,7 @@ static int ark3116_open(struct usb_serial_port *port, struct file *filp)
                return -ENOMEM;
        }
 
-       result = usb_serial_generic_open(port, filp);
+       result = usb_serial_generic_open(tty, port, filp);
        if (result)
                goto err_out;
 
@@ -362,8 +364,8 @@ static int ark3116_open(struct usb_serial_port *port, struct file *filp)
        ARK3116_RCV(serial, 124, 0xFE, 0xC0, 0x0000, 0x0006, 0xFF, buf);
 
        /* initialise termios */
-       if (port->tty)
-               ark3116_set_termios(port, &tmp_termios);
+       if (tty)
+               ark3116_set_termios(tty, port, &tmp_termios);
 
 err_out:
        kfree(buf);
@@ -371,28 +373,29 @@ err_out:
        return result;
 }
 
-static int ark3116_ioctl(struct usb_serial_port *port, struct file *file,
+static int ark3116_ioctl(struct tty_struct *tty, struct file *file,
                         unsigned int cmd, unsigned long arg)
 {
+       struct usb_serial_port *port = tty->driver_data;
        struct serial_struct serstruct;
        void __user *user_arg = (void __user *)arg;
 
        switch (cmd) {
        case TIOCGSERIAL:
                /* XXX: Some of these values are probably wrong. */
-               memset(&serstruct, 0, sizeof (serstruct));
+               memset(&serstruct, 0, sizeof(serstruct));
                serstruct.type = PORT_16654;
                serstruct.line = port->serial->minor;
                serstruct.port = port->number;
                serstruct.custom_divisor = 0;
                serstruct.baud_base = 460800;
 
-               if (copy_to_user(user_arg, &serstruct, sizeof (serstruct)))
+               if (copy_to_user(user_arg, &serstruct, sizeof(serstruct)))
                        return -EFAULT;
 
                return 0;
        case TIOCSSERIAL:
-               if (copy_from_user(&serstruct, user_arg, sizeof (serstruct)))
+               if (copy_from_user(&serstruct, user_arg, sizeof(serstruct)))
                        return -EFAULT;
                return 0;
        default:
@@ -403,8 +406,9 @@ static int ark3116_ioctl(struct usb_serial_port *port, struct file *file,
        return -ENOIOCTLCMD;
 }
 
-static int ark3116_tiocmget(struct usb_serial_port *port, struct file *file)
+static int ark3116_tiocmget(struct tty_struct *tty, struct file *file)
 {
+       struct usb_serial_port *port = tty->driver_data;
        struct usb_serial *serial = port->serial;
        char *buf;
        char temp;