]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/usb/serial/ti_usb_3410_5052.c
[PATCH] USB: ftdi_sio: Adds support for iPlus device.
[linux-2.6-omap-h63xx.git] / drivers / usb / serial / ti_usb_3410_5052.c
index abb830cb77bd926365d20c67ed5516b2d11d0b49..c3a2071b802d283de1d6a9a520b883925f698e32 100644 (file)
@@ -416,12 +416,11 @@ static int ti_startup(struct usb_serial *serial)
            dev->actconfig->desc.bConfigurationValue);
 
        /* create device structure */
-       tdev = kmalloc(sizeof(struct ti_device), GFP_KERNEL);
+       tdev = kzalloc(sizeof(struct ti_device), GFP_KERNEL);
        if (tdev == NULL) {
                dev_err(&dev->dev, "%s - out of memory\n", __FUNCTION__);
                return -ENOMEM;
        }
-       memset(tdev, 0, sizeof(struct ti_device));
        sema_init(&tdev->td_open_close_sem, 1);
        tdev->td_serial = serial;
        usb_set_serial_data(serial, tdev);
@@ -1280,24 +1279,18 @@ static void ti_recv(struct device *dev, struct tty_struct *tty,
        int cnt;
 
        do {
-               if (tty->flip.count >= TTY_FLIPBUF_SIZE) {
-                       tty_flip_buffer_push(tty);
-                       if (tty->flip.count >= TTY_FLIPBUF_SIZE) {
-                               dev_err(dev, "%s - dropping data, %d bytes lost\n", __FUNCTION__, length);
-                               return;
-                       }
+               cnt = tty_buffer_request_room(tty, length);
+               if (cnt < length) {
+                       dev_err(dev, "%s - dropping data, %d bytes lost\n", __FUNCTION__, length - cnt);
+                       if(cnt == 0)
+                               break;
                }
-               cnt = min(length, TTY_FLIPBUF_SIZE - tty->flip.count);
-               memcpy(tty->flip.char_buf_ptr, data, cnt);
-               memset(tty->flip.flag_buf_ptr, 0, cnt);
-               tty->flip.char_buf_ptr += cnt;
-               tty->flip.flag_buf_ptr += cnt;
-               tty->flip.count += cnt;
+               tty_insert_flip_string(tty, data, cnt);
+               tty_flip_buffer_push(tty);
                data += cnt;
                length -= cnt;
        } while (length > 0);
 
-       tty_flip_buffer_push(tty);
 }