]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/usb/serial/ipaq.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into for-linus
[linux-2.6-omap-h63xx.git] / drivers / usb / serial / ipaq.c
index 6a3a704b58498bff271b34351dd382049f7cbcd2..ea924dc48496de2b8ca7341c5de69217c3ad8a7e 100644 (file)
@@ -256,6 +256,7 @@ static struct usb_device_id ipaq_id_table [] = {
        { USB_DEVICE(0x04DD, 0x9121) }, /* SHARP WS004SH USB Modem */
        { USB_DEVICE(0x04DD, 0x9123) }, /* SHARP WS007SH USB Modem */
        { USB_DEVICE(0x04DD, 0x9151) }, /* SHARP S01SH USB Modem */
+       { USB_DEVICE(0x04DD, 0x91AC) }, /* SHARP WS011SH USB Modem */
        { USB_DEVICE(0x04E8, 0x5F00) }, /* Samsung NEXiO USB Sync */
        { USB_DEVICE(0x04E8, 0x5F01) }, /* Samsung NEXiO USB Sync */
        { USB_DEVICE(0x04E8, 0x5F02) }, /* Samsung NEXiO USB Sync */
@@ -305,7 +306,7 @@ static struct usb_device_id ipaq_id_table [] = {
        { USB_DEVICE(0x0930, 0x0705) }, /* TOSHIBA Pocket PC e310 */
        { USB_DEVICE(0x0930, 0x0706) }, /* TOSHIBA Pocket PC e740 */
        { USB_DEVICE(0x0930, 0x0707) }, /* TOSHIBA Pocket PC e330 Series */
-       { USB_DEVICE(0x0930, 0x0708) }, /* TOSHIBA Pocket PC e350 Series */
+       { USB_DEVICE(0x0930, 0x0708) }, /* TOSHIBA Pocket PC e350 Series */
        { USB_DEVICE(0x0930, 0x0709) }, /* TOSHIBA Pocket PC e750 Series */
        { USB_DEVICE(0x0930, 0x070A) }, /* TOSHIBA Pocket PC e400 Series */
        { USB_DEVICE(0x0930, 0x070B) }, /* TOSHIBA Pocket PC e800 Series */
@@ -487,7 +488,7 @@ static struct usb_device_id ipaq_id_table [] = {
        { USB_DEVICE(0x0BF8, 0x1001) }, /* Fujitsu Siemens Computers USB Sync */
        { USB_DEVICE(0x0C44, 0x03A2) }, /* Motorola iDEN Smartphone */
        { USB_DEVICE(0x0C8E, 0x6000) }, /* Cesscom Luxian Series */
-       { USB_DEVICE(0x0CAD, 0x9001) }, /* Motorola PowerPad Pocket PC Device */
+       { USB_DEVICE(0x0CAD, 0x9001) }, /* Motorola PowerPad Pocket PC Device */
        { USB_DEVICE(0x0F4E, 0x0200) }, /* Freedom Scientific USB Sync */
        { USB_DEVICE(0x0F98, 0x0201) }, /* Cyberbank USB Sync */
        { USB_DEVICE(0x0FB8, 0x3001) }, /* Wistron USB Sync */
@@ -569,10 +570,7 @@ static struct usb_serial_driver ipaq_device = {
        .description =          "PocketPC PDA",
        .usb_driver =           &ipaq_driver,
        .id_table =             ipaq_id_table,
-       .num_interrupt_in =     NUM_DONT_CARE,
-       .num_bulk_in =          1,
-       .num_bulk_out =         1,
-       .num_ports =            1,
+       .num_ports =            2,
        .open =                 ipaq_open,
        .close =                ipaq_close,
        .attach =               ipaq_startup,
@@ -596,13 +594,13 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp)
        int                     i, result = 0;
        int                     retries = connect_retries;
 
-       dbg("%s - port %d", __FUNCTION__, port->number);
+       dbg("%s - port %d", __func__, port->number);
 
        bytes_in = 0;
        bytes_out = 0;
        priv = kmalloc(sizeof(struct ipaq_private), GFP_KERNEL);
        if (priv == NULL) {
-               err("%s - Out of memory", __FUNCTION__);
+               err("%s - Out of memory", __func__);
                return -ENOMEM;
        }
        usb_set_serial_port_data(port, priv);
@@ -646,11 +644,13 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp)
        kfree(port->bulk_out_buffer);
        port->bulk_in_buffer = kmalloc(URBDATA_SIZE, GFP_KERNEL);
        if (port->bulk_in_buffer == NULL) {
+               port->bulk_out_buffer = NULL; /* prevent double free */
                goto enomem;
        }
        port->bulk_out_buffer = kmalloc(URBDATA_SIZE, GFP_KERNEL);
        if (port->bulk_out_buffer == NULL) {
                kfree(port->bulk_in_buffer);
+               port->bulk_in_buffer = NULL;
                goto enomem;
        }
        port->read_urb->transfer_buffer = port->bulk_in_buffer;
@@ -679,7 +679,7 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp)
        }
 
        if (!retries && result) {
-               err("%s - failed doing control urb, error %d", __FUNCTION__,
+               err("%s - failed doing control urb, error %d", __func__,
                    result);
                goto error;
        }
@@ -692,7 +692,7 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp)
 
        result = usb_submit_urb(port->read_urb, GFP_KERNEL);
        if (result) {
-               err("%s - failed submitting read urb, error %d", __FUNCTION__, result);
+               err("%s - failed submitting read urb, error %d", __func__, result);
                goto error;
        }
 
@@ -700,7 +700,7 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp)
 
 enomem:
        result = -ENOMEM;
-       err("%s - Out of memory", __FUNCTION__);
+       err("%s - Out of memory", __func__);
 error:
        ipaq_destroy_lists(port);
        kfree(priv);
