提交 56a666dc 编写于 作者: B Bjørn Mork 提交者: David S. Miller

net: cdc_ncm: use IAD provided by the USB core

commit 9992c2e2 (net: cdc_ncm: workaround for missing CDC Union)
added code to lookup an IAD for the interface we are probing.
This is redundant.  The USB core has already done the lookup
and saved the result in the USB interface struct.  Use that
instead.

Cc: Greg Suarez <gsuarez@smithmicro.com>
Cc: Alexey Orishko <alexey.orishko@stericsson.com>
Signed-off-by: NBjørn Mork <bjorn@mork.no>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 2afd0a24
...@@ -344,23 +344,6 @@ static const struct ethtool_ops cdc_ncm_ethtool_ops = { ...@@ -344,23 +344,6 @@ static const struct ethtool_ops cdc_ncm_ethtool_ops = {
.nway_reset = usbnet_nway_reset, .nway_reset = usbnet_nway_reset,
}; };
/* return first slave interface if an IAD matches the given master */
static struct usb_interface *get_iad_slave(struct usb_device *udev,
struct usb_interface *master) {
int i;
struct usb_interface_assoc_descriptor *iad;
u8 mnum = master->cur_altsetting->desc.bInterfaceNumber;
for (i = 0; i < USB_MAXIADS; i++) {
iad = udev->actconfig->intf_assoc[i];
if (!iad)
break;
if (iad->bFirstInterface == mnum && iad->bInterfaceCount == 2)
return usb_ifnum_to_if(udev, mnum + 1);
}
return NULL;
}
int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting) int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting)
{ {
struct cdc_ncm_ctx *ctx; struct cdc_ncm_ctx *ctx;
...@@ -453,13 +436,10 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_ ...@@ -453,13 +436,10 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_
} }
/* some buggy devices have an IAD but no CDC Union */ /* some buggy devices have an IAD but no CDC Union */
if (!ctx->union_desc) { if (!ctx->union_desc && intf->intf_assoc && intf->intf_assoc->bInterfaceCount == 2) {
dev_dbg(&intf->dev, "missing CDC Union descriptor\n"); ctx->control = intf;
ctx->data = get_iad_slave(dev->udev, intf); ctx->data = usb_ifnum_to_if(dev->udev, intf->cur_altsetting->desc.bInterfaceNumber + 1);
if (ctx->data) { dev_dbg(&intf->dev, "CDC Union missing - got slave from IAD\n");
ctx->control = intf;
dev_dbg(&intf->dev, "got slave from IAD\n");
}
} }
/* check if we got everything */ /* check if we got everything */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册