usb: gadget: Add match_ep() op to usb_gadget_ops

Add match_ep() op to usb_gadget_ops similar to Linux kernel which is
useful in finding a suitable ep match for the function driver. This will
avoid adding more gadget_is_xxx() handling code to usb_ep_autoconfig().

Also sync usb_ep_caps struct thats is usually used in the match_ep()
callback by the gadget controller driver

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
This commit is contained in:
Vignesh Raghavendra
2019-10-01 17:26:31 +05:30
committed by Marek Vasut
parent c93e305af7
commit 77dcbdf3c1
2 changed files with 26 additions and 0 deletions

View File

@@ -282,6 +282,9 @@ struct usb_ep *usb_ep_autoconfig(
return ep;
}
if (gadget->ops->match_ep)
ep = gadget->ops->match_ep(gadget, desc, NULL);
/* Second, look at endpoints until an unclaimed one looks usable */
list_for_each_entry(ep, &gadget->ep_list, ep_list) {
if (ep_matches(gadget, ep, desc))