USB: remove unnecessary type casting of urb->context
[linux-2.6.git] / drivers / usb / serial / pl2303.c
index 1103b2f..c605fb6 100644 (file)
@@ -55,7 +55,9 @@ static struct usb_device_id id_table [] = {
        { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_DCU11) },
        { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ3) },
        { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_PHAROS) },
+       { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_ALDIGA) },
        { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) },
+       { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) },
        { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) },
        { USB_DEVICE(ATEN_VENDOR_ID2, ATEN_PRODUCT_ID) },
        { USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID) },
@@ -64,6 +66,7 @@ static struct usb_device_id id_table [] = {
        { USB_DEVICE(ITEGNO_VENDOR_ID, ITEGNO_PRODUCT_ID_2080) },
        { USB_DEVICE(MA620_VENDOR_ID, MA620_PRODUCT_ID) },
        { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID) },
+       { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) },
        { USB_DEVICE(TRIPP_VENDOR_ID, TRIPP_PRODUCT_ID) },
        { USB_DEVICE(RADIOSHACK_VENDOR_ID, RADIOSHACK_PRODUCT_ID) },
        { USB_DEVICE(DCU10_VENDOR_ID, DCU10_PRODUCT_ID) },
@@ -83,8 +86,10 @@ static struct usb_device_id id_table [] = {
        { USB_DEVICE(DATAPILOT_U2_VENDOR_ID, DATAPILOT_U2_PRODUCT_ID) },
        { USB_DEVICE(BELKIN_VENDOR_ID, BELKIN_PRODUCT_ID) },
        { USB_DEVICE(ALCOR_VENDOR_ID, ALCOR_PRODUCT_ID) },
-       { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ID) },
        { USB_DEVICE(WS002IN_VENDOR_ID, WS002IN_PRODUCT_ID) },
+       { USB_DEVICE(COREGA_VENDOR_ID, COREGA_PRODUCT_ID) },
+       { USB_DEVICE(HL340_VENDOR_ID, HL340_PRODUCT_ID) },
+       { USB_DEVICE(YCCABLE_VENDOR_ID, YCCABLE_PRODUCT_ID) },
        { }                                     /* Terminating entry */
 };
 
@@ -95,7 +100,10 @@ static struct usb_driver pl2303_driver = {
        .probe =        usb_serial_probe,
        .disconnect =   usb_serial_disconnect,
        .id_table =     id_table,
+       .suspend =      usb_serial_suspend,
+       .resume =       usb_serial_resume,
        .no_dynamic_id =        1,
+       .supports_autosuspend = 1,
 };
 
 #define SET_LINE_REQUEST_TYPE          0x21
@@ -308,12 +316,39 @@ static unsigned int pl2303_buf_get(struct pl2303_buf *pb, char *buf,
        return count;
 }
 
+static int pl2303_vendor_read(__u16 value, __u16 index,
+               struct usb_serial *serial, unsigned char *buf)
+{
+       int res = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
+                       VENDOR_READ_REQUEST, VENDOR_READ_REQUEST_TYPE,
+                       value, index, buf, 1, 100);
+       dbg("0x%x:0x%x:0x%x:0x%x  %d - %x", VENDOR_READ_REQUEST_TYPE,
+                       VENDOR_READ_REQUEST, value, index, res, buf[0]);
+       return res;
+}
+
+static int pl2303_vendor_write(__u16 value, __u16 index,
+               struct usb_serial *serial)
+{
+       int res = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
+                       VENDOR_WRITE_REQUEST, VENDOR_WRITE_REQUEST_TYPE,
+                       value, index, NULL, 0, 100);
+       dbg("0x%x:0x%x:0x%x:0x%x  %d", VENDOR_WRITE_REQUEST_TYPE,
+                       VENDOR_WRITE_REQUEST, value, index, res);
+       return res;
+}
+
 static int pl2303_startup(struct usb_serial *serial)
 {
        struct pl2303_private *priv;
        enum pl2303_type type = type_0;
+       unsigned char *buf;
        int i;
 
+       buf = kmalloc(10, GFP_KERNEL);
+       if (buf == NULL)
+               return -ENOMEM;
+
        if (serial->dev->descriptor.bDeviceClass == 0x02)
                type = type_0;
        else if (serial->dev->descriptor.bMaxPacketSize0 == 0x40)
@@ -338,9 +373,27 @@ static int pl2303_startup(struct usb_serial *serial)
                priv->type = type;
                usb_set_serial_port_data(serial->port[i], priv);
        }
