Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / usb / serial / digi_acceleport.c
index a19a47f..b3f776a 100644 (file)
@@ -493,20 +493,22 @@ static struct usb_device_id id_table_4 [] = {
 MODULE_DEVICE_TABLE (usb, id_table_combined);
 
 static struct usb_driver digi_driver = {
-       .owner =        THIS_MODULE,
        .name =         "digi_acceleport",
        .probe =        usb_serial_probe,
        .disconnect =   usb_serial_disconnect,
        .id_table =     id_table_combined,
+       .no_dynamic_id =        1,
 };
 
 
 /* device info needed for the Digi serial converter */
 
-static struct usb_serial_device_type digi_acceleport_2_device = {
-       .owner =                        THIS_MODULE,
-       .name =                         "Digi 2 port USB adapter",
-       .short_name =                   "digi_2",
+static struct usb_serial_driver digi_acceleport_2_device = {
+       .driver = {
+               .owner =                THIS_MODULE,
+               .name =                 "digi_2",
+       },
+       .description =                  "Digi 2 port USB adapter",
        .id_table =                     id_table_2,
        .num_interrupt_in =             0,
        .num_bulk_in =                  4,
@@ -530,10 +532,12 @@ static struct usb_serial_device_type digi_acceleport_2_device = {
        .shutdown =                     digi_shutdown,
 };
 
-static struct usb_serial_device_type digi_acceleport_4_device = {
-       .owner =                        THIS_MODULE,
-       .name =                         "Digi 4 port USB adapter",
-       .short_name =                   "digi_4",
+static struct usb_serial_driver digi_acceleport_4_device = {
+       .driver = {
+               .owner =                THIS_MODULE,
+               .name =                 "digi_4",
+       },
+       .description =                  "Digi 4 port USB adapter",
        .id_table =                     id_table_4,
        .num_interrupt_in =             0,
        .num_bulk_in =                  5,
@@ -942,13 +946,10 @@ dbg( "digi_rx_unthrottle: TOP: port=%d", priv->dp_port_num );
        spin_lock_irqsave( &priv->dp_port_lock, flags );
 
        /* send any buffered chars from throttle time on to tty subsystem */
-       len = min(priv->dp_in_buf_len, TTY_FLIPBUF_SIZE - tty->flip.count );
+
+       len = tty_buffer_request_room(tty, priv->dp_in_buf_len);
        if( len > 0 ) {
-               memcpy( tty->flip.char_buf_ptr, priv->dp_in_buf, len );
-               memcpy( tty->flip.flag_buf_ptr, priv->dp_in_flag_buf, len );
-               tty->flip.char_buf_ptr += len;
-               tty->flip.flag_buf_ptr += len;
-               tty->flip.count += len;
+               tty_insert_flip_string_flags(tty, priv->dp_in_buf, priv->dp_in_flag_buf, len);
                tty_flip_buffer_push( tty );
        }
 
@@ -1823,6 +1824,7 @@ static int digi_read_inb_callback( struct urb *urb )
        int status = ((unsigned char *)urb->transfer_buffer)[2];
        unsigned char *data = ((unsigned char *)urb->transfer_buffer)+3;
        int flag,throttled;
+       int i;
 
        /* do not process callbacks on closed ports */
        /* but do continue the read chain */
@@ -1881,20 +1883,18 @@ static int digi_read_inb_callback( struct urb *urb )
                        }
 
                } else {
-
-                       len = min( len, TTY_FLIPBUF_SIZE - tty->flip.count );
-
+                       len = tty_buffer_request_room(tty, len);
                        if( len > 0 ) {
-                               memcpy( tty->flip.char_buf_ptr, data, len );
-                               memset( tty->flip.flag_buf_ptr, flag, len );
-                               tty->flip.char_buf_ptr += len;
-                               tty->flip.flag_buf_ptr += len;
-                               tty->flip.count += len;
+                               /* Hot path */
+                               if(flag == TTY_NORMAL)
+                                       tty_insert_flip_string(tty, data, len);
+                               else {
+                                       for(i = 0; i < len; i++)
+                                               tty_insert_flip_char(tty, data[i], flag);
+                               }
                                tty_flip_buffer_push( tty );
                        }
-
                }
-
        }
 
        spin_unlock( &priv->dp_port_lock );