diff options
author | Johan Hovold <jhovold@gmail.com> | 2010-03-17 18:00:37 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-20 16:21:33 -0400 |
commit | bbcb2b907415a90334521a31a8767cd77462c716 (patch) | |
tree | 8ee895f4ee3352a7f57c52c5e99119bc6838edac /drivers/usb/serial/ftdi_sio.c | |
parent | 317149c655defedfaf432143b86a720cfc12a424 (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/ftdi_sio.c')
-rw-r--r-- | drivers/usb/serial/ftdi_sio.c | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 46a88ae9c46a..ab4ad18d6ef3 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -768,9 +768,6 @@ static const char *ftdi_chip_name[] = { | |||
768 | }; | 768 | }; |
769 | 769 | ||
770 | 770 | ||
771 | /* Constants for read urb and write urb */ | ||
772 | #define BUFSZ 512 | ||
773 | |||
774 | /* Used for TIOCMIWAIT */ | 771 | /* Used for TIOCMIWAIT */ |
775 | #define FTDI_STATUS_B0_MASK (FTDI_RS0_CTS | FTDI_RS0_DSR | FTDI_RS0_RI | FTDI_RS0_RLSD) | 772 | #define FTDI_STATUS_B0_MASK (FTDI_RS0_CTS | FTDI_RS0_DSR | FTDI_RS0_RI | FTDI_RS0_RLSD) |
776 | #define FTDI_STATUS_B1_MASK (FTDI_RS_BI) | 773 | #define FTDI_STATUS_B1_MASK (FTDI_RS_BI) |
@@ -821,6 +818,7 @@ static struct usb_serial_driver ftdi_sio_device = { | |||
821 | .usb_driver = &ftdi_driver, | 818 | .usb_driver = &ftdi_driver, |
822 | .id_table = id_table_combined, | 819 | .id_table = id_table_combined, |
823 | .num_ports = 1, | 820 | .num_ports = 1, |
821 | .bulk_in_size = 512, | ||
824 | .probe = ftdi_sio_probe, | 822 | .probe = ftdi_sio_probe, |
825 | .port_probe = ftdi_sio_port_probe, | 823 | .port_probe = ftdi_sio_port_probe, |
826 | .port_remove = ftdi_sio_port_remove, | 824 | .port_remove = ftdi_sio_port_remove, |
@@ -1552,18 +1550,6 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port) | |||
1552 | if (quirk && quirk->port_probe) | 1550 | if (quirk && quirk->port_probe) |
1553 | quirk->port_probe(priv); | 1551 | quirk->port_probe(priv); |
1554 | 1552 | ||
1555 | /* Increase the size of read buffers */ | ||
1556 | kfree(port->bulk_in_buffer); | ||
1557 | port->bulk_in_buffer = kmalloc(BUFSZ, GFP_KERNEL); | ||
1558 | if (!port->bulk_in_buffer) { | ||
1559 | kfree(priv); | ||
1560 | return -ENOMEM; | ||
1561 | } | ||
1562 | if (port->read_urb) { | ||
1563 | port->read_urb->transfer_buffer = port->bulk_in_buffer; | ||
1564 | port->read_urb->transfer_buffer_length = BUFSZ; | ||
1565 | } | ||
1566 | |||
1567 | priv->port = port; | 1553 | priv->port = port; |
1568 | 1554 | ||
1569 | /* Free port's existing write urb and transfer buffer. */ | 1555 | /* Free port's existing write urb and transfer buffer. */ |