aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/serial/mos7840.c
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@linaro.org>2017-03-20 12:02:33 +0800
committerAlex Shi <alex.shi@linaro.org>2017-03-20 12:02:33 +0800
commit156f7b56ee4b918b95991750e0f34da8ad416eae (patch)
treefd47da260b3c78631721f36edf01b2878358283a /drivers/usb/serial/mos7840.c
parent2e2fb031287a5946d97b85769f80ca60f0166e15 (diff)
parentd97f745e1d2fea4d2f308e5e06eee81a9a84f3f5 (diff)
Merge branch 'linux-linaro-lsk-v4.1' into linux-linaro-lsk-v4.1-rtlsk-v4.1-17.06-rtlsk-v4.1-17.05-rtlsk-v4.1-17.03-rtlinux-linaro-lsk-v4.1-rt
Diffstat (limited to 'drivers/usb/serial/mos7840.c')
-rw-r--r--drivers/usb/serial/mos7840.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index f5ab4cd9e7a1..d9f7b3bae09a 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -2116,6 +2116,17 @@ static int mos7840_calc_num_ports(struct usb_serial *serial)
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)
{
struct usb_serial *serial = port->serial;
@@ -2394,6 +2405,7 @@ static struct usb_serial_driver moschip7840_4port_device = {
.tiocmset = mos7840_tiocmset,
.tiocmiwait = usb_serial_generic_tiocmiwait,
.get_icount = usb_serial_generic_get_icount,
+ .attach = mos7840_attach,
.port_probe = mos7840_port_probe,
.port_remove = mos7840_port_remove,
.read_bulk_callback = mos7840_bulk_in_callback,