aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/f_ecm.c
diff options
context:
space:
mode:
authorTatyana Brokhman <tlinder@codeaurora.org>2011-06-28 09:33:48 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-06-28 14:14:36 -0400
commit72c973dd2b01b212a159faa330a2bc641a3ed809 (patch)
tree2fbc36b4103678cd9b7599deaab06f89e4871de2 /drivers/usb/gadget/f_ecm.c
parent0f91349b89f37dfad7b77f7829a105b6a0f526ec (diff)
usb: gadget: add usb_endpoint_descriptor to struct usb_ep
Change usb_ep_enable() prototype to use endpoint descriptor from usb_ep. This optimization spares the FDs from saving the endpoint chosen descriptor. This optimization is not full though. To fully exploit this change, one needs to update all the UDCs as well since in the current implementation each of them saves the endpoint descriptor in it's internal (and extended) endpoint structure. 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.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/usb/gadget/f_ecm.c b/drivers/usb/gadget/f_ecm.c
index 544257a89ed2..7c996f271ccb 100644
--- a/drivers/usb/gadget/f_ecm.c
+++ b/drivers/usb/gadget/f_ecm.c
@@ -68,7 +68,6 @@ struct f_ecm {
68 struct ecm_ep_descs hs; 68 struct ecm_ep_descs hs;
69 69
70 struct usb_ep *notify; 70 struct usb_ep *notify;
71 struct usb_endpoint_descriptor *notify_desc;
72 struct usb_request *notify_req; 71 struct usb_request *notify_req;
73 u8 notify_state; 72 u8 notify_state;
74 bool is_open; 73 bool is_open;
@@ -466,11 +465,11 @@ static int ecm_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
466 usb_ep_disable(ecm->notify); 465 usb_ep_disable(ecm->notify);
467 } else { 466 } else {
468 VDBG(cdev, "init ecm ctrl %d\n", intf); 467 VDBG(cdev, "init ecm ctrl %d\n", intf);
469 ecm->notify_desc = ep_choose(cdev->gadget, 468 ecm->notify->desc = ep_choose(cdev->gadget,
470 ecm->hs.notify, 469 ecm->hs.notify,
471 ecm->fs.notify); 470 ecm->fs.notify);
472 } 471 }
473 usb_ep_enable(ecm->notify, ecm->notify_desc); 472 usb_ep_enable(ecm->notify);
474 ecm->notify->driver_data = ecm; 473 ecm->notify->driver_data = ecm;
475 474
476 /* Data interface has two altsettings, 0 and 1 */ 475 /* Data interface has two altsettings, 0 and 1 */
@@ -483,11 +482,11 @@ static int ecm_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
483 gether_disconnect(&ecm->port); 482 gether_disconnect(&ecm->port);
484 } 483 }
485 484
486 if (!ecm->port.in) { 485 if (!ecm->port.in_ep->desc) {
487 DBG(cdev, "init ecm\n"); 486 DBG(cdev, "init ecm\n");
488 ecm->port.in = ep_choose(cdev->gadget, 487 ecm->port.in_ep->desc = ep_choose(cdev->gadget,
489 ecm->hs.in, ecm->fs.in); 488 ecm->hs.in, ecm->fs.in);
490 ecm->port.out = ep_choose(cdev->gadget, 489 ecm->port.out_ep->desc = ep_choose(cdev->gadget,
491 ecm->hs.out, ecm->fs.out); 490 ecm->hs.out, ecm->fs.out);
492 } 491 }
493 492
@@ -549,7 +548,7 @@ static void ecm_disable(struct usb_function *f)
549 if (ecm->notify->driver_data) { 548 if (ecm->notify->driver_data) {
550 usb_ep_disable(ecm->notify); 549 usb_ep_disable(ecm->notify);
551 ecm->notify->driver_data = NULL; 550 ecm->notify->driver_data = NULL;
552 ecm->notify_desc = NULL; 551 ecm->notify->desc = NULL;
553 } 552 }
554} 553}
555 554
@@ -723,9 +722,9 @@ fail:
723 /* we might as well release our claims on endpoints */ 722 /* we might as well release our claims on endpoints */
724 if (ecm->notify) 723 if (ecm->notify)
725 ecm->notify->driver_data = NULL; 724 ecm->notify->driver_data = NULL;
726 if (ecm->port.out) 725 if (ecm->port.out_ep->desc)
727 ecm->port.out_ep->driver_data = NULL; 726 ecm->port.out_ep->driver_data = NULL;
728 if (ecm->port.in) 727 if (ecm->port.in_ep->desc)
729 ecm->port.in_ep->driver_data = NULL; 728 ecm->port.in_ep->driver_data = NULL;
730 729
731 ERROR(cdev, "%s: can't bind, err %d\n", f->name, status); 730 ERROR(cdev, "%s: can't bind, err %d\n", f->name, status);