]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/usb/serial/cp2101.c
Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb
[linux-2.6-omap-h63xx.git] / drivers / usb / serial / cp2101.c
index dc0ea08ed2315773b0f85fbcaf25848d83d69be9..1279553381e34a5d4486ded444294a533f53371c 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/usb.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/usb/serial.h>
 
 /*
 /*
  * Function Prototypes
  */
-static int cp2101_open(struct usb_serial_port*, struct file*);
-static void cp2101_cleanup(struct usb_serial_port*);
-static void cp2101_close(struct usb_serial_port*, struct file*);
-static void cp2101_get_termios(struct usb_serial_port*);
-static void cp2101_set_termios(struct usb_serial_port*, struct ktermios*);
-static int cp2101_tiocmget (struct usb_serial_port *, struct file *);
-static int cp2101_tiocmset (struct usb_serial_port *, struct file *,
+static int cp2101_open(struct tty_struct *, struct usb_serial_port *,
+                                                       struct file *);
+static void cp2101_cleanup(struct usb_serial_port *);
+static void cp2101_close(struct tty_struct *, struct usb_serial_port *,
+                                                       struct file*);
+static void cp2101_get_termios(struct tty_struct *);
+static void cp2101_set_termios(struct tty_struct *, struct usb_serial_port *,
+                                                       struct ktermios*);
+static int cp2101_tiocmget(struct tty_struct *, struct file *);
+static int cp2101_tiocmset(struct tty_struct *, struct file *,
                unsigned int, unsigned int);
-static void cp2101_break_ctl(struct usb_serial_port*, int);
-static int cp2101_startup (struct usb_serial *);
-static void cp2101_shutdown(struct usb_serial*);
+static void cp2101_break_ctl(struct tty_struct *, int);
+static int cp2101_startup(struct usb_serial *);
+static void cp2101_shutdown(struct usb_serial *);
 
 
 static int debug;
@@ -69,16 +72,19 @@ static struct usb_device_id id_table [] = {
        { USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */
        { USB_DEVICE(0x10C4, 0x80DD) }, /* Tracient RFID */
        { USB_DEVICE(0x10C4, 0x80F6) }, /* Suunto sports instrument */
+       { USB_DEVICE(0x10C4, 0x8115) }, /* Arygon NFC/Mifare Reader */
        { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */
        { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */
        { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */
        { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */
+       { USB_DEVICE(0x10C4, 0x81A6) }, /* ThinkOptics WavIt */
        { USB_DEVICE(0x10C4, 0x81AC) }, /* MSD Dash Hawk */
        { USB_DEVICE(0x10C4, 0x81C8) }, /* Lipowsky Industrie Elektronik GmbH, Baby-JTAG */
        { USB_DEVICE(0x10C4, 0x81E2) }, /* Lipowsky Industrie Elektronik GmbH, Baby-LIN */
        { USB_DEVICE(0x10C4, 0x81E7) }, /* Aerocomm Radio */
        { USB_DEVICE(0x10C4, 0x8218) }, /* Lipowsky Industrie Elektronik GmbH, HARP-1 */
        { USB_DEVICE(0x10c4, 0x8293) }, /* Telegesys ETRX2USB */
+       { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */
        { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */
        { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */
        { USB_DEVICE(0x10C4, 0xF001) }, /* Elan Digital Systems USBscope50 */
@@ -89,10 +95,11 @@ static struct usb_device_id id_table [] = {
        { USB_DEVICE(0x13AD, 0x9999) }, /* Baltech card reader */
        { USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */
        { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */
+       { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
        { } /* Terminating Entry */
 };
 
-MODULE_DEVICE_TABLE (usb, id_table);
+MODULE_DEVICE_TABLE(usb, id_table);
 
 static struct usb_driver cp2101_driver = {
        .name           = "cp2101",
@@ -181,7 +188,7 @@ static struct usb_serial_driver cp2101_device = {
  * 'data' is a pointer to a pre-allocated array of integers large
  * enough to hold 'size' bytes (with 4 bytes to each integer)
  */
-static int cp2101_get_config(struct usb_serial_portport, u8 request,
+static int cp2101_get_config(struct usb_serial_port *port, u8 request,
                unsigned int *data, int size)
 {
        struct usb_serial *serial = port->serial;
@@ -201,12 +208,12 @@ static int cp2101_get_config(struct usb_serial_port* port, u8 request,
        request++;
 
        /* Issue the request, attempting to read 'size' bytes */
-       result = usb_control_msg (serial->dev,usb_rcvctrlpipe (serial->dev, 0),
+       result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
                                request, REQTYPE_DEVICE_TO_HOST, 0x0000,
                                0, buf, size, 300);
 
        /* Convert data into an array of integers */
-       for (i=0; i<length; i++)
+       for (i = 0; i < length; i++)
                data[i] = le32_to_cpu(buf[i]);
 
        kfree(buf);
@@ -227,7 +234,7 @@ static int cp2101_get_config(struct usb_serial_port* port, u8 request,
  * Values less than 16 bits wide are sent directly
  * 'size' is specified in bytes.
  */
-static int cp2101_set_config(struct usb_serial_portport, u8 request,
+static int cp2101_set_config(struct usb_serial_port *port, u8 request,
                unsigned int *data, int size)
 {
        struct usb_serial *serial = port->serial;
@@ -249,12 +256,12 @@ static int cp2101_set_config(struct usb_serial_port* port, u8 request,
                buf[i] = cpu_to_le32(data[i]);
 
        if (size > 2) {
-               result = usb_control_msg (serial->dev,
+               result = usb_control_msg(serial->dev,
                                usb_sndctrlpipe(serial->dev, 0),
                                request, REQTYPE_HOST_TO_DEVICE, 0x0000,
                                0, buf, size, 300);
        } else {
-               result = usb_control_msg (serial->dev,
+               result = usb_control_msg(serial->dev,
                                usb_sndctrlpipe(serial->dev, 0),
                                request, REQTYPE_HOST_TO_DEVICE, data[0],
                                0, NULL, 0, 300);
@@ -270,7 +277,7 @@ static int cp2101_set_config(struct usb_serial_port* port, u8 request,
        }
 
        /* Single data value */
-       result = usb_control_msg (serial->dev,
+       result = usb_control_msg(serial->dev,
                        usb_sndctrlpipe(serial->dev, 0),
                        request, REQTYPE_HOST_TO_DEVICE, data[0],
                        0, NULL, 0, 300);
@@ -282,13 +289,14 @@ static int cp2101_set_config(struct usb_serial_port* port, u8 request,
  * Convenience function for calling cp2101_set_config on single data values
  * without requiring an integer pointer
  */
-static inline int cp2101_set_config_single(struct usb_serial_portport,
+static inline int cp2101_set_config_single(struct usb_serial_port *port,
                u8 request, unsigned int data)
 {
        return cp2101_set_config(port, request, &data, 2);
 }
 
-static int cp2101_open (struct usb_serial_port *port, struct file *filp)
+static int cp2101_open(struct tty_struct *tty, struct usb_serial_port *port,
+                               struct file *filp)
 {
        struct usb_serial *serial = port->serial;
        int result;
@@ -302,7 +310,7 @@ static int cp2101_open (struct usb_serial_port *port, struct file *filp)
        }
 
        /* Start reading from the device */
-       usb_fill_bulk_urb (port->read_urb, serial->dev,
+       usb_fill_bulk_urb(port->read_urb, serial->dev,
                        usb_rcvbulkpipe(serial->dev,
                        port->bulk_in_endpointAddress),
                        port->read_urb->transfer_buffer,
@@ -317,15 +325,15 @@ static int cp2101_open (struct usb_serial_port *port, struct file *filp)
        }
 
        /* Configure the termios structure */
-       cp2101_get_termios(port);
+       cp2101_get_termios(tty);
 
        /* Set the DTR and RTS pins low */
-       cp2101_tiocmset(port, NULL, TIOCM_DTR | TIOCM_RTS, 0);
+       cp2101_tiocmset(tty, NULL, TIOCM_DTR | TIOCM_RTS, 0);
 
        return 0;
 }
 
-static void cp2101_cleanup (struct usb_serial_port *port)
+static void cp2101_cleanup(struct usb_serial_port *port)
 {
        struct usb_serial *serial = port->serial;
 
@@ -340,7 +348,8 @@ static void cp2101_cleanup (struct usb_serial_port *port)
        }
 }
 
-static void cp2101_close (struct usb_serial_port *port, struct file * filp)
+static void cp2101_close(struct tty_struct *tty, struct usb_serial_port *port,
+                                       struct file *filp)
 {
        dbg("%s - port %d", __func__, port->number);
 
@@ -361,19 +370,15 @@ static void cp2101_close (struct usb_serial_port *port, struct file * filp)
  * from the device, corrects any unsupported values, and configures the
  * termios structure to reflect the state of the device
  */
-static void cp2101_get_termios (struct usb_serial_port *port)
+static void cp2101_get_termios (struct tty_struct *tty)
 {
+       struct usb_serial_port *port = tty->driver_data;
        unsigned int cflag, modem_ctl[4];
-       int baud;
-       int bits;
+       unsigned int baud;
+       unsigned int bits;
 
        dbg("%s - port %d", __func__, port->number);
 
-       if (!port->tty || !port->tty->termios) {
-               dbg("%s - no tty structures", __func__);
-               return;
-       }
-
        cp2101_get_config(port, CP2101_BAUDRATE, &baud, 2);
        /* Convert to baudrate */
        if (baud)
@@ -381,104 +386,102 @@ static void cp2101_get_termios (struct usb_serial_port *port)
 
        dbg("%s - baud rate = %d", __func__, baud);
 
-       tty_encode_baud_rate(port->tty, baud, baud);
-       cflag = port->tty->termios->c_cflag;
+       tty_encode_baud_rate(tty, baud, baud);
+       cflag = tty->termios->c_cflag;
 
        cp2101_get_config(port, CP2101_BITS, &bits, 2);
        cflag &= ~CSIZE;
-       switch(bits & BITS_DATA_MASK) {
-               case BITS_DATA_5:
-                       dbg("%s - data bits = 5", __func__);
-                       cflag |= CS5;
-                       break;
-               case BITS_DATA_6:
-                       dbg("%s - data bits = 6", __func__);
-                       cflag |= CS6;
-                       break;
-               case BITS_DATA_7:
-                       dbg("%s - data bits = 7", __func__);
-                       cflag |= CS7;
-                       break;
-               case BITS_DATA_8:
-                       dbg("%s - data bits = 8", __func__);
-                       cflag |= CS8;
-                       break;
-               case BITS_DATA_9:
-                       dbg("%s - data bits = 9 (not supported, "
-                                       "using 8 data bits)", __func__);
-                       cflag |= CS8;
-                       bits &= ~BITS_DATA_MASK;
-                       bits |= BITS_DATA_8;
-                       cp2101_set_config(port, CP2101_BITS, &bits, 2);
-                       break;
-               default:
-                       dbg("%s - Unknown number of data bits, "
-                                       "using 8", __func__);
-                       cflag |= CS8;
-                       bits &= ~BITS_DATA_MASK;
-                       bits |= BITS_DATA_8;
-                       cp2101_set_config(port, CP2101_BITS, &bits, 2);
-                       break;
+       switch (bits & BITS_DATA_MASK) {
+       case BITS_DATA_5:
+               dbg("%s - data bits = 5", __func__);
+               cflag |= CS5;
+               break;
+       case BITS_DATA_6:
+               dbg("%s - data bits = 6", __func__);
+               cflag |= CS6;
+               break;
+       case BITS_DATA_7:
+               dbg("%s - data bits = 7", __func__);
+               cflag |= CS7;
+               break;
+       case BITS_DATA_8:
+               dbg("%s - data bits = 8", __func__);
+               cflag |= CS8;
+               break;
+       case BITS_DATA_9:
+               dbg("%s - data bits = 9 (not supported, using 8 data bits)",
+                                                               __func__);
+               cflag |= CS8;
+               bits &= ~BITS_DATA_MASK;
+               bits |= BITS_DATA_8;
+               cp2101_set_config(port, CP2101_BITS, &bits, 2);
+               break;
+       default:
+               dbg("%s - Unknown number of data bits, using 8", __func__);
+               cflag |= CS8;
+               bits &= ~BITS_DATA_MASK;
+               bits |= BITS_DATA_8;
+               cp2101_set_config(port, CP2101_BITS, &bits, 2);
+               break;
        }
 
-       switch(bits & BITS_PARITY_MASK) {
-               case BITS_PARITY_NONE:
-                       dbg("%s - parity = NONE", __func__);
-                       cflag &= ~PARENB;
-                       break;
-               case BITS_PARITY_ODD:
-                       dbg("%s - parity = ODD", __func__);
-                       cflag |= (PARENB|PARODD);
-                       break;
-               case BITS_PARITY_EVEN:
-                       dbg("%s - parity = EVEN", __func__);
-                       cflag &= ~PARODD;
-                       cflag |= PARENB;
-                       break;
-               case BITS_PARITY_MARK:
-                       dbg("%s - parity = MARK (not supported, "
-                                       "disabling parity)", __func__);
-                       cflag &= ~PARENB;
-                       bits &= ~BITS_PARITY_MASK;
-                       cp2101_set_config(port, CP2101_BITS, &bits, 2);
-                       break;
-               case BITS_PARITY_SPACE:
-                       dbg("%s - parity = SPACE (not supported, "
-                                       "disabling parity)", __func__);
-                       cflag &= ~PARENB;
-                       bits &= ~BITS_PARITY_MASK;
-                       cp2101_set_config(port, CP2101_BITS, &bits, 2);
-                       break;
-               default:
-                       dbg("%s - Unknown parity mode, "
-                                       "disabling parity", __func__);
-                       cflag &= ~PARENB;
-                       bits &= ~BITS_PARITY_MASK;
-                       cp2101_set_config(port, CP2101_BITS, &bits, 2);
-                       break;
+       switch (bits & BITS_PARITY_MASK) {
+       case BITS_PARITY_NONE:
+               dbg("%s - parity = NONE", __func__);
+               cflag &= ~PARENB;
+               break;
+       case BITS_PARITY_ODD:
+               dbg("%s - parity = ODD", __func__);
+               cflag |= (PARENB|PARODD);
+               break;
+       case BITS_PARITY_EVEN:
+               dbg("%s - parity = EVEN", __func__);
+               cflag &= ~PARODD;
+               cflag |= PARENB;
+               break;
+       case BITS_PARITY_MARK:
+               dbg("%s - parity = MARK (not supported, disabling parity)",
+                               __func__);
+               cflag &= ~PARENB;
+               bits &= ~BITS_PARITY_MASK;
+               cp2101_set_config(port, CP2101_BITS, &bits, 2);
+               break;
+       case BITS_PARITY_SPACE:
+               dbg("%s - parity = SPACE (not supported, disabling parity)",
+                               __func__);
+               cflag &= ~PARENB;
+               bits &= ~BITS_PARITY_MASK;
+               cp2101_set_config(port, CP2101_BITS, &bits, 2);
+               break;
+       default:
+               dbg("%s - Unknown parity mode, disabling parity", __func__);
+               cflag &= ~PARENB;
+               bits &= ~BITS_PARITY_MASK;
+               cp2101_set_config(port, CP2101_BITS, &bits, 2);
+               break;
        }
 
        cflag &= ~CSTOPB;
-       switch(bits & BITS_STOP_MASK) {
-               case BITS_STOP_1:
-                       dbg("%s - stop bits = 1", __func__);
-                       break;
-               case BITS_STOP_1_5:
-                       dbg("%s - stop bits = 1.5 (not supported, "
-                                       "using 1 stop bit)", __func__);
-                       bits &= ~BITS_STOP_MASK;
-                       cp2101_set_config(port, CP2101_BITS, &bits, 2);
-                       break;
-               case BITS_STOP_2:
-                       dbg("%s - stop bits = 2", __func__);
-                       cflag |= CSTOPB;
-                       break;
-               default:
-                       dbg("%s - Unknown number of stop bits, "
-                                       "using 1 stop bit", __func__);
-                       bits &= ~BITS_STOP_MASK;
-                       cp2101_set_config(port, CP2101_BITS, &bits, 2);
-                       break;
+       switch (bits & BITS_STOP_MASK) {
+       case BITS_STOP_1:
+               dbg("%s - stop bits = 1", __func__);
+               break;
+       case BITS_STOP_1_5:
+               dbg("%s - stop bits = 1.5 (not supported, using 1 stop bit)",
+                                                               __func__);
+               bits &= ~BITS_STOP_MASK;
+               cp2101_set_config(port, CP2101_BITS, &bits, 2);
+               break;
+       case BITS_STOP_2:
+               dbg("%s - stop bits = 2", __func__);
+               cflag |= CSTOPB;
+               break;
+       default:
+               dbg("%s - Unknown number of stop bits, using 1 stop bit",
+                                                               __func__);
+               bits &= ~BITS_STOP_MASK;
+               cp2101_set_config(port, CP2101_BITS, &bits, 2);
+               break;
        }
 
        cp2101_get_config(port, CP2101_MODEMCTL, modem_ctl, 16);
@@ -490,55 +493,53 @@ static void cp2101_get_termios (struct usb_serial_port *port)
                cflag &= ~CRTSCTS;
        }
 
-       port->tty->termios->c_cflag = cflag;
+       tty->termios->c_cflag = cflag;
 }
 
-static void cp2101_set_termios (struct usb_serial_port *port,
-               struct ktermios *old_termios)
+static void cp2101_set_termios(struct tty_struct *tty,
+               struct usb_serial_port *port, struct ktermios *old_termios)
 {
        unsigned int cflag, old_cflag;
-       int baud=0, bits;
+       unsigned int baud = 0, bits;
        unsigned int modem_ctl[4];
 
        dbg("%s - port %d", __func__, port->number);
 
-       if (!port->tty || !port->tty->termios) {
-               dbg("%s - no tty structures", __func__);
+       if (!tty)
                return;
-       }
-       port->tty->termios->c_cflag &= ~CMSPAR;
 
-       cflag = port->tty->termios->c_cflag;
+       tty->termios->c_cflag &= ~CMSPAR;
+       cflag = tty->termios->c_cflag;
        old_cflag = old_termios->c_cflag;
-       baud = tty_get_baud_rate(port->tty);
+       baud = tty_get_baud_rate(tty);
 
        /* If the baud rate is to be updated*/
        if (baud != tty_termios_baud_rate(old_termios)) {
                switch (baud) {
-                       case 0:
-                       case 600:
-                       case 1200:
-                       case 1800:
-                       case 2400:
-                       case 4800:
-                       case 7200:
-                       case 9600:
-                       case 14400:
-                       case 19200:
-                       case 28800:
-                       case 38400:
-                       case 55854:
-                       case 57600:
-                       case 115200:
-                       case 127117:
-                       case 230400:
-                       case 460800:
-                       case 921600:
-                       case 3686400:
-                               break;
-                       default:
-                               baud = 9600;
-                               break;
+               case 0:
+               case 600:
+               case 1200:
+               case 1800:
+               case 2400:
+               case 4800:
+               case 7200:
+               case 9600:
+               case 14400:
+               case 19200:
+               case 28800:
+               case 38400:
+               case 55854:
+               case 57600:
+               case 115200:
+               case 127117:
+               case 230400:
+               case 460800:
+               case 921600:
+               case 3686400:
+                       break;
+               default:
+                       baud = 9600;
+                       break;
                }
 
                if (baud) {
@@ -553,35 +554,35 @@ static void cp2101_set_termios (struct usb_serial_port *port,
                }
        }
        /* Report back the resulting baud rate */
-       tty_encode_baud_rate(port->tty, baud, baud);
+       tty_encode_baud_rate(tty, baud, baud);
 
        /* If the number of data bits is to be updated */
        if ((cflag & CSIZE) != (old_cflag & CSIZE)) {
                cp2101_get_config(port, CP2101_BITS, &bits, 2);
                bits &= ~BITS_DATA_MASK;
                switch (cflag & CSIZE) {
-                       case CS5:
-                               bits |= BITS_DATA_5;
-                               dbg("%s - data bits = 5", __func__);
-                               break;
-                       case CS6:
-                               bits |= BITS_DATA_6;
-                               dbg("%s - data bits = 6", __func__);
-                               break;
-                       case CS7:
-                               bits |= BITS_DATA_7;
-                               dbg("%s - data bits = 7", __func__);
-                               break;
-                       case CS8:
-                               bits |= BITS_DATA_8;
-                               dbg("%s - data bits = 8", __func__);
-                               break;
-                       /*case CS9:
-                               bits |= BITS_DATA_9;
-                               dbg("%s - data bits = 9", __func__);
-                               break;*/
-                       default:
-                               dev_err(&port->dev, "cp2101 driver does not "
+               case CS5:
+                       bits |= BITS_DATA_5;
+                       dbg("%s - data bits = 5", __func__);
+                       break;
+               case CS6:
+                       bits |= BITS_DATA_6;
+                       dbg("%s - data bits = 6", __func__);
+                       break;
+               case CS7:
+                       bits |= BITS_DATA_7;
+                       dbg("%s - data bits = 7", __func__);
+                       break;
+               case CS8:
+                       bits |= BITS_DATA_8;
+                       dbg("%s - data bits = 8", __func__);
+                       break;
+               /*case CS9:
+                       bits |= BITS_DATA_9;
+                       dbg("%s - data bits = 9", __func__);
+                       break;*/
+               default:
+                       dev_err(&port->dev, "cp2101 driver does not "
                                        "support the number of bits requested,"
                                        " using 8 bit mode\n");
                                bits |= BITS_DATA_8;
@@ -650,10 +651,11 @@ static void cp2101_set_termios (struct usb_serial_port *port,
 
 }
 
-static int cp2101_tiocmset (struct usb_serial_port *port, struct file *file,
+static int cp2101_tiocmset (struct tty_struct *tty, struct file *file,
                unsigned int set, unsigned int clear)
 {
-       int control = 0;
+       struct usb_serial_port *port = tty->driver_data;
+       unsigned int control = 0;
 
        dbg("%s - port %d", __func__, port->number);
 
@@ -680,9 +682,11 @@ static int cp2101_tiocmset (struct usb_serial_port *port, struct file *file,
 
 }
 
-static int cp2101_tiocmget (struct usb_serial_port *port, struct file *file)
+static int cp2101_tiocmget (struct tty_struct *tty, struct file *file)
 {
-       int control, result;
+       struct usb_serial_port *port = tty->driver_data;
+       unsigned int control;
+       int result;
 
        dbg("%s - port %d", __func__, port->number);
 
@@ -700,9 +704,10 @@ static int cp2101_tiocmget (struct usb_serial_port *port, struct file *file)
        return result;
 }
 
-static void cp2101_break_ctl (struct usb_serial_port *port, int break_state)
+static void cp2101_break_ctl (struct tty_struct *tty, int break_state)
 {
-       int state;
+       struct usb_serial_port *port = tty->driver_data;
+       unsigned int state;
 
        dbg("%s - port %d", __func__, port->number);
        if (break_state == 0)
@@ -710,30 +715,29 @@ static void cp2101_break_ctl (struct usb_serial_port *port, int break_state)
        else
                state = BREAK_ON;
        dbg("%s - turning break %s", __func__,
-                       state==BREAK_OFF ? "off" : "on");
+                       state == BREAK_OFF ? "off" : "on");
        cp2101_set_config(port, CP2101_BREAK, &state, 2);
 }
 
-static int cp2101_startup (struct usb_serial *serial)
+static int cp2101_startup(struct usb_serial *serial)
 {
        /* CP2101 buffers behave strangely unless device is reset */
        usb_reset_device(serial->dev);
        return 0;
 }
 
-static void cp2101_shutdown (struct usb_serial *serial)
+static void cp2101_shutdown(struct usb_serial *serial)
 {
        int i;
 
        dbg("%s", __func__);
 
        /* Stop reads and writes on all ports */
-       for (i=0; i < serial->num_ports; ++i) {
+       for (i = 0; i < serial->num_ports; ++i)
                cp2101_cleanup(serial->port[i]);
-       }
 }
 
-static int __init cp2101_init (void)
+static int __init cp2101_init(void)
 {
        int retval;
 
@@ -753,10 +757,10 @@ static int __init cp2101_init (void)
        return 0;
 }
 
-static void __exit cp2101_exit (void)
+static void __exit cp2101_exit(void)
 {
-       usb_deregister (&cp2101_driver);
-       usb_serial_deregister (&cp2101_device);
+       usb_deregister(&cp2101_driver);
+       usb_serial_deregister(&cp2101_device);
 }
 
 module_init(cp2101_init);