From 72c973dd2b01b212a159faa330a2bc641a3ed809 Mon Sep 17 00:00:00 2001 From: Tatyana Brokhman Date: Tue, 28 Jun 2011 16:33:48 +0300 Subject: 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 Signed-off-by: Felipe Balbi Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/f_ncm.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'drivers/usb/gadget/f_ncm.c') diff --git a/drivers/usb/gadget/f_ncm.c b/drivers/usb/gadget/f_ncm.c index 86902a60bcdb..06daa1bc9ffd 100644 --- a/drivers/usb/gadget/f_ncm.c +++ b/drivers/usb/gadget/f_ncm.c @@ -70,7 +70,6 @@ struct f_ncm { struct ncm_ep_descs hs; struct usb_ep *notify; - struct usb_endpoint_descriptor *notify_desc; struct usb_request *notify_req; u8 notify_state; bool is_open; @@ -804,11 +803,11 @@ static int ncm_set_alt(struct usb_function *f, unsigned intf, unsigned alt) usb_ep_disable(ncm->notify); } else { DBG(cdev, "init ncm ctrl %d\n", intf); - ncm->notify_desc = ep_choose(cdev->gadget, + ncm->notify->desc = ep_choose(cdev->gadget, ncm->hs.notify, ncm->fs.notify); } - usb_ep_enable(ncm->notify, ncm->notify_desc); + usb_ep_enable(ncm->notify); ncm->notify->driver_data = ncm; /* Data interface has two altsettings, 0 and 1 */ @@ -829,12 +828,12 @@ static int ncm_set_alt(struct usb_function *f, unsigned intf, unsigned alt) if (alt == 1) { struct net_device *net; - if (!ncm->port.in) { + if (!ncm->port.in_ep->desc) { DBG(cdev, "init ncm\n"); - ncm->port.in = ep_choose(cdev->gadget, + ncm->port.in_ep->desc = ep_choose(cdev->gadget, ncm->hs.in, ncm->fs.in); - ncm->port.out = ep_choose(cdev->gadget, + ncm->port.out_ep->desc = ep_choose(cdev->gadget, ncm->hs.out, ncm->fs.out); } @@ -1111,7 +1110,7 @@ static void ncm_disable(struct usb_function *f) if (ncm->notify->driver_data) { usb_ep_disable(ncm->notify); ncm->notify->driver_data = NULL; - ncm->notify_desc = NULL; + ncm->notify->desc = NULL; } } @@ -1288,9 +1287,9 @@ fail: /* we might as well release our claims on endpoints */ if (ncm->notify) ncm->notify->driver_data = NULL; - if (ncm->port.out) + if (ncm->port.out_ep->desc) ncm->port.out_ep->driver_data = NULL; - if (ncm->port.in) + if (ncm->port.in_ep->desc) ncm->port.in_ep->driver_data = NULL; ERROR(cdev, "%s: can't bind, err %d\n", f->name, status); -- cgit v1.2.3-55-g7522