aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/usb-serial.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/usb-serial.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/usb-serial.c')
-rw-r--r--drivers/usb/serial/usb-serial.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index f3f65171de3..538924627eb 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -901,7 +901,9 @@ int usb_serial_probe(struct usb_interface *interface,
901 dev_err(&interface->dev, "No free urbs available\n"); 901 dev_err(&interface->dev, "No free urbs available\n");
902 goto probe_error; 902 goto probe_error;
903 } 903 }
904 buffer_size = le16_to_cpu(endpoint->wMaxPacketSize); 904 buffer_size = serial->type->bulk_in_size;
905 if (!buffer_size)
906 buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
905 port->bulk_in_size = buffer_size; 907 port->bulk_in_size = buffer_size;
906 port->bulk_in_endpointAddress = endpoint->bEndpointAddress; 908 port->bulk_in_endpointAddress = endpoint->bEndpointAddress;
907 port->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL); 909 port->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
@@ -927,7 +929,9 @@ int usb_serial_probe(struct usb_interface *interface,
927 } 929 }
928 if (kfifo_alloc(&port->write_fifo, PAGE_SIZE, GFP_KERNEL)) 930 if (kfifo_alloc(&port->write_fifo, PAGE_SIZE, GFP_KERNEL))
929 goto probe_error; 931 goto probe_error;
930 buffer_size = le16_to_cpu(endpoint->wMaxPacketSize); 932 buffer_size = serial->type->bulk_out_size;
933 if (!buffer_size)
934 buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
931 port->bulk_out_size = buffer_size; 935 port->bulk_out_size = buffer_size;
932 port->bulk_out_endpointAddress = endpoint->bEndpointAddress; 936 port->bulk_out_endpointAddress = endpoint->bEndpointAddress;
933 port->bulk_out_buffer = kmalloc(buffer_size, GFP_KERNEL); 937 port->bulk_out_buffer = kmalloc(buffer_size, GFP_KERNEL);