+
+       pl2303_vendor_read(0x8484, 0, serial, buf);
+       pl2303_vendor_write(0x0404, 0, serial);
+       pl2303_vendor_read(0x8484, 0, serial, buf);
+       pl2303_vendor_read(0x8383, 0, serial, buf);
+       pl2303_vendor_read(0x8484, 0, serial, buf);
+       pl2303_vendor_write(0x0404, 1, serial);
+       pl2303_vendor_read(0x8484, 0, serial, buf);
+       pl2303_vendor_read(0x8383, 0, serial, buf);
+       pl2303_vendor_write(0, 1, serial);
+       pl2303_vendor_write(1, 0, serial);
+       if (type == HX)
+               pl2303_vendor_write(2, 0x44, serial);
+       else
+               pl2303_vendor_write(2, 0x24, serial);
+
+       kfree(buf);
        return 0;
 
 cleanup:
+       kfree(buf);
        for (--i; i>=0; --i) {
                priv = usb_get_serial_port_data(serial->port[i]);
                pl2303_buf_free(priv->buf);
@@ -357,7 +410,7 @@ static int set_control_lines(struct usb_device *dev, u8 value)
        retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
                                 SET_CONTROL_REQUEST, SET_CONTROL_REQUEST_TYPE,
                                 value, 0, NULL, 0, 100);
-       dbg("%s - value = %d, retval = %d", __FUNCTION__, value, retval);
+       dbg("%s - value = %d, retval = %d", __func__, value, retval);
        return retval;
 }
 
@@ -367,7 +420,7 @@ static void pl2303_send(struct usb_serial_port *port)
        struct pl2303_private *priv = usb_get_serial_port_data(port);
        unsigned long flags;
 
-       dbg("%s - port %d", __FUNCTION__, port->number);
+       dbg("%s - port %d", __func__, port->number);
 
        spin_lock_irqsave(&priv->lock, flags);
 
@@ -388,7 +441,7 @@ static void pl2303_send(struct usb_serial_port *port)
 
        spin_unlock_irqrestore(&priv->lock, flags);
 
-       usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count,
+       usb_serial_debug_data(debug, &port->dev, __func__, count,
                              port->write_urb->transfer_buffer);
 
        port->write_urb->transfer_buffer_length = count;
@@ -396,7 +449,7 @@ static void pl2303_send(struct usb_serial_port *port)
        result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
        if (result) {
                dev_err(&port->dev, "%s - failed submitting write urb,"
-                       " error %d\n", __FUNCTION__, result);
+                       " error %d\n", __func__, result);
                priv->write_urb_in_use = 0;
                // TODO: reschedule pl2303_send
        }
@@ -410,7 +463,7 @@ static int pl2303_write(struct usb_serial_port *port, const unsigned char *buf,
        struct pl2303_private *priv = usb_get_serial_port_data(port);
        unsigned long flags;
 
-       dbg("%s - port %d, %d bytes", __FUNCTION__, port->number, count);
+       dbg("%s - port %d, %d bytes", __func__, port->number, count);
 
        if (!count)
                return count;
@@ -430,13 +483,13 @@ static int pl2303_write_room(struct usb_serial_port *port)
        int room = 0;
        unsigned long flags;
 
-       dbg("%s - port %d", __FUNCTION__, port->number);
+       dbg("%s - port %d", __func__, port->number);
 
        spin_lock_irqsave(&priv->lock, flags);
        room = pl2303_buf_space_avail(priv->buf);
        spin_unlock_irqrestore(&priv->lock, flags);
 
-       dbg("%s - returns %d", __FUNCTION__, room);
+       dbg("%s - returns %d", __func__, room);
        return room;
 }
 
