aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/serial/ftdi_sio.c16
-rw-r--r--drivers/usb/serial/ipaq.c28
-rw-r--r--drivers/usb/serial/iuu_phoenix.c30
-rw-r--r--drivers/usb/serial/usb-serial.c8
-rw-r--r--include/linux/usb/serial.h5
5 files changed, 16 insertions, 71 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. */
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 /*
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c
index 43f13cf2f016..74551cb2e8ee 100644
--- a/drivers/usb/serial/iuu_phoenix.c
+++ b/drivers/usb/serial/iuu_phoenix.c
@@ -1044,34 +1044,6 @@ static int iuu_open(struct tty_struct *tty, struct usb_serial_port *port)
1044 if (buf == NULL) 1044 if (buf == NULL)
1045 return -ENOMEM; 1045 return -ENOMEM;
1046 1046
1047 /* fixup the endpoint buffer size */
1048 kfree(port->bulk_out_buffer);
1049 port->bulk_out_buffer = kmalloc(512, GFP_KERNEL);
1050 port->bulk_out_size = 512;
1051 kfree(port->bulk_in_buffer);
1052 port->bulk_in_buffer = kmalloc(512, GFP_KERNEL);
1053 port->bulk_in_size = 512;
1054
1055 if (!port->bulk_out_buffer || !port->bulk_in_buffer) {
1056 kfree(port->bulk_out_buffer);
1057 kfree(port->bulk_in_buffer);
1058 kfree(buf);
1059 return -ENOMEM;
1060 }
1061
1062 usb_fill_bulk_urb(port->write_urb, port->serial->dev,
1063 usb_sndbulkpipe(port->serial->dev,
1064 port->bulk_out_endpointAddress),
1065 port->bulk_out_buffer, 512,
1066 NULL, NULL);
1067
1068
1069 usb_fill_bulk_urb(port->read_urb, port->serial->dev,
1070 usb_rcvbulkpipe(port->serial->dev,
1071 port->bulk_in_endpointAddress),
1072 port->bulk_in_buffer, 512,
1073 NULL, NULL);
1074
1075 priv->poll = 0; 1047 priv->poll = 0;
1076 1048
1077 /* initialize writebuf */ 1049 /* initialize writebuf */
@@ -1277,6 +1249,8 @@ static struct usb_serial_driver iuu_device = {
1277 }, 1249 },
1278 .id_table = id_table, 1250 .id_table = id_table,
1279 .num_ports = 1, 1251 .num_ports = 1,
1252 .bulk_in_size = 512,
1253 .bulk_out_size = 512,
1280 .port_probe = iuu_create_sysfs_attrs, 1254 .port_probe = iuu_create_sysfs_attrs,
1281 .port_remove = iuu_remove_sysfs_attrs, 1255 .port_remove = iuu_remove_sysfs_attrs,
1282 .open = iuu_open, 1256 .open = iuu_open,
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index f3f65171de38..538924627eba 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);
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index b7682fed1d9c..ab311dab3383 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -179,6 +179,8 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
179 * @id_table: pointer to a list of usb_device_id structures that define all 179 * @id_table: pointer to a list of usb_device_id structures that define all
180 * of the devices this structure can support. 180 * of the devices this structure can support.
181 * @num_ports: the number of different ports this device will have. 181 * @num_ports: the number of different ports this device will have.
182 * @bulk_in_size: bytes to allocate for bulk-in buffer (0 = end-point size)
183 * @bulk_out_size: bytes to allocate for bulk-out buffer (0 = end-point size)
182 * @calc_num_ports: pointer to a function to determine how many ports this 184 * @calc_num_ports: pointer to a function to determine how many ports this
183 * device has dynamically. It will be called after the probe() 185 * device has dynamically. It will be called after the probe()
184 * callback is called, but before attach() 186 * callback is called, but before attach()
@@ -223,6 +225,9 @@ struct usb_serial_driver {
223 struct usb_dynids dynids; 225 struct usb_dynids dynids;
224 int max_in_flight_urbs; 226 int max_in_flight_urbs;
225 227
228 size_t bulk_in_size;
229 size_t bulk_out_size;
230
226 int (*probe)(struct usb_serial *serial, const struct usb_device_id *id); 231 int (*probe)(struct usb_serial *serial, const struct usb_device_id *id);
227 int (*attach)(struct usb_serial *serial); 232 int (*attach)(struct usb_serial *serial);
228 int (*calc_num_ports) (struct usb_serial *serial); 233 int (*calc_num_ports) (struct usb_serial *serial);