Merge branch 'hwmon-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6
[pandora-kernel.git] / drivers / usb / serial / airprime.c
index 7f5d546..18816bf 100644 (file)
 static struct usb_device_id id_table [] = {
        { USB_DEVICE(0x0c88, 0x17da) }, /* Kyocera Wireless KPC650/Passport */
        { USB_DEVICE(0x1410, 0x1110) }, /* Novatel Wireless Merlin CDMA */
+       { USB_DEVICE(0x1410, 0x1130) }, /* Novatel Wireless S720 CDMA/EV-DO */
+       { USB_DEVICE(0x1410, 0x2110) }, /* Novatel Wireless U720 CDMA/EV-DO */
+       { USB_DEVICE(0x1410, 0x1430) }, /* Novatel Merlin XU870 HSDPA/3G */
        { USB_DEVICE(0x1410, 0x1100) }, /* ExpressCard34 Qualcomm 3G CDMA */
+       { USB_DEVICE(0x413c, 0x8115) }, /* Dell Wireless HSDPA 5500 */
        { },
 };
 MODULE_DEVICE_TABLE(usb, id_table);
@@ -54,11 +58,6 @@ static void airprime_read_bulk_callback(struct urb *urb)
        if (urb->status) {
                dbg("%s - nonzero read bulk status received: %d",
                    __FUNCTION__, urb->status);
-               /* something happened, so free up the memory for this urb */
-               if (urb->transfer_buffer) {
-                       kfree (urb->transfer_buffer);
-                       urb->transfer_buffer = NULL;
-               }
                return;
        }
        usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data);
@@ -142,6 +141,8 @@ static int airprime_open(struct usb_serial_port *port, struct file *filp)
                                  airprime_read_bulk_callback, port);
                result = usb_submit_urb(urb, GFP_KERNEL);
                if (result) {
+                       usb_free_urb(urb);
+                       kfree(buffer);
                        dev_err(&port->dev,
                                "%s - failed submitting read urb %d for port %d, error %d\n",
                                __FUNCTION__, i, port->number, result);
@@ -156,27 +157,12 @@ static int airprime_open(struct usb_serial_port *port, struct file *filp)
        /* some error happened, cancel any submitted urbs and clean up anything that
           got allocated successfully */
 
-       for ( ; i >= 0; --i) {
+       while (i-- != 0) {
                urb = priv->read_urbp[i];
-               if (urb) {
-                       /* This urb was submitted successfully. So we have to
-                          cancel it.
-                          Unlinking the urb will invoke read_bulk_callback()
-                          with an error status, so its transfer buffer will
-                          be freed there */
-                       if (usb_unlink_urb (urb) != -EINPROGRESS) {
-                               /* comments in drivers/usb/core/urb.c say this
-                                  can only happen if the urb was never submitted,
-                                  or has completed already.
-                                  Either way we may have to free the transfer
-                                  buffer here. */
-                               if (urb->transfer_buffer) {
-                                       kfree (urb->transfer_buffer);
-                                       urb->transfer_buffer = NULL;
-                               }
-                       }
-                       usb_free_urb (urb);
-               }
+               buffer = urb->transfer_buffer;
+               usb_kill_urb (urb);
+               usb_free_urb (urb);
+               kfree (buffer);
        }
 
  out:
@@ -190,10 +176,9 @@ static void airprime_close(struct usb_serial_port *port, struct file * filp)
 
        dbg("%s - port %d", __FUNCTION__, port->number);
 
-       /* killing the urb will invoke read_bulk_callback() with an error status,
-          so the transfer buffer will be freed there */
        for (i = 0; i < NUM_READ_URBS; ++i) {
                usb_kill_urb (priv->read_urbp[i]);
+               kfree (priv->read_urbp[i]->transfer_buffer);
                usb_free_urb (priv->read_urbp[i]);
        }
 
@@ -273,6 +258,7 @@ static struct usb_serial_driver airprime_device = {
                .owner =        THIS_MODULE,
                .name =         "airprime",
        },
+       .usb_driver =           &airprime_driver,
        .id_table =             id_table,
        .num_interrupt_in =     NUM_DONT_CARE,
        .num_bulk_in =          NUM_DONT_CARE,