@@ -446,13 +499,13 @@ static int pl2303_chars_in_buffer(struct usb_serial_port *port)
        int chars = 0;
        unsigned long flags;
 
-       dbg("%s - port %d", __FUNCTION__, port->number);
+       dbg("%s - port %d", __func__, port->number);
 
        spin_lock_irqsave(&priv->lock, flags);
        chars = pl2303_buf_data_avail(priv->buf);
        spin_unlock_irqrestore(&priv->lock, flags);
 
-       dbg("%s - returns %d", __FUNCTION__, chars);
+       dbg("%s - returns %d", __func__, chars);
        return chars;
 }
 
@@ -468,7 +521,7 @@ static void pl2303_set_termios(struct usb_serial_port *port,
        int i;
        u8 control;
 
-       dbg("%s -  port %d", __FUNCTION__, port->number);
+       dbg("%s -  port %d", __func__, port->number);
 
        spin_lock_irqsave(&priv->lock, flags);
        if (!priv->termios_initialized) {
@@ -481,11 +534,20 @@ static void pl2303_set_termios(struct usb_serial_port *port,
        }
        spin_unlock_irqrestore(&priv->lock, flags);
 
+       /* The PL2303 is reported to lose bytes if you change
+          serial settings even to the same values as before. Thus
+          we actually need to filter in this specific case */
+
+       if (!tty_termios_hw_change(port->tty->termios, old_termios))
+               return;
+
        cflag = port->tty->termios->c_cflag;
 
        buf = kzalloc(7, GFP_KERNEL);
        if (!buf) {
-               dev_err(&port->dev, "%s - out of memory.\n", __FUNCTION__);
+               dev_err(&port->dev, "%s - out of memory.\n", __func__);
+               /* Report back no change occurred */
+               *port->tty->termios = *old_termios;
                return;
        }
 
@@ -503,11 +565,11 @@ static void pl2303_set_termios(struct usb_serial_port *port,
                        default:
                        case CS8:       buf[6] = 8;     break;
                }
-               dbg("%s - data bits = %d", __FUNCTION__, buf[6]);
+               dbg("%s - data bits = %d", __func__, buf[6]);
        }
 
        baud = tty_get_baud_rate(port->tty);;
-       dbg("%s - baud = %d", __FUNCTION__, baud);
+       dbg("%s - baud = %d", __func__, baud);
        if (baud) {
                buf[0] = baud & 0xff;
                buf[1] = (baud >> 8) & 0xff;
@@ -520,10 +582,10 @@ static void pl2303_set_termios(struct usb_serial_port *port,
        /* For reference buf[4]=2 is 2 stop bits */
        if (cflag & CSTOPB) {
                buf[4] = 2;
-               dbg("%s - stop bits = 2", __FUNCTION__);
+               dbg("%s - stop bits = 2", __func__);
        } else {
                buf[4] = 0;
-               dbg("%s - stop bits = 1", __FUNCTION__);
+               dbg("%s - stop bits = 1", __func__);
        }
 
        if (cflag & PARENB) {
@@ -534,14 +596,14 @@ static void pl2303_set_termios(struct usb_serial_port *port,
                /* For reference buf[5]=4 is space parity */
                if (cflag & PARODD) {
                        buf[5] = 1;
-                       dbg("%s - parity = odd", __FUNCTION__);
+                       dbg("%s - parity = odd", __func__);
                } else {
                        buf[5] = 2;
-                       dbg("%s - parity = even", __FUNCTION__);
+                       dbg("%s - parity = even", __func__);
                }
        } else {
                buf[5] = 0;
-               dbg("%s - parity = none", __FUNCTION__);
+               dbg("%s - parity = none", __func__);
        }
 
        i = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
@@ -573,24 +635,12 @@ static void pl2303_set_termios(struct usb_serial_port *port,
             buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6]);
 
        if (cflag & CRTSCTS) {
-               __u16 index;
                if (priv->type == HX)
-                       index = 0x61;
+                       pl2303_vendor_write(0x0, 0x61, serial);
                else
-                       index = 0x41;
-               i = usb_control_msg(serial->dev,
-                                   usb_sndctrlpipe(serial->dev, 0),
-                                   VENDOR_WRITE_REQUEST,
-                                   VENDOR_WRITE_REQUEST_TYPE,
-                                   0x0, index, NULL, 0, 100);
-               dbg("0x40:0x1:0x0:0x%x  %d", index, i);
+                       pl2303_vendor_write(0x0, 0x41, serial);
        } else {
-               i = usb_control_msg(serial->dev,
-                                   usb_sndctrlpipe(serial->dev, 0),
-                                   VENDOR_WRITE_REQUEST,
-                                   VENDOR_WRITE_REQUEST_TYPE,
-                                   0x0, 0x0, NULL, 0, 100);
-               dbg ("0x40:0x1:0x0:0x0  %d", i);
+               pl2303_vendor_write(0x0, 0x0, serial);
        }
 
        /* FIXME: Need to read back resulting baud rate */
@@ -609,7 +659,7 @@ static void pl2303_close(struct usb_serial_port *port, struct file *filp)
        long timeout;
        wait_queue_t wait;
 
-       dbg("%s - port %d", __FUNCTION__, port->number);
+       dbg("%s - port %d", __func__, port->number);
 
        /* wait for data to drain from the buffer */
        spin_lock_irqsave(&priv->lock, flags);
@@ -620,7 +670,7 @@ static void pl2303_close(struct usb_serial_port *port, struct file *filp)
                set_current_state(TASK_INTERRUPTIBLE);
                if (pl2303_buf_data_avail(priv->buf) == 0 ||
                    timeout == 0 || signal_pending(current) ||
-                   !usb_get_intfdata(port->serial->interface)) /* disconnect */
+                   port->serial->disconnected)
                        break;
                spin_unlock_irqrestore(&priv->lock, flags);
                timeout = schedule_timeout(timeout);
@@ -647,7 +697,7 @@ static void pl2303_close(struct usb_serial_port *port, struct file *filp)
        schedule_timeout_interruptible(timeout);
 
        /* shutdown our urbs */
-       dbg("%s - shutting down urbs", __FUNCTION__);
+       dbg("%s - shutting down urbs", __func__);
        usb_kill_urb(port->write_urb);
        usb_kill_urb(port->read_urb);
        usb_kill_urb(port->interrupt_in_urb);
@@ -669,53 +719,19 @@ static int pl2303_open(struct usb_serial_port *port, struct file *filp)
        struct ktermios tmp_termios;
        struct usb_serial *serial = port->serial;
        struct pl2303_private *priv = usb_get_serial_port_data(port);
-       unsigned char *buf;
        int result;
 
-       dbg("%s -  port %d", __FUNCTION__, port->number);
+       dbg("%s -  port %d", __func__, port->number);
 
        if (priv->type != HX) {
                usb_clear_halt(serial->dev, port->write_urb->pipe);
                usb_clear_halt(serial->dev, port->read_urb->pipe);
-       }
-
-       buf = kmalloc(10, GFP_KERNEL);
-       if (buf==NULL)
-               return -ENOMEM;
-
-#define FISH(a,b,c,d)                                                          \
-       result=usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev,0),     \
-                              b, a, c, d, buf, 1, 100);                        \
-       dbg("0x%x:0x%x:0x%x:0x%x  %d - %x",a,b,c,d,result,buf[0]);
-
-#define SOUP(a,b,c,d)                                                          \
-       result=usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev,0),     \
-                              b, a, c, d, NULL, 0, 100);                       \
-       dbg("0x%x:0x%x:0x%x:0x%x  %d",a,b,c,d,result);
-
-       FISH (VENDOR_READ_REQUEST_TYPE, VENDOR_READ_REQUEST, 0x8484, 0);
-       SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 0x0404, 0);
-       FISH (VENDOR_READ_REQUEST_TYPE, VENDOR_READ_REQUEST, 0x8484, 0);
-       FISH (VENDOR_READ_REQUEST_TYPE, VENDOR_READ_REQUEST, 0x8383, 0);
-       FISH (VENDOR_READ_REQUEST_TYPE, VENDOR_READ_REQUEST, 0x8484, 0);
-       SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 0x0404, 1);
-       FISH (VENDOR_READ_REQUEST_TYPE, VENDOR_READ_REQUEST, 0x8484, 0);
-       FISH (VENDOR_READ_REQUEST_TYPE, VENDOR_READ_REQUEST, 0x8383, 0);
-       SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 0, 1);
-       SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 1, 0);
-
-       if (priv->type == HX) {
-               /* HX chip */
-               SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 2, 0x44);
-               /* reset upstream data pipes */
-               SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 8, 0);
-               SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 9, 0);
        } else {
-               SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 2, 0x24);
+               /* reset upstream data pipes */
+               pl2303_vendor_write(8, 0, serial);
+               pl2303_vendor_write(9, 0, serial);
        }
 
