aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/f_ecm.c
diff options
context:
space:
mode:
authorTatyana Brokhman <tlinder@codeaurora.org>2011-06-28 09:33:50 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-06-28 14:14:37 -0400
commitea2a1df7b2b1de839a72217d85bfb4b7b049010c (patch)
tree89c10a2a18bba8a1d448b8b1f1281cf52b2287c6 /drivers/usb/gadget/f_ecm.c
parent48767a4e8263620c347c3fa17812c943dd0fc2fa (diff)
usb: gadget: use config_ep_by_speed() instead of ep_choose()
Remove obsolete functions: 1. ep_choose() 2. usb_find_endpoint() Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/f_ecm.c')
-rw-r--r--drivers/usb/gadget/f_ecm.c45
1 files changed, 14 insertions, 31 deletions
diff --git a/drivers/usb/gadget/f_ecm.c b/drivers/usb/gadget/f_ecm.c
index 7c996f271ccb..ddedbc83bc37 100644
--- a/drivers/usb/gadget/f_ecm.c
+++ b/drivers/usb/gadget/f_ecm.c
@@ -46,11 +46,6 @@
46 * and also means that a get_alt() method is required. 46 * and also means that a get_alt() method is required.
47 */ 47 */
48 48
49struct ecm_ep_descs {
50 struct usb_endpoint_descriptor *in;
51 struct usb_endpoint_descriptor *out;
52 struct usb_endpoint_descriptor *notify;
53};
54 49
55enum ecm_notify_state { 50enum ecm_notify_state {
56 ECM_NOTIFY_NONE, /* don't notify */ 51 ECM_NOTIFY_NONE, /* don't notify */
@@ -64,9 +59,6 @@ struct f_ecm {
64 59
65 char ethaddr[14]; 60 char ethaddr[14];
66 61
67 struct ecm_ep_descs fs;
68 struct ecm_ep_descs hs;
69
70 struct usb_ep *notify; 62 struct usb_ep *notify;
71 struct usb_request *notify_req; 63 struct usb_request *notify_req;
72 u8 notify_state; 64 u8 notify_state;
@@ -463,11 +455,11 @@ static int ecm_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
463 if (ecm->notify->driver_data) { 455 if (ecm->notify->driver_data) {
464 VDBG(cdev, "reset ecm control %d\n", intf); 456 VDBG(cdev, "reset ecm control %d\n", intf);
465 usb_ep_disable(ecm->notify); 457 usb_ep_disable(ecm->notify);
466 } else { 458 }
459 if (!(ecm->notify->desc)) {
467 VDBG(cdev, "init ecm ctrl %d\n", intf); 460 VDBG(cdev, "init ecm ctrl %d\n", intf);
468 ecm->notify->desc = ep_choose(cdev->gadget, 461 if (config_ep_by_speed(cdev->gadget, f, ecm->notify))
469 ecm->hs.notify, 462 goto fail;
470 ecm->fs.notify);
471 } 463 }
472 usb_ep_enable(ecm->notify); 464 usb_ep_enable(ecm->notify);
473 ecm->notify->driver_data = ecm; 465 ecm->notify->driver_data = ecm;
@@ -482,12 +474,17 @@ static int ecm_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
482 gether_disconnect(&ecm->port); 474 gether_disconnect(&ecm->port);
483 } 475 }
484 476
485 if (!ecm->port.in_ep->desc) { 477 if (!ecm->port.in_ep->desc ||
478 !ecm->port.out_ep->desc) {
486 DBG(cdev, "init ecm\n"); 479 DBG(cdev, "init ecm\n");
487 ecm->port.in_ep->desc = ep_choose(cdev->gadget, 480 if (config_ep_by_speed(cdev->gadget, f,
488 ecm->hs.in, ecm->fs.in); 481 ecm->port.in_ep) ||
489 ecm->port.out_ep->desc = ep_choose(cdev->gadget, 482 config_ep_by_speed(cdev->gadget, f,
490 ecm->hs.out, ecm->fs.out); 483 ecm->port.out_ep)) {
484 ecm->port.in_ep->desc = NULL;
485 ecm->port.out_ep->desc = NULL;
486 goto fail;
487 }
491 } 488 }
492 489
493 /* CDC Ethernet only sends data in non-default altsettings. 490 /* CDC Ethernet only sends data in non-default altsettings.
@@ -664,13 +661,6 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f)
664 if (!f->descriptors) 661 if (!f->descriptors)
665 goto fail; 662 goto fail;
666 663
667 ecm->fs.in = usb_find_endpoint(ecm_fs_function,
668 f->descriptors, &fs_ecm_in_desc);
669 ecm->fs.out = usb_find_endpoint(ecm_fs_function,
670 f->descriptors, &fs_ecm_out_desc);
671 ecm->fs.notify = usb_find_endpoint(ecm_fs_function,
672 f->descriptors, &fs_ecm_notify_desc);
673
674 /* support all relevant hardware speeds... we expect that when 664 /* support all relevant hardware speeds... we expect that when
675 * hardware is dual speed, all bulk-capable endpoints work at 665 * hardware is dual speed, all bulk-capable endpoints work at
676 * both speeds 666 * both speeds
@@ -687,13 +677,6 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f)
687 f->hs_descriptors = usb_copy_descriptors(ecm_hs_function); 677 f->hs_descriptors = usb_copy_descriptors(ecm_hs_function);
688 if (!f->hs_descriptors) 678 if (!f->hs_descriptors)
689 goto fail; 679 goto fail;
690
691 ecm->hs.in = usb_find_endpoint(ecm_hs_function,
692 f->hs_descriptors, &hs_ecm_in_desc);
693 ecm->hs.out = usb_find_endpoint(ecm_hs_function,
694 f->hs_descriptors, &hs_ecm_out_desc);
695 ecm->hs.notify = usb_find_endpoint(ecm_hs_function,
696 f->hs_descriptors, &hs_ecm_notify_desc);
697 } 680 }
698 681
699 /* NOTE: all that is done without knowing or caring about 682 /* NOTE: all that is done without knowing or caring about