diff options
-rw-r--r-- | drivers/usb/serial/ir-usb.c | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c index 71bdbe06baff..aaebb70aca59 100644 --- a/drivers/usb/serial/ir-usb.c +++ b/drivers/usb/serial/ir-usb.c | |||
@@ -297,35 +297,10 @@ static int ir_startup(struct usb_serial *serial) | |||
297 | 297 | ||
298 | static int ir_open(struct tty_struct *tty, struct usb_serial_port *port) | 298 | static int ir_open(struct tty_struct *tty, struct usb_serial_port *port) |
299 | { | 299 | { |
300 | char *buffer; | ||
301 | int result = 0; | 300 | int result = 0; |
302 | 301 | ||
303 | dbg("%s - port %d", __func__, port->number); | 302 | dbg("%s - port %d", __func__, port->number); |
304 | 303 | ||
305 | if (buffer_size) { | ||
306 | /* override the default buffer sizes */ | ||
307 | buffer = kmalloc(buffer_size, GFP_KERNEL); | ||
308 | if (!buffer) { | ||
309 | dev_err(&port->dev, "%s - out of memory.\n", __func__); | ||
310 | return -ENOMEM; | ||
311 | } | ||
312 | kfree(port->read_urb->transfer_buffer); | ||
313 | port->read_urb->transfer_buffer = buffer; | ||
314 | port->read_urb->transfer_buffer_length = buffer_size; | ||
315 | port->bulk_in_buffer = buffer; | ||
316 | |||
317 | buffer = kmalloc(buffer_size, GFP_KERNEL); | ||
318 | if (!buffer) { | ||
319 | dev_err(&port->dev, "%s - out of memory.\n", __func__); | ||
320 | return -ENOMEM; | ||
321 | } | ||
322 | kfree(port->write_urb->transfer_buffer); | ||
323 | port->write_urb->transfer_buffer = buffer; | ||
324 | port->write_urb->transfer_buffer_length = buffer_size; | ||
325 | port->bulk_out_buffer = buffer; | ||
326 | port->bulk_out_size = buffer_size; | ||
327 | } | ||
328 | |||
329 | /* Start reading from the device */ | 304 | /* Start reading from the device */ |
330 | usb_fill_bulk_urb( | 305 | usb_fill_bulk_urb( |
331 | port->read_urb, | 306 | port->read_urb, |
@@ -585,6 +560,11 @@ static int __init ir_init(void) | |||
585 | { | 560 | { |
586 | int retval; | 561 | int retval; |
587 | 562 | ||
563 | if (buffer_size) { | ||
564 | ir_device.bulk_in_size = buffer_size; | ||
565 | ir_device.bulk_out_size = buffer_size; | ||
566 | } | ||
567 | |||
588 | retval = usb_serial_register(&ir_device); | 568 | retval = usb_serial_register(&ir_device); |
589 | if (retval) | 569 | if (retval) |
590 | goto failed_usb_serial_register; | 570 | goto failed_usb_serial_register; |