-       kfree(buf);
-
        /* Setup termios */
        if (port->tty) {
                pl2303_set_termios(port, &tmp_termios);
@@ -723,22 +739,22 @@ static int pl2303_open(struct usb_serial_port *port, struct file *filp)
 
        //FIXME: need to assert RTS and DTR if CRTSCTS off
 
-       dbg("%s - submitting read urb", __FUNCTION__);
+       dbg("%s - submitting read urb", __func__);
        port->read_urb->dev = serial->dev;
        result = usb_submit_urb(port->read_urb, GFP_KERNEL);
        if (result) {
                dev_err(&port->dev, "%s - failed submitting read urb,"
-                       " error %d\n", __FUNCTION__, result);
+                       " error %d\n", __func__, result);
                pl2303_close(port, NULL);
                return -EPROTO;
        }
 
-       dbg("%s - submitting interrupt urb", __FUNCTION__);
+       dbg("%s - submitting interrupt urb", __func__);
        port->interrupt_in_urb->dev = serial->dev;
        result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
        if (result) {
                dev_err(&port->dev, "%s - failed submitting interrupt urb,"
-                       " error %d\n", __FUNCTION__, result);
+                       " error %d\n", __func__, result);
                pl2303_close(port, NULL);
                return -EPROTO;
        }
