X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fusb%2Fserial%2Fti_usb_3410_5052.c;h=c3a2071b802d283de1d6a9a520b883925f698e32;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=59c88de3e7ae337459ea7cea7262639fe28d5e5e;hpb=cee37fe97739d85991964371c1f3a745c00dd236;p=linux-2.6.git diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 59c88de3e..c3a2071b8 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c @@ -248,16 +248,19 @@ static struct usb_device_id ti_id_table_combined[] = { }; static struct usb_driver ti_usb_driver = { - .owner = THIS_MODULE, .name = "ti_usb_3410_5052", .probe = usb_serial_probe, .disconnect = usb_serial_disconnect, .id_table = ti_id_table_combined, + .no_dynamic_id = 1, }; -static struct usb_serial_device_type ti_1port_device = { - .owner = THIS_MODULE, - .name = "TI USB 3410 1 port adapter", +static struct usb_serial_driver ti_1port_device = { + .driver = { + .owner = THIS_MODULE, + .name = "ti_usb_3410_5052_1", + }, + .description = "TI USB 3410 1 port adapter", .id_table = ti_id_table_3410, .num_interrupt_in = 1, .num_bulk_in = 1, @@ -282,9 +285,12 @@ static struct usb_serial_device_type ti_1port_device = { .write_bulk_callback = ti_bulk_out_callback, }; -static struct usb_serial_device_type ti_2port_device = { - .owner = THIS_MODULE, - .name = "TI USB 5052 2 port adapter", +static struct usb_serial_driver ti_2port_device = { + .driver = { + .owner = THIS_MODULE, + .name = "ti_usb_3410_5052_2", + }, + .description = "TI USB 5052 2 port adapter", .id_table = ti_id_table_5052, .num_interrupt_in = 1, .num_bulk_in = 2, @@ -345,17 +351,14 @@ static int __init ti_init(void) int i,j; int ret; - /* insert extra vendor and product ids */ - j = sizeof(ti_id_table_3410)/sizeof(struct usb_device_id) - - TI_EXTRA_VID_PID_COUNT - 1; + j = ARRAY_SIZE(ti_id_table_3410) - TI_EXTRA_VID_PID_COUNT - 1; for (i=0; iactconfig->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); @@ -1277,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); }