Merge branch 'master' into 83xx
[powerpc.git] / drivers / usb / serial / aircable.c
index 2ccd9de..11dad42 100644 (file)
@@ -92,6 +92,7 @@ struct aircable_private {
        struct circ_buf *rx_buf;        /* read buffer */
        int rx_flags;                   /* for throttilng */
        struct work_struct rx_work;     /* work cue for the receiving line */
+       struct usb_serial_port *port;   /* USB port with which associated */
 };
 
 /* Private methods */
@@ -251,10 +252,11 @@ static void aircable_send(struct usb_serial_port *port)
        schedule_work(&port->work);
 }
 
-static void aircable_read(void *params)
+static void aircable_read(struct work_struct *work)
 {
-       struct usb_serial_port *port = params;
-       struct aircable_private *priv = usb_get_serial_port_data(port);
+       struct aircable_private *priv =
+               container_of(work, struct aircable_private, rx_work);
+       struct usb_serial_port *port = priv->port;
        struct tty_struct *tty;
        unsigned char *data;
        int count;
@@ -270,8 +272,11 @@ static void aircable_read(void *params)
         */
        tty = port->tty;
 
-       if (!tty)
+       if (!tty) {
                schedule_work(&priv->rx_work);
+               err("%s - No tty available", __FUNCTION__);
+               return ;
+       }
 
        count = min(64, serial_buf_data_avail(priv->rx_buf));
 
@@ -305,9 +310,7 @@ static int aircable_probe(struct usb_serial *serial,
 
        for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) {
                endpoint = &iface_desc->endpoint[i].desc;
-               if (((endpoint->bEndpointAddress & 0x80) == 0x00) &&
-                       ((endpoint->bmAttributes & 3) == 0x02)) {
-                       /* we found our bulk out endpoint */
+               if (usb_endpoint_is_bulk_out(endpoint)) {
                        dbg("found bulk out on endpoint %d", i);
                        ++num_bulk_out;
                }
@@ -348,7 +351,8 @@ static int aircable_attach (struct usb_serial *serial)
        }
 
        priv->rx_flags &= ~(THROTTLED | ACTUALLY_THROTTLED);
-       INIT_WORK(&priv->rx_work, aircable_read, port);
+       priv->port = port;
+       INIT_WORK(&priv->rx_work, aircable_read);
 
        usb_set_serial_port_data(serial->port[0], priv);
 
@@ -403,7 +407,7 @@ static int aircable_write(struct usb_serial_port *port,
 
 }
 
-static void aircable_write_bulk_callback(struct urb *urb, struct pt_regs *regs)
+static void aircable_write_bulk_callback(struct urb *urb)
 {
        struct usb_serial_port *port = urb->context;
        int result;
@@ -444,7 +448,7 @@ static void aircable_write_bulk_callback(struct urb *urb, struct pt_regs *regs)
        aircable_send(port);
 }
 
-static void aircable_read_bulk_callback(struct urb *urb, struct pt_regs *regs)
+static void aircable_read_bulk_callback(struct urb *urb)
 {
        struct usb_serial_port *port = urb->context;
        struct aircable_private *priv = usb_get_serial_port_data(port);
@@ -515,7 +519,7 @@ static void aircable_read_bulk_callback(struct urb *urb, struct pt_regs *regs)
                                        package_length - shift);
                        }
                }
-               aircable_read(port);
+               aircable_read(&priv->rx_work);
        }
 
        /* Schedule the next read _if_ we are still open */
@@ -568,8 +572,20 @@ static void aircable_unthrottle(struct usb_serial_port *port)
                schedule_work(&priv->rx_work);
 }
 
+static struct usb_driver aircable_driver = {
+       .name =         "aircable",
+       .probe =        usb_serial_probe,
+       .disconnect =   usb_serial_disconnect,
+       .id_table =     id_table,
+       .no_dynamic_id =        1,
+};
+
 static struct usb_serial_driver aircable_device = {
-       .description =          "aircable",
+       .driver = {
+               .owner =        THIS_MODULE,
+               .name =         "aircable",
+       },
+       .usb_driver =           &aircable_driver,
        .id_table =             id_table,
        .num_ports =            1,
        .attach =               aircable_attach,
@@ -583,13 +599,6 @@ static struct usb_serial_driver aircable_device = {
        .unthrottle =           aircable_unthrottle,
 };
 
-static struct usb_driver aircable_driver = {
-       .name =         "aircable",
-       .probe =        usb_serial_probe,
-       .disconnect =   usb_serial_disconnect,
-       .id_table =     id_table,
-};
-
 static int __init aircable_init (void)
 {
        int retval;