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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
317149c655
commit
bbcb2b9074
@@ -901,7 +901,9 @@ int usb_serial_probe(struct usb_interface *interface,
|
||||
dev_err(&interface->dev, "No free urbs available\n");
|
||||
goto probe_error;
|
||||
}
|
||||
buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
|
||||
buffer_size = serial->type->bulk_in_size;
|
||||
if (!buffer_size)
|
||||
buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
|
||||
port->bulk_in_size = buffer_size;
|
||||
port->bulk_in_endpointAddress = endpoint->bEndpointAddress;
|
||||
port->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
|
||||
@@ -927,7 +929,9 @@ int usb_serial_probe(struct usb_interface *interface,
|
||||
}
|
||||
if (kfifo_alloc(&port->write_fifo, PAGE_SIZE, GFP_KERNEL))
|
||||
goto probe_error;
|
||||
buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
|
||||
buffer_size = serial->type->bulk_out_size;
|
||||
if (!buffer_size)
|
||||
buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
|
||||
port->bulk_out_size = buffer_size;
|
||||
port->bulk_out_endpointAddress = endpoint->bEndpointAddress;
|
||||
port->bulk_out_buffer = kmalloc(buffer_size, GFP_KERNEL);
|
||||
|
Reference in New Issue
Block a user