@@ -778,7 +794,7 @@ static int pl2303_tiocmget(struct usb_serial_port *port, struct file *file)
        unsigned int status;
        unsigned int result;
 
-       dbg("%s (%d)", __FUNCTION__, port->number);
+       dbg("%s (%d)", __func__, port->number);
 
        if (!usb_get_intfdata(port->serial->interface))
                return -ENODEV;
@@ -795,7 +811,7 @@ static int pl2303_tiocmget(struct usb_serial_port *port, struct file *file)
                  | ((status & UART_RING)       ? TIOCM_RI  : 0)
                  | ((status & UART_DCD)        ? TIOCM_CD  : 0);
 
-       dbg("%s - result = %x", __FUNCTION__, result);
+       dbg("%s - result = %x", __func__, result);
 
        return result;
 }
@@ -839,15 +855,15 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg)
 static int pl2303_ioctl(struct usb_serial_port *port, struct file *file,
                        unsigned int cmd, unsigned long arg)
 {
-       dbg("%s (%d) cmd = 0x%04x", __FUNCTION__, port->number, cmd);
+       dbg("%s (%d) cmd = 0x%04x", __func__, port->number, cmd);
 
        switch (cmd) {
                case TIOCMIWAIT:
-                       dbg("%s (%d) TIOCMIWAIT", __FUNCTION__,  port->number);
+                       dbg("%s (%d) TIOCMIWAIT", __func__,  port->number);
                        return wait_modem_info(port, arg);
 
                default:
-                       dbg("%s not supported = 0x%04x", __FUNCTION__, cmd);
+                       dbg("%s not supported = 0x%04x", __func__, cmd);
                        break;
        }
 
@@ -860,19 +876,19 @@ static void pl2303_break_ctl(struct usb_serial_port *port, int break_state)
        u16 state;
        int result;
 
-       dbg("%s - port %d", __FUNCTION__, port->number);
+       dbg("%s - port %d", __func__, port->number);
 
        if (break_state == 0)
                state = BREAK_OFF;
        else
                state = BREAK_ON;
-       dbg("%s - turning break %s", __FUNCTION__, state==BREAK_OFF ? "off" : "on");
+       dbg("%s - turning break %s", __func__, state==BREAK_OFF ? "off" : "on");
 
        result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
                                 BREAK_REQUEST, BREAK_REQUEST_TYPE, state,
                                 0, NULL, 0, 100);
        if (result)
