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 / garmin_gps.c
index 2ef614d..5ec9bf5 100644 (file)
@@ -222,11 +222,11 @@ static struct usb_device_id id_table [] = {
 MODULE_DEVICE_TABLE (usb, id_table);
 
 static struct usb_driver garmin_driver = {
-       .owner =        THIS_MODULE,
        .name =         "garmin_gps",
        .probe =        usb_serial_probe,
        .disconnect =   usb_serial_disconnect,
        .id_table =     id_table,
+       .no_dynamic_id =        1,
 };
 
 
@@ -275,23 +275,14 @@ static void send_to_tty(struct usb_serial_port *port,
                         char *data, unsigned int actual_length)
 {
        struct tty_struct *tty = port->tty;
-       int i;
 
        if (tty && actual_length) {
 
                usb_serial_debug_data(debug, &port->dev, 
                                        __FUNCTION__, actual_length, data);
 
-               for (i = 0; i < actual_length ; ++i) {
-                       /* if we insert more than TTY_FLIPBUF_SIZE characters,
-                          we drop them. */
-                       if(tty->flip.count >= TTY_FLIPBUF_SIZE) {
-                               tty_flip_buffer_push(tty);
-                       }
-                       /* this doesn't actually push the data through unless
-                          tty->low_latency is set */
-                       tty_insert_flip_char(tty, data[i], 0);
-               }
+               tty_buffer_request_room(tty, actual_length);
+               tty_insert_flip_string(tty, data, actual_length);
                tty_flip_buffer_push(tty);
        }
 }
@@ -1431,12 +1422,11 @@ static int garmin_attach (struct usb_serial *serial)
 
        dbg("%s", __FUNCTION__);
 
-       garmin_data_p = kmalloc (sizeof(struct garmin_data), GFP_KERNEL);
+       garmin_data_p = kzalloc(sizeof(struct garmin_data), GFP_KERNEL);
        if (garmin_data_p == NULL) {
                dev_err(&port->dev, "%s - Out of memory\n", __FUNCTION__);
                return -ENOMEM;
        }
-       memset (garmin_data_p, 0, sizeof(struct garmin_data));
        init_timer(&garmin_data_p->timer);
        spin_lock_init(&garmin_data_p->lock);
        INIT_LIST_HEAD(&garmin_data_p->pktlist);
@@ -1468,16 +1458,13 @@ static void garmin_shutdown (struct usb_serial *serial)
 }
 
 
-
-
-
-
-
 /* All of the device info needed */
-static struct usb_serial_device_type garmin_device = {
-       .owner               = THIS_MODULE,
-       .name                = "Garmin GPS usb/tty",
-       .short_name          = "garmin_gps",
+static struct usb_serial_driver garmin_device = {
+       .driver = {
+               .owner =        THIS_MODULE,
+               .name =         "garmin_gps",
+       },
+       .description =          "Garmin GPS usb/tty",
        .id_table            = id_table,
        .num_interrupt_in    = 1,
        .num_bulk_in         = 1,