diff options
author | Bjørn Mork <bjorn@mork.no> | 2013-11-01 06:17:00 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-11-02 02:02:04 -0400 |
commit | 296e81f84c7ef7272cca1636386d55acc1af3238 (patch) | |
tree | a7b6afa0a876f97160305cea67cee863720c26df | |
parent | 59ede3168a0b3fe02f82a7bed52432f18dbb1070 (diff) |
net: cdc_ncm: improve bind error debug messages
Make it a bit easier for users to figure out what goes
wrong when bind fails.
Cc: Alexey Orishko <alexey.orishko@gmail.com>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/usb/cdc_ncm.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index f168bc8c1d38..4531f38fc0e5 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c | |||
@@ -371,8 +371,10 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_ | |||
371 | union_desc = (const struct usb_cdc_union_desc *)buf; | 371 | union_desc = (const struct usb_cdc_union_desc *)buf; |
372 | /* the master must be the interface we are probing */ | 372 | /* the master must be the interface we are probing */ |
373 | if (intf->cur_altsetting->desc.bInterfaceNumber != | 373 | if (intf->cur_altsetting->desc.bInterfaceNumber != |
374 | union_desc->bMasterInterface0) | 374 | union_desc->bMasterInterface0) { |
375 | dev_dbg(&intf->dev, "bogus CDC Union\n"); | ||
375 | goto error; | 376 | goto error; |
377 | } | ||
376 | ctx->data = usb_ifnum_to_if(dev->udev, | 378 | ctx->data = usb_ifnum_to_if(dev->udev, |
377 | union_desc->bSlaveInterface0); | 379 | union_desc->bSlaveInterface0); |
378 | break; | 380 | break; |
@@ -416,45 +418,59 @@ advance: | |||
416 | } | 418 | } |
417 | 419 | ||
418 | /* check if we got everything */ | 420 | /* check if we got everything */ |
419 | if (!ctx->data || (!ctx->mbim_desc && !ctx->ether_desc)) | 421 | if (!ctx->data || (!ctx->mbim_desc && !ctx->ether_desc)) { |
422 | dev_dbg(&intf->dev, "CDC descriptors missing\n"); | ||
420 | goto error; | 423 | goto error; |
424 | } | ||
421 | 425 | ||
422 | /* claim data interface, if different from control */ | 426 | /* claim data interface, if different from control */ |
423 | if (ctx->data != ctx->control) { | 427 | if (ctx->data != ctx->control) { |
424 | temp = usb_driver_claim_interface(driver, ctx->data, dev); | 428 | temp = usb_driver_claim_interface(driver, ctx->data, dev); |
425 | if (temp) | 429 | if (temp) { |
430 | dev_dbg(&intf->dev, "failed to claim data intf\n"); | ||
426 | goto error; | 431 | goto error; |
432 | } | ||
427 | } | 433 | } |
428 | 434 | ||
429 | iface_no = ctx->data->cur_altsetting->desc.bInterfaceNumber; | 435 | iface_no = ctx->data->cur_altsetting->desc.bInterfaceNumber; |
430 | 436 | ||
431 | /* reset data interface */ | 437 | /* reset data interface */ |
432 | temp = usb_set_interface(dev->udev, iface_no, 0); | 438 | temp = usb_set_interface(dev->udev, iface_no, 0); |
433 | if (temp) | 439 | if (temp) { |
440 | dev_dbg(&intf->dev, "set interface failed\n"); | ||
434 | goto error2; | 441 | goto error2; |
442 | } | ||
435 | 443 | ||
436 | /* configure data interface */ | 444 | /* configure data interface */ |
437 | temp = usb_set_interface(dev->udev, iface_no, data_altsetting); | 445 | temp = usb_set_interface(dev->udev, iface_no, data_altsetting); |
438 | if (temp) | 446 | if (temp) { |
447 | dev_dbg(&intf->dev, "set interface failed\n"); | ||
439 | goto error2; | 448 | goto error2; |
449 | } | ||
440 | 450 | ||
441 | cdc_ncm_find_endpoints(dev, ctx->data); | 451 | cdc_ncm_find_endpoints(dev, ctx->data); |
442 | cdc_ncm_find_endpoints(dev, ctx->control); | 452 | cdc_ncm_find_endpoints(dev, ctx->control); |
443 | if (!dev->in || !dev->out || !dev->status) | 453 | if (!dev->in || !dev->out || !dev->status) { |
454 | dev_dbg(&intf->dev, "failed to collect endpoints\n"); | ||
444 | goto error2; | 455 | goto error2; |
456 | } | ||
445 | 457 | ||
446 | /* initialize data interface */ | 458 | /* initialize data interface */ |
447 | if (cdc_ncm_setup(dev)) | 459 | if (cdc_ncm_setup(dev)) { |
460 | dev_dbg(&intf->dev, "cdc_ncm_setup() failed\n"); | ||
448 | goto error2; | 461 | goto error2; |
462 | } | ||
449 | 463 | ||
450 | usb_set_intfdata(ctx->data, dev); | 464 | usb_set_intfdata(ctx->data, dev); |
451 | usb_set_intfdata(ctx->control, dev); | 465 | usb_set_intfdata(ctx->control, dev); |
452 | 466 | ||
453 | if (ctx->ether_desc) { | 467 | if (ctx->ether_desc) { |
454 | temp = usbnet_get_ethernet_addr(dev, ctx->ether_desc->iMACAddress); | 468 | temp = usbnet_get_ethernet_addr(dev, ctx->ether_desc->iMACAddress); |
455 | if (temp) | 469 | if (temp) { |
470 | dev_dbg(&intf->dev, "failed to get mac address\n"); | ||
456 | goto error2; | 471 | goto error2; |
457 | dev_info(&dev->udev->dev, "MAC-Address: %pM\n", dev->net->dev_addr); | 472 | } |
473 | dev_info(&intf->dev, "MAC-Address: %pM\n", dev->net->dev_addr); | ||
458 | } | 474 | } |
459 | 475 | ||
460 | /* usbnet use these values for sizing tx/rx queues */ | 476 | /* usbnet use these values for sizing tx/rx queues */ |
@@ -471,7 +487,7 @@ error2: | |||
471 | error: | 487 | error: |
472 | cdc_ncm_free((struct cdc_ncm_ctx *)dev->data[0]); | 488 | cdc_ncm_free((struct cdc_ncm_ctx *)dev->data[0]); |
473 | dev->data[0] = 0; | 489 | dev->data[0] = 0; |
474 | dev_info(&dev->udev->dev, "bind() failure\n"); | 490 | dev_info(&intf->dev, "bind() failure\n"); |
475 | return -ENODEV; | 491 | return -ENODEV; |
476 | } | 492 | } |
477 | EXPORT_SYMBOL_GPL(cdc_ncm_bind_common); | 493 | EXPORT_SYMBOL_GPL(cdc_ncm_bind_common); |