USB: serial: relax generic driver bulk-endpoint requirement
authorJohan Hovold <johan@kernel.org>
Thu, 16 Mar 2017 16:13:33 +0000 (17:13 +0100)
committerJohan Hovold <johan@kernel.org>
Tue, 28 Mar 2017 08:54:39 +0000 (10:54 +0200)
Relax the generic driver bulk-endpoint requirement. The driver handles
devices without bulk-out endpoints just fine these days.

Signed-off-by: Johan Hovold <johan@kernel.org>
drivers/usb/serial/generic.c

index 2d3599f014e2d47039df35fbded54a75424bb860..35cb8c0e584fc19f4550e24eb7b35fed3819bcc4 100644 (file)
@@ -52,10 +52,12 @@ static int usb_serial_generic_calc_num_ports(struct usb_serial *serial,
                                        struct usb_serial_endpoints *epds)
 {
        struct device *dev = &serial->interface->dev;
-       int num_ports = epds->num_bulk_out;
+       int num_ports;
+
+       num_ports = max(epds->num_bulk_in, epds->num_bulk_out);
 
        if (num_ports == 0) {
-               dev_err(dev, "Generic device with no bulk out, not allowed.\n");
+               dev_err(dev, "device has no bulk endpoints\n");
                return -ENODEV;
        }