diff options
author | Bjørn Mork <bjorn@mork.no> | 2012-10-09 10:35:38 +0200 |
---|---|---|
committer | Bjørn Mork <bjorn@mork.no> | 2012-10-09 16:25:20 +0200 |
commit | cd1f26e384453fa3aea5b16789fb481681cc7328 (patch) | |
tree | 11e7384ceeed55b5239fe6fc952aacdaa078e78f | |
parent | e25c5064eb506266f730bfdde8abf6e652321687 (diff) |
net: cdc_ncm: do not bind to NCM compatible MBIM devices
If the MBIM driver is enabled then that should have priority
for devices providing NCM 1.0 backward compatibility according
to the MBIM specification.
Signed-off-by: Bjørn Mork <bjorn@mork.no>
-rw-r--r-- | drivers/net/usb/cdc_ncm.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index 86149052e84..a625a52e4e4 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c @@ -584,6 +584,33 @@ static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf) { int ret; + /* The MBIM spec defines a NCM compatible default altsetting, + * which we may have matched: + * + * "Functions that implement both NCM 1.0 and MBIM (an + * “NCM/MBIM function”) according to this recommendation + * shall provide two alternate settings for the + * Communication Interface. Alternate setting 0, and the + * associated class and endpoint descriptors, shall be + * constructed according to the rules given for the + * Communication Interface in section 5 of [USBNCM10]. + * Alternate setting 1, and the associated class and + * endpoint descriptors, shall be constructed according to + * the rules given in section 6 (USB Device Model) of this + * specification." + * + * Do not bind to such interfaces, allowing cdc_mbim to handle + * them + */ +#if IS_ENABLED(CONFIG_USB_NET_CDC_MBIM) + if ((intf->num_altsetting == 2) && + usb_set_interface(dev->udev, + intf->cur_altsetting->desc.bInterfaceNumber, + CDC_NCM_COMM_ALTSETTING_MBIM) && + cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) + return -ENODEV; +#endif + /* NCM data altsetting is always 1 */ ret = cdc_ncm_bind_common(dev, intf, 1); |