IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / usb / serial / ipaq.c
index 7e1bd5d6dfa0ca1502b22cdad8aa88d9925aa563..6238aff1e772c71bf81deb62298be7d79ce770d0 100644 (file)
@@ -83,8 +83,8 @@ static int ipaq_write(struct usb_serial_port *port, const unsigned char *buf,
 static int ipaq_write_bulk(struct usb_serial_port *port, const unsigned char *buf,
                           int count);
 static void ipaq_write_gather(struct usb_serial_port *port);
-static void ipaq_read_bulk_callback (struct urb *urb, struct pt_regs *regs);
-static void ipaq_write_bulk_callback(struct urb *urb, struct pt_regs *regs);
+static void ipaq_read_bulk_callback (struct urb *urb);
+static void ipaq_write_bulk_callback(struct urb *urb);
 static int ipaq_write_room(struct usb_serial_port *port);
 static int ipaq_chars_in_buffer(struct usb_serial_port *port);
 static void ipaq_destroy_lists(struct usb_serial_port *port);
@@ -251,6 +251,8 @@ static struct usb_device_id ipaq_id_table [] = {
        { USB_DEVICE(0x04C5, 0x1079) }, /* FUJITSU USB Sync */
        { USB_DEVICE(0x04DA, 0x2500) }, /* Panasonic USB Sync */
        { USB_DEVICE(0x04DD, 0x9102) }, /* SHARP WS003SH USB Modem */
+       { USB_DEVICE(0x04DD, 0x9121) }, /* SHARP WS004SH USB Modem */
+       { USB_DEVICE(0x04DD, 0x9123) }, /* SHARP WS007SH 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 */
@@ -477,6 +479,7 @@ static struct usb_device_id ipaq_id_table [] = {
        { USB_DEVICE(0x0BB4, 0x0A9D) }, /* SmartPhone USB Sync */
        { USB_DEVICE(0x0BB4, 0x0A9E) }, /* SmartPhone USB Sync */
        { USB_DEVICE(0x0BB4, 0x0A9F) }, /* SmartPhone USB Sync */
+       { USB_DEVICE(0x0BB4, 0x0BCE) }, /* "High Tech Computer Corp" */
        { USB_DEVICE(0x0BF8, 0x1001) }, /* Fujitsu Siemens Computers USB Sync */
        { USB_DEVICE(0x0C44, 0x03A2) }, /* Motorola iDEN Smartphone */
        { USB_DEVICE(0x0C8E, 0x6000) }, /* Cesscom Luxian Series */
@@ -650,11 +653,6 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp)
        port->bulk_out_size = port->write_urb->transfer_buffer_length = URBDATA_SIZE;
        
        msleep(1000*initial_wait);
-       /* Start reading from the device */
-       usb_fill_bulk_urb(port->read_urb, serial->dev, 
-                     usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress),
-                     port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length,
-                     ipaq_read_bulk_callback, port);
 
        /*
         * Send out control message observed in win98 sniffs. Not sure what
@@ -668,18 +666,31 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp)
                result = usb_control_msg(serial->dev,
                                usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21,
                                0x1, 0, NULL, 0, 100);
-               if (result == 0) {
-                       result = usb_submit_urb(port->read_urb, GFP_KERNEL);
-                       if (result) {
-                               err("%s - failed submitting read urb, error %d", __FUNCTION__, result);
-                               goto error;
-                       }
-                       return 0;
-               }
+               if (!result)
+                       break;
+
                msleep(1000);
        }
-       err("%s - failed doing control urb, error %d", __FUNCTION__, result);
-       goto error;
+
+       if (!retries && result) {
+               err("%s - failed doing control urb, error %d", __FUNCTION__,
+                   result);
+               goto error;
+       }
+
+       /* Start reading from the device */
+       usb_fill_bulk_urb(port->read_urb, serial->dev,
+                     usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress),
+                     port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length,
+                     ipaq_read_bulk_callback, port);
+
+       result = usb_submit_urb(port->read_urb, GFP_KERNEL);
+       if (result) {
+               err("%s - failed submitting read urb, error %d", __FUNCTION__, result);
+               goto error;
+       }
+
+       return 0;
 
 enomem:
        result = -ENOMEM;
@@ -710,7 +721,7 @@ static void ipaq_close(struct usb_serial_port *port, struct file *filp)
        /* info ("Bytes In = %d  Bytes Out = %d", bytes_in, bytes_out); */
 }
 
-static void ipaq_read_bulk_callback(struct urb *urb, struct pt_regs *regs)
+static void ipaq_read_bulk_callback(struct urb *urb)
 {
        struct usb_serial_port  *port = (struct usb_serial_port *)urb->context;
        struct tty_struct       *tty;
@@ -848,7 +859,7 @@ static void ipaq_write_gather(struct usb_serial_port *port)
        return;
 }
 
-static void ipaq_write_bulk_callback(struct urb *urb, struct pt_regs *regs)
+static void ipaq_write_bulk_callback(struct urb *urb)
 {
        struct usb_serial_port  *port = (struct usb_serial_port *)urb->context;
        struct ipaq_private     *priv = usb_get_serial_port_data(port);