Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1201029
| From | Felipe Balbi <balbi@ti.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v6 4/8] usb: gadget: move find_ep() from epautoconf to gadget.h |
| Date | 2015-08-05 20:00 +0200 |
| Message-ID | <pUb8S-7b-5@gated-at.bofh.it> (permalink) |
| References | <pU5G9-P2-21@gated-at.bofh.it> <pU81k-483-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
[Multipart message — attachments visible in raw view] - view raw
On Wed, Aug 05, 2015 at 10:30:54AM -0400, Alan Stern wrote:
> On Wed, 5 Aug 2015, Robert Baldyga wrote:
>
> > Move find_ep() function to gadget.h, rename it to gadget_find_ep_by_name()
> > and make it static inline. It can be used in UDC drivers, especially in
> > 'match_ep' callback after moving chip-specific endpoint matching logic from
> > epautoconf to UDC drivers.
>
> > --- a/include/linux/usb/gadget.h
> > +++ b/include/linux/usb/gadget.h
> > @@ -639,6 +639,24 @@ static inline struct usb_gadget *dev_to_usb_gadget(struct device *dev)
> > #define gadget_for_each_ep(tmp, gadget) \
> > list_for_each_entry(tmp, &(gadget)->ep_list, ep_list)
> >
> > +/**
> > + * gadget_find_ep_by_name - returns ep whose name is the same as sting passed
> > + * in second parameter or NULL if searched endpoint not found
> > + * @g: controller to check for quirk
> > + * @name: name of searched endpoint
> > + */
> > +static inline struct usb_ep *
> > +gadget_find_ep_by_name(struct usb_gadget *g, const char *name)
> > +{
> > + struct usb_ep *ep;
> > +
> > + gadget_for_each_ep(ep, g) {
> > + if (!strcmp(ep->name, name))
> > + return ep;
> > + }
> > +
> > + return NULL;
> > +}
>
> Minor point: Is this function short enough to be worth inlining? My
> general feeling has been that anything containing a nontrivial loop
> probably shouldn't be inlined, but I could be wrong.
makes sense. Looks like moving it to udc-core.c and making it
EXPORT_SYMBOL_GPL() would be the way to go ?
--
balbi
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v6 4/8] usb: gadget: move find_ep() from epautoconf to gadget.h Robert Baldyga <r.baldyga@samsung.com> - 2015-08-05 14:10 +0200
Re: [PATCH v6 4/8] usb: gadget: move find_ep() from epautoconf to gadget.h Alan Stern <stern@rowland.harvard.edu> - 2015-08-05 16:40 +0200
Re: [PATCH v6 4/8] usb: gadget: move find_ep() from epautoconf to gadget.h Felipe Balbi <balbi@ti.com> - 2015-08-05 20:00 +0200
csiph-web