diff options
| -rw-r--r-- | drivers/net/usb/cdc_ncm.c | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index f94711caa08a..9197b2c72ca3 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c | |||
| @@ -344,23 +344,6 @@ static const struct ethtool_ops cdc_ncm_ethtool_ops = { | |||
| 344 | .nway_reset = usbnet_nway_reset, | 344 | .nway_reset = usbnet_nway_reset, |
| 345 | }; | 345 | }; |
| 346 | 346 | ||
| 347 | /* return first slave interface if an IAD matches the given master */ | ||
| 348 | static struct usb_interface *get_iad_slave(struct usb_device *udev, | ||
| 349 | struct usb_interface *master) { | ||
| 350 | int i; | ||
| 351 | struct usb_interface_assoc_descriptor *iad; | ||
| 352 | u8 mnum = master->cur_altsetting->desc.bInterfaceNumber; | ||
| 353 | |||
| 354 | for (i = 0; i < USB_MAXIADS; i++) { | ||
| 355 | iad = udev->actconfig->intf_assoc[i]; | ||
| 356 | if (!iad) | ||
| 357 | break; | ||
| 358 | if (iad->bFirstInterface == mnum && iad->bInterfaceCount == 2) | ||
| 359 | return usb_ifnum_to_if(udev, mnum + 1); | ||
| 360 | } | ||
| 361 | return NULL; | ||
| 362 | } | ||
| 363 | |||
| 364 | int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting) | 347 | int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting) |
| 365 | { | 348 | { |
| 366 | struct cdc_ncm_ctx *ctx; | 349 | struct cdc_ncm_ctx *ctx; |
| @@ -453,13 +436,10 @@ advance: | |||
| 453 | } | 436 | } |
| 454 | 437 | ||
| 455 | /* some buggy devices have an IAD but no CDC Union */ | 438 | /* some buggy devices have an IAD but no CDC Union */ |
| 456 | if (!ctx->union_desc) { | 439 | if (!ctx->union_desc && intf->intf_assoc && intf->intf_assoc->bInterfaceCount == 2) { |
| 457 | dev_dbg(&intf->dev, "missing CDC Union descriptor\n"); | 440 | ctx->control = intf; |
| 458 | ctx->data = get_iad_slave(dev->udev, intf); | 441 | ctx->data = usb_ifnum_to_if(dev->udev, intf->cur_altsetting->desc.bInterfaceNumber + 1); |
| 459 | if (ctx->data) { | 442 | dev_dbg(&intf->dev, "CDC Union missing - got slave from IAD\n"); |
| 460 | ctx->control = intf; | ||
| 461 | dev_dbg(&intf->dev, "got slave from IAD\n"); | ||
| 462 | } | ||
| 463 | } | 443 | } |
| 464 | 444 | ||
| 465 | /* check if we got everything */ | 445 | /* check if we got everything */ |