@@ -712,7 +712,7 @@ static void ipaq_close(struct usb_serial_port *port, struct file *filp)
 {
        struct ipaq_private     *priv = usb_get_serial_port_data(port);
 
-       dbg("%s - port %d", __FUNCTION__, port->number);
+       dbg("%s - port %d", __func__, port->number);
                         
        /*
         * shut down bulk read and write
@@ -729,21 +729,21 @@ static void ipaq_close(struct usb_serial_port *port, struct file *filp)
 
 static void ipaq_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 tty_struct       *tty;
        unsigned char           *data = urb->transfer_buffer;
        int                     result;
        int status = urb->status;
 
-       dbg("%s - port %d", __FUNCTION__, port->number);
+       dbg("%s - port %d", __func__, port->number);
 
        if (status) {
                dbg("%s - nonzero read bulk status received: %d",
-                   __FUNCTION__, status);
+                   __func__, status);
                return;
        }
 
-       usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data);
+       usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data);
 
        tty = port->tty;
        if (tty && urb->actual_length) {
@@ -760,7 +760,7 @@ static void ipaq_read_bulk_callback(struct urb *urb)
                      ipaq_read_bulk_callback, port);
        result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
        if (result)
-               err("%s - failed resubmitting read urb, error %d", __FUNCTION__, result);
+               err("%s - failed resubmitting read urb, error %d", __func__, result);
        return;
 }
 
@@ -771,7 +771,7 @@ static int ipaq_write(struct usb_serial_port *port, const unsigned char *buf,
        int                     bytes_sent = 0;
        int                     transfer_size;
 
-       dbg("%s - port %d", __FUNCTION__, port->number);
+       dbg("%s - port %d", __func__, port->number);
 
        while (count > 0) {
                transfer_size = min(count, PACKET_SIZE);
@@ -796,7 +796,7 @@ static int ipaq_write_bulk(struct usb_serial_port *port, const unsigned char *bu
        unsigned long           flags;
 
        if (priv->free_len <= 0) {
-               dbg("%s - we're stuffed", __FUNCTION__);
+               dbg("%s - we're stuffed", __func__);
                return -EAGAIN;
        }
 
@@ -808,12 +808,12 @@ static int ipaq_write_bulk(struct usb_serial_port *port, const unsigned char *bu
        }
        spin_unlock_irqrestore(&write_list_lock, flags);
        if (pkt == NULL) {
-               dbg("%s - we're stuffed", __FUNCTION__);
+               dbg("%s - we're stuffed", __func__);
                return -EAGAIN;
        }
 
        memcpy(pkt->data, buf, count);
-       usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, pkt->data);
+       usb_serial_debug_data(debug, &port->dev, __func__, count, pkt->data);
 
        pkt->len = count;
        pkt->written = 0;
@@ -826,7 +826,7 @@ static int ipaq_write_bulk(struct usb_serial_port *port, const unsigned char *bu
                spin_unlock_irqrestore(&write_list_lock, flags);
                result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
                if (result) {
-                       err("%s - failed submitting write urb, error %d", __FUNCTION__, result);
+                       err("%s - failed submitting write urb, error %d", __func__, result);
                }
        } else {
                spin_unlock_irqrestore(&write_list_lock, flags);
@@ -869,17 +869,17 @@ static void ipaq_write_gather(struct usb_serial_port *port)
 
 static void ipaq_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 ipaq_private     *priv = usb_get_serial_port_data(port);
        unsigned long           flags;
        int                     result;
        int status = urb->status;
 
-       dbg("%s - port %d", __FUNCTION__, port->number);
+       dbg("%s - port %d", __func__, port->number);
 
        if (status) {
                dbg("%s - nonzero write bulk status received: %d",
-                   __FUNCTION__, status);
+                   __func__, status);
                return;
        }
 
@@ -889,7 +889,7 @@ static void ipaq_write_bulk_callback(struct urb *urb)
                spin_unlock_irqrestore(&write_list_lock, flags);
                result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
                if (result) {
-                       err("%s - failed submitting write urb, error %d", __FUNCTION__, result);
+                       err("%s - failed submitting write urb, error %d", __func__, result);
                }
        } else {
                priv->active = 0;
@@ -903,7 +903,7 @@ static int ipaq_write_room(struct usb_serial_port *port)
 {
        struct ipaq_private     *priv = usb_get_serial_port_data(port);
 
-       dbg("%s - freelen %d", __FUNCTION__, priv->free_len);
+       dbg("%s - freelen %d", __func__, priv->free_len);
        return priv->free_len;
 }
 
@@ -911,7 +911,7 @@ static int ipaq_chars_in_buffer(struct usb_serial_port *port)
 {
        struct ipaq_private     *priv = usb_get_serial_port_data(port);
 
-       dbg("%s - queuelen %d", __FUNCTION__, priv->queue_len);
+       dbg("%s - queuelen %d", __func__, priv->queue_len);
        return priv->queue_len;
 }
 
@@ -933,7 +933,7 @@ static void ipaq_destroy_lists(struct usb_serial_port *port)
 
 static int ipaq_startup(struct usb_serial *serial)
 {
-       dbg("%s", __FUNCTION__);
+       dbg("%s", __func__);
        if (serial->dev->actconfig->desc.bConfigurationValue != 1) {
                err("active config #%d != 1 ??",
                        serial->dev->actconfig->desc.bConfigurationValue);
@@ -944,7 +944,7 @@ static int ipaq_startup(struct usb_serial *serial)
 
 static void ipaq_shutdown(struct usb_serial *serial)
 {
-       dbg("%s", __FUNCTION__);
+       dbg("%s", __func__);
 }
 
 static int __init ipaq_init(void)