diff options
author | Tatyana Brokhman <tlinder@codeaurora.org> | 2011-06-28 09:33:48 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-06-28 14:14:36 -0400 |
commit | 72c973dd2b01b212a159faa330a2bc641a3ed809 (patch) | |
tree | 2fbc36b4103678cd9b7599deaab06f89e4871de2 /drivers/usb/gadget/f_loopback.c | |
parent | 0f91349b89f37dfad7b77f7829a105b6a0f526ec (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_loopback.c')
-rw-r--r-- | drivers/usb/gadget/f_loopback.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/usb/gadget/f_loopback.c b/drivers/usb/gadget/f_loopback.c index b37960f9e753..34e3ccaf0884 100644 --- a/drivers/usb/gadget/f_loopback.c +++ b/drivers/usb/gadget/f_loopback.c | |||
@@ -250,26 +250,24 @@ static int | |||
250 | enable_loopback(struct usb_composite_dev *cdev, struct f_loopback *loop) | 250 | enable_loopback(struct usb_composite_dev *cdev, struct f_loopback *loop) |
251 | { | 251 | { |
252 | int result = 0; | 252 | int result = 0; |
253 | const struct usb_endpoint_descriptor *src, *sink; | ||
254 | struct usb_ep *ep; | 253 | struct usb_ep *ep; |
255 | struct usb_request *req; | 254 | struct usb_request *req; |
256 | unsigned i; | 255 | unsigned i; |
257 | 256 | ||
258 | src = ep_choose(cdev->gadget, | ||
259 | &hs_loop_source_desc, &fs_loop_source_desc); | ||
260 | sink = ep_choose(cdev->gadget, | ||
261 | &hs_loop_sink_desc, &fs_loop_sink_desc); | ||
262 | |||
263 | /* one endpoint writes data back IN to the host */ | 257 | /* one endpoint writes data back IN to the host */ |
264 | ep = loop->in_ep; | 258 | ep = loop->in_ep; |
265 | result = usb_ep_enable(ep, src); | 259 | ep->desc = ep_choose(cdev->gadget, |
260 | &hs_loop_source_desc, &fs_loop_source_desc); | ||
261 | result = usb_ep_enable(ep); | ||
266 | if (result < 0) | 262 | if (result < 0) |
267 | return result; | 263 | return result; |
268 | ep->driver_data = loop; | 264 | ep->driver_data = loop; |
269 | 265 | ||
270 | /* one endpoint just reads OUT packets */ | 266 | /* one endpoint just reads OUT packets */ |
271 | ep = loop->out_ep; | 267 | ep = loop->out_ep; |
272 | result = usb_ep_enable(ep, sink); | 268 | ep->desc = ep_choose(cdev->gadget, |
269 | &hs_loop_sink_desc, &fs_loop_sink_desc); | ||
270 | result = usb_ep_enable(ep); | ||
273 | if (result < 0) { | 271 | if (result < 0) { |
274 | fail0: | 272 | fail0: |
275 | ep = loop->in_ep; | 273 | ep = loop->in_ep; |