|
@@ -2113,6 +2113,17 @@ static int mos7840_calc_num_ports(struct usb_serial *serial)
|
|
return mos7840_num_ports;
|
|
return mos7840_num_ports;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static int mos7840_attach(struct usb_serial *serial)
|
|
|
|
+{
|
|
|
|
+ if (serial->num_bulk_in < serial->num_ports ||
|
|
|
|
+ serial->num_bulk_out < serial->num_ports) {
|
|
|
|
+ dev_err(&serial->interface->dev, "missing endpoints\n");
|
|
|
|
+ return -ENODEV;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
static int mos7840_port_probe(struct usb_serial_port *port)
|
|
static int mos7840_port_probe(struct usb_serial_port *port)
|
|
{
|
|
{
|
|
struct usb_serial *serial = port->serial;
|
|
struct usb_serial *serial = port->serial;
|
|
@@ -2388,6 +2399,7 @@ static struct usb_serial_driver moschip7840_4port_device = {
|
|
.tiocmset = mos7840_tiocmset,
|
|
.tiocmset = mos7840_tiocmset,
|
|
.tiocmiwait = usb_serial_generic_tiocmiwait,
|
|
.tiocmiwait = usb_serial_generic_tiocmiwait,
|
|
.get_icount = usb_serial_generic_get_icount,
|
|
.get_icount = usb_serial_generic_get_icount,
|
|
|
|
+ .attach = mos7840_attach,
|
|
.port_probe = mos7840_port_probe,
|
|
.port_probe = mos7840_port_probe,
|
|
.port_remove = mos7840_port_remove,
|
|
.port_remove = mos7840_port_remove,
|
|
.read_bulk_callback = mos7840_bulk_in_callback,
|
|
.read_bulk_callback = mos7840_bulk_in_callback,
|