Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 361442
b: refs/heads/master
c: b701f16
h: refs/heads/master
v: v3
  • Loading branch information
Bjørn Mork authored and David S. Miller committed Mar 13, 2013
1 parent 6f21c76 commit 5e831b3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 34 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5b9e12dbf92b441b37136ea71dac59f05f2673a9
refs/heads/master: b701f16dd490d3f346724050f17d60beda094998
49 changes: 16 additions & 33 deletions trunk/drivers/net/usb/qmi_wwan.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,9 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)

BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data) < sizeof(struct qmi_wwan_state)));

/* control and data is shared? */
if (intf->cur_altsetting->desc.bNumEndpoints == 3) {
info->control = intf;
info->data = intf;
goto shared;
}

/* else require a single interrupt status endpoint on control intf */
if (intf->cur_altsetting->desc.bNumEndpoints != 1)
goto err;
/* set up initial state */
info->control = intf;
info->data = intf;

/* and a number of CDC descriptors */
while (len > 3) {
Expand Down Expand Up @@ -207,25 +200,14 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)
buf += h->bLength;
}

/* did we find all the required ones? */
if (!(found & (1 << USB_CDC_HEADER_TYPE)) ||
!(found & (1 << USB_CDC_UNION_TYPE))) {
dev_err(&intf->dev, "CDC functional descriptors missing\n");
goto err;
}

/* verify CDC Union */
if (desc->bInterfaceNumber != cdc_union->bMasterInterface0) {
dev_err(&intf->dev, "bogus CDC Union: master=%u\n", cdc_union->bMasterInterface0);
goto err;
}

/* need to save these for unbind */
info->control = intf;
info->data = usb_ifnum_to_if(dev->udev, cdc_union->bSlaveInterface0);
if (!info->data) {
dev_err(&intf->dev, "bogus CDC Union: slave=%u\n", cdc_union->bSlaveInterface0);
goto err;
/* Use separate control and data interfaces if we found a CDC Union */
if (cdc_union) {
info->data = usb_ifnum_to_if(dev->udev, cdc_union->bSlaveInterface0);
if (desc->bInterfaceNumber != cdc_union->bMasterInterface0 || !info->data) {
dev_err(&intf->dev, "bogus CDC Union: master=%u, slave=%u\n",
cdc_union->bMasterInterface0, cdc_union->bSlaveInterface0);
goto err;
}
}

/* errors aren't fatal - we can live with the dynamic address */
Expand All @@ -235,11 +217,12 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)
}

/* claim data interface and set it up */
status = usb_driver_claim_interface(driver, info->data, dev);
if (status < 0)
goto err;
if (info->control != info->data) {
status = usb_driver_claim_interface(driver, info->data, dev);
if (status < 0)
goto err;
}

shared:
status = qmi_wwan_register_subdriver(dev);
if (status < 0 && info->control != info->data) {
usb_set_intfdata(info->data, NULL);
Expand Down

0 comments on commit 5e831b3

Please sign in to comment.