-               dbg("%s - error sending break = %d", __FUNCTION__, result);
+               dbg("%s - error sending break = %d", __func__, result);
 }
 
 static void pl2303_shutdown(struct usb_serial *serial)
@@ -880,7 +896,7 @@ static void pl2303_shutdown(struct usb_serial *serial)
        int i;
        struct pl2303_private *priv;
 
-       dbg("%s", __FUNCTION__);
+       dbg("%s", __func__);
 
        for (i = 0; i < serial->num_ports; ++i) {
                priv = usb_get_serial_port_data(serial->port[i]);
@@ -929,13 +945,13 @@ static void pl2303_update_line_status(struct usb_serial_port *port,
 
 static void pl2303_read_int_callback(struct urb *urb)
 {
-       struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
+       struct usb_serial_port *port =  urb->context;
        unsigned char *data = urb->transfer_buffer;
        unsigned int actual_length = urb->actual_length;
        int status = urb->status;
        int retval;
 
-       dbg("%s (%d)", __FUNCTION__, port->number);
+       dbg("%s (%d)", __func__, port->number);
 
        switch (status) {
        case 0:
@@ -945,16 +961,16 @@ static void pl2303_read_int_callback(struct urb *urb)
        case -ENOENT:
        case -ESHUTDOWN:
                /* this urb is terminated, clean up */
-               dbg("%s - urb shutting down with status: %d", __FUNCTION__,
+               dbg("%s - urb shutting down with status: %d", __func__,
                    status);
                return;
        default:
-               dbg("%s - nonzero urb status received: %d", __FUNCTION__,
+               dbg("%s - nonzero urb status received: %d", __func__,
                    status);
                goto exit;
        }
 
-       usb_serial_debug_data(debug, &port->dev, __FUNCTION__,
+       usb_serial_debug_data(debug, &port->dev, __func__,
                              urb->actual_length, urb->transfer_buffer);
 
        pl2303_update_line_status(port, data, actual_length);
@@ -964,12 +980,12 @@ exit:
        if (retval)
                dev_err(&urb->dev->dev,
                        "%s - usb_submit_urb failed with result %d\n",
-                       __FUNCTION__, retval);
+                       __func__, retval);
 }
 
 static void pl2303_read_bulk_callback(struct urb *urb)
 {
-       struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
+       struct usb_serial_port *port =  urb->context;
        struct pl2303_private *priv = usb_get_serial_port_data(port);
        struct tty_struct *tty;
        unsigned char *data = urb->transfer_buffer;
@@ -980,32 +996,32 @@ static void pl2303_read_bulk_callback(struct urb *urb)
        u8 line_status;
        char tty_flag;
 
-       dbg("%s - port %d", __FUNCTION__, port->number);
+       dbg("%s - port %d", __func__, port->number);
 
        if (status) {
-               dbg("%s - urb status = %d", __FUNCTION__, status);
+               dbg("%s - urb status = %d", __func__, status);
                if (!port->open_count) {
-                       dbg("%s - port is closed, exiting.", __FUNCTION__);
+                       dbg("%s - port is closed, exiting.", __func__);
                        return;
                }
                if (status == -EPROTO) {
                        /* PL2303 mysteriously fails with -EPROTO reschedule
                         * the read */
                        dbg("%s - caught -EPROTO, resubmitting the urb",
-                           __FUNCTION__);
+                           __func__);
                        urb->dev = port->serial->dev;
                        result = usb_submit_urb(urb, GFP_ATOMIC);
                        if (result)
                                dev_err(&urb->dev->dev, "%s - failed"
                                        " resubmitting read urb, error %d\n",
-                                       __FUNCTION__, result);
+                                       __func__, result);
                        return;
                }
-               dbg("%s - unable to handle the error, exiting.", __FUNCTION__);
+               dbg("%s - unable to handle the error, exiting.", __func__);
                return;
        }
 
-       usb_serial_debug_data(debug, &port->dev, __FUNCTION__,
+       usb_serial_debug_data(debug, &port->dev, __func__,
                              urb->actual_length, data);
 
        /* get tty_flag from status */
@@ -1025,7 +1041,7 @@ static void pl2303_read_bulk_callback(struct urb *urb)
                tty_flag = TTY_PARITY;
        else if (line_status & UART_FRAME_ERROR)
                tty_flag = TTY_FRAME;
-       dbg("%s - tty_flag = %d", __FUNCTION__, tty_flag);
+       dbg("%s - tty_flag = %d", __func__, tty_flag);
 
        tty = port->tty;
        if (tty && urb->actual_length) {
@@ -1044,7 +1060,7 @@ static void pl2303_read_bulk_callback(struct urb *urb)
                result = usb_submit_urb(urb, GFP_ATOMIC);
                if (result)
                        dev_err(&urb->dev->dev, "%s - failed resubmitting"
-                               " read urb, error %d\n", __FUNCTION__, result);
+                               " read urb, error %d\n", __func__, result);
        }
 
        return;
@@ -1052,12 +1068,12 @@ static void pl2303_read_bulk_callback(struct urb *urb)
 
 static void pl2303_write_bulk_callback(struct urb *urb)
 {
-       struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
+       struct usb_serial_port *port =  urb->context;
        struct pl2303_private *priv = usb_get_serial_port_data(port);
        int result;
        int status = urb->status;
 
-       dbg("%s - port %d", __FUNCTION__, port->number);
+       dbg("%s - port %d", __func__, port->number);
 
        switch (status) {
        case 0:
@@ -1067,21 +1083,21 @@ static void pl2303_write_bulk_callback(struct urb *urb)
        case -ENOENT:
        case -ESHUTDOWN:
                /* this urb is terminated, clean up */
-               dbg("%s - urb shutting down with status: %d", __FUNCTION__,
+               dbg("%s - urb shutting down with status: %d", __func__,
                    status);
                priv->write_urb_in_use = 0;
                return;
        default:
                /* error in the urb, so we have to resubmit it */
-               dbg("%s - Overflow in write", __FUNCTION__);
-               dbg("%s - nonzero write bulk status received: %d", __FUNCTION__,
+               dbg("%s - Overflow in write", __func__);
+               dbg("%s - nonzero write bulk status received: %d", __func__,
                    status);
                port->write_urb->transfer_buffer_length = 1;
                port->write_urb->dev = port->serial->dev;
                result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
                if (result)
                        dev_err(&urb->dev->dev, "%s - failed resubmitting write"
-                               " urb, error %d\n", __FUNCTION__, result);
+                               " urb, error %d\n", __func__, result);
                else
                        return;
        }
@@ -1100,9 +1116,6 @@ static struct usb_serial_driver pl2303_device = {
        },
        .id_table =             id_table,
        .usb_driver =           &pl2303_driver,
-       .num_interrupt_in =     NUM_DONT_CARE,
-       .num_bulk_in =          1,
-       .num_bulk_out =         1,
        .num_ports =            1,
        .open =                 pl2303_open,
        .close =                pl2303_close,