This is breaking some devices out there such as Winchiphead CH341 adapters (#9601)
SVN-Revision: 27885
+++ /dev/null
---- a/drivers/usb/serial/usb-serial.c
-+++ b/drivers/usb/serial/usb-serial.c
-@@ -60,6 +60,7 @@ static struct usb_driver usb_serial_driv
- drivers depend on it.
- */
-
-+static ushort maxSize = 0;
- static int debug;
- /* initially all NULL */
- static struct usb_serial *serial_table[SERIAL_TTY_MINORS];
-@@ -864,7 +865,7 @@ int usb_serial_probe(struct usb_interfac
- dev_err(&interface->dev, "No free urbs available\n");
- goto probe_error;
- }
-- buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
-+ buffer_size = (endpoint->wMaxPacketSize > maxSize) ? endpoint->wMaxPacketSize : maxSize;
- port->bulk_in_size = buffer_size;
- port->bulk_in_endpointAddress = endpoint->bEndpointAddress;
- port->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
-@@ -1309,3 +1310,5 @@ MODULE_LICENSE("GPL");
-
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
-+module_param(maxSize, ushort,0);
-+MODULE_PARM_DESC(maxSize,"User specified USB endpoint size");
+++ /dev/null
---- a/drivers/usb/serial/usb-serial.c
-+++ b/drivers/usb/serial/usb-serial.c
-@@ -60,6 +60,7 @@ static struct usb_driver usb_serial_driv
- drivers depend on it.
- */
-
-+static ushort maxSize = 0;
- static int debug;
- /* initially all NULL */
- static struct usb_serial *serial_table[SERIAL_TTY_MINORS];
-@@ -947,7 +948,7 @@ int usb_serial_probe(struct usb_interfac
- dev_err(&interface->dev, "No free urbs available\n");
- goto probe_error;
- }
-- buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
-+ buffer_size = (endpoint->wMaxPacketSize > maxSize) ? endpoint->wMaxPacketSize : maxSize;
- port->bulk_in_size = buffer_size;
- port->bulk_in_endpointAddress = endpoint->bEndpointAddress;
- port->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
-@@ -1381,3 +1382,5 @@ MODULE_LICENSE("GPL");
-
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
-+module_param(maxSize, ushort,0);
-+MODULE_PARM_DESC(maxSize,"User specified USB endpoint size");
+++ /dev/null
---- a/drivers/usb/serial/usb-serial.c
-+++ b/drivers/usb/serial/usb-serial.c
-@@ -61,6 +61,7 @@ static struct usb_driver usb_serial_driv
- drivers depend on it.
- */
-
-+static ushort maxSize = 0;
- static int debug;
- /* initially all NULL */
- static struct usb_serial *serial_table[SERIAL_TTY_MINORS];
-@@ -942,7 +943,7 @@ int usb_serial_probe(struct usb_interfac
- dev_err(&interface->dev, "No free urbs available\n");
- goto probe_error;
- }
-- buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
-+ buffer_size = (endpoint->wMaxPacketSize > maxSize) ? endpoint->wMaxPacketSize : maxSize;
- port->bulk_in_size = buffer_size;
- port->bulk_in_endpointAddress = endpoint->bEndpointAddress;
- port->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
-@@ -1386,3 +1387,5 @@ MODULE_LICENSE("GPL");
-
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
-+module_param(maxSize, ushort,0);
-+MODULE_PARM_DESC(maxSize,"User specified USB endpoint size");
+++ /dev/null
---- a/drivers/usb/serial/usb-serial.c
-+++ b/drivers/usb/serial/usb-serial.c
-@@ -62,6 +62,7 @@ static struct usb_driver usb_serial_driv
- drivers depend on it.
- */
-
-+static ushort maxSize = 0;
- static int debug;
- /* initially all NULL */
- static struct usb_serial *serial_table[SERIAL_TTY_MINORS];
-@@ -902,7 +903,7 @@ int usb_serial_probe(struct usb_interfac
- }
- buffer_size = serial->type->bulk_in_size;
- if (!buffer_size)
-- buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
-+ buffer_size = (endpoint->wMaxPacketSize > maxSize) ? endpoint->wMaxPacketSize : maxSize;
- port->bulk_in_size = buffer_size;
- port->bulk_in_endpointAddress = endpoint->bEndpointAddress;
- port->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
-@@ -1380,3 +1381,5 @@ MODULE_LICENSE("GPL");
-
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
-+module_param(maxSize, ushort,0);
-+MODULE_PARM_DESC(maxSize,"User specified USB endpoint size");
+++ /dev/null
---- a/drivers/usb/serial/usb-serial.c
-+++ b/drivers/usb/serial/usb-serial.c
-@@ -61,6 +61,7 @@ static struct usb_driver usb_serial_driv
- drivers depend on it.
- */
-
-+static ushort maxSize = 0;
- static int debug;
- /* initially all NULL */
- static struct usb_serial *serial_table[SERIAL_TTY_MINORS];
-@@ -912,7 +913,8 @@ int usb_serial_probe(struct usb_interfac
- goto probe_error;
- }
- buffer_size = max_t(int, serial->type->bulk_in_size,
-- le16_to_cpu(endpoint->wMaxPacketSize));
-+ max_t(int, le16_to_cpu(endpoint->wMaxPacketSize),
-+ maxSize));
- port->bulk_in_size = buffer_size;
- port->bulk_in_endpointAddress = endpoint->bEndpointAddress;
- port->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
-@@ -1391,3 +1393,5 @@ MODULE_LICENSE("GPL");
-
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
-+module_param(maxSize, ushort,0);
-+MODULE_PARM_DESC(maxSize,"User specified USB endpoint size");
+++ /dev/null
---- a/drivers/usb/serial/usb-serial.c
-+++ b/drivers/usb/serial/usb-serial.c
-@@ -61,6 +61,7 @@ static struct usb_driver usb_serial_driv
- drivers depend on it.
- */
-
-+static ushort maxSize = 0;
- static int debug;
- /* initially all NULL */
- static struct usb_serial *serial_table[SERIAL_TTY_MINORS];
-@@ -912,7 +913,8 @@ int usb_serial_probe(struct usb_interfac
- goto probe_error;
- }
- buffer_size = max_t(int, serial->type->bulk_in_size,
-- le16_to_cpu(endpoint->wMaxPacketSize));
-+ min_t(int, le16_to_cpu(endpoint->wMaxPacketSize),
-+ maxSize));
- port->bulk_in_size = buffer_size;
- port->bulk_in_endpointAddress = endpoint->bEndpointAddress;
- port->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
-@@ -1391,3 +1393,5 @@ MODULE_LICENSE("GPL");
-
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
-+module_param(maxSize, ushort,0);
-+MODULE_PARM_DESC(maxSize,"User specified USB endpoint size");
+++ /dev/null
---- a/drivers/usb/serial/usb-serial.c
-+++ b/drivers/usb/serial/usb-serial.c
-@@ -61,6 +61,7 @@ static struct usb_driver usb_serial_driv
- drivers depend on it.
- */
-
-+static ushort maxSize = 0;
- static int debug;
- /* initially all NULL */
- static struct usb_serial *serial_table[SERIAL_TTY_MINORS];
-@@ -912,7 +913,8 @@ int usb_serial_probe(struct usb_interfac
- goto probe_error;
- }
- buffer_size = max_t(int, serial->type->bulk_in_size,
-- le16_to_cpu(endpoint->wMaxPacketSize));
-+ min_t(int, le16_to_cpu(endpoint->wMaxPacketSize),
-+ maxSize));
- port->bulk_in_size = buffer_size;
- port->bulk_in_endpointAddress = endpoint->bEndpointAddress;
- port->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
-@@ -1391,3 +1393,5 @@ MODULE_LICENSE("GPL");
-
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
-+module_param(maxSize, ushort,0);
-+MODULE_PARM_DESC(maxSize,"User specified USB endpoint size");
+++ /dev/null
---- a/drivers/usb/serial/usb-serial.c
-+++ b/drivers/usb/serial/usb-serial.c
-@@ -61,6 +61,7 @@ static struct usb_driver usb_serial_driv
- drivers depend on it.
- */
-
-+static ushort maxSize = 0;
- static int debug;
- /* initially all NULL */
- static struct usb_serial *serial_table[SERIAL_TTY_MINORS];
-@@ -912,7 +913,8 @@ int usb_serial_probe(struct usb_interfac
- goto probe_error;
- }
- buffer_size = max_t(int, serial->type->bulk_in_size,
-- le16_to_cpu(endpoint->wMaxPacketSize));
-+ min_t(int, le16_to_cpu(endpoint->wMaxPacketSize),
-+ maxSize));
- port->bulk_in_size = buffer_size;
- port->bulk_in_endpointAddress = endpoint->bEndpointAddress;
- port->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
-@@ -1391,3 +1393,5 @@ MODULE_LICENSE("GPL");
-
- module_param(debug, bool, S_IRUGO | S_IWUSR);
- MODULE_PARM_DESC(debug, "Debug enabled or not");
-+module_param(maxSize, ushort,0);
-+MODULE_PARM_DESC(maxSize,"User specified USB endpoint size");