aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/ipaq.c
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2010-03-17 18:00:37 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-20 16:21:33 -0400
commitbbcb2b907415a90334521a31a8767cd77462c716 (patch)
tree8ee895f4ee3352a7f57c52c5e99119bc6838edac /drivers/usb/serial/ipaq.c
parent317149c655defedfaf432143b86a720cfc12a424 (diff)
USB: serial: allow drivers to define bulk buffer sizes
Allow drivers to define custom bulk in/out buffer sizes in struct usb_serial_driver. If not set, fall back to the default buffer size which matches the endpoint size. Three drivers are currently freeing the pre-allocated buffers and allocating larger ones to achieve this at port probe (ftdi_sio) or even at port open (ipaq and iuu_phoenix), which needless to say is suboptimal. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/ipaq.c')
-rw-r--r--drivers/usb/serial/ipaq.c28
1 files changed, 2 insertions, 26 deletions
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c
index 3fea9298eb15..87b11461bf11 100644
--- a/drivers/usb/serial/ipaq.c
+++ b/drivers/usb/serial/ipaq.c
@@ -571,6 +571,8 @@ static struct usb_serial_driver ipaq_device = {
571 .description = "PocketPC PDA", 571 .description = "PocketPC PDA",
572 .usb_driver = &ipaq_driver, 572 .usb_driver = &ipaq_driver,
573 .id_table = ipaq_id_table, 573 .id_table = ipaq_id_table,
574 .bulk_in_size = URBDATA_SIZE,
575 .bulk_out_size = URBDATA_SIZE,
574 .open = ipaq_open, 576 .open = ipaq_open,
575 .close = ipaq_close, 577 .close = ipaq_close,
576 .attach = ipaq_startup, 578 .attach = ipaq_startup,
@@ -628,32 +630,6 @@ static int ipaq_open(struct tty_struct *tty,
628 priv->free_len += PACKET_SIZE; 630 priv->free_len += PACKET_SIZE;
629 } 631 }
630 632
631 /*
632 * Lose the small buffers usbserial provides. Make larger ones.
633 */
634
635 kfree(port->bulk_in_buffer);
636 kfree(port->bulk_out_buffer);
637 /* make sure the generic serial code knows */
638 port->bulk_out_buffer = NULL;
639
640 port->bulk_in_buffer = kmalloc(URBDATA_SIZE, GFP_KERNEL);
641 if (port->bulk_in_buffer == NULL)
642 goto enomem;
643
644 port->bulk_out_buffer = kmalloc(URBDATA_SIZE, GFP_KERNEL);
645 if (port->bulk_out_buffer == NULL) {
646 /* the buffer is useless, free it */
647 kfree(port->bulk_in_buffer);
648 port->bulk_in_buffer = NULL;
649 goto enomem;
650 }
651 port->read_urb->transfer_buffer = port->bulk_in_buffer;
652 port->write_urb->transfer_buffer = port->bulk_out_buffer;
653 port->read_urb->transfer_buffer_length = URBDATA_SIZE;
654 port->bulk_out_size = port->write_urb->transfer_buffer_length
655 = URBDATA_SIZE;
656
657 msleep(1000*initial_wait); 633 msleep(1000*initial_wait);
658 634
659 /* 635 /*