mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Robert Baldyga <r.baldyga@samsung.com>, <balbi@ti.com>,
	<gregkh@linuxfoundation.org>, <linux-kernel@vger.kernel.org>,
	<linux-usb@vger.kernel.org>
Subject: Re: [PATCH v6 4/8] usb: gadget: move find_ep() from epautoconf to gadget.h
Date: Wed, 5 Aug 2015 12:56:02 -0500	[thread overview]
Message-ID: <20150805175518.GI12328@saruman.tx.rr.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1508051028470.1713-100000@iolanthe.rowland.org>

[-- Attachment #1: Type: text/plain, Size: 1542 bytes --]

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

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-08-05 17:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-05 12:02 [PATCH v6 0/8] usb: gadget: rework ep matching and claiming mechanism Robert Baldyga
2015-08-05 12:02 ` [PATCH v6 1/8] usb: gadget: epautoconf: rework ep_matches() function Robert Baldyga
2015-08-05 12:02 ` [PATCH v6 2/8] usb: gadget: add 'ep_match' callback to usb_gadget_ops Robert Baldyga
2015-08-05 12:02 ` [PATCH v6 3/8] usb: gadget: move ep_matches() from epautoconf to udc-core Robert Baldyga
2015-08-05 12:02 ` [PATCH v6 4/8] usb: gadget: move find_ep() from epautoconf to gadget.h Robert Baldyga
2015-08-05 14:30   ` Alan Stern
2015-08-05 17:56     ` Felipe Balbi [this message]
2015-08-05 12:02 ` [PATCH v6 5/8] usb: gadget: net2280: add net2280_match_ep() function Robert Baldyga
2015-08-05 12:02 ` [PATCH v6 6/8] usb: gadget: goku_udc: add goku_match_ep() function Robert Baldyga
2015-08-05 12:02 ` [PATCH v6 7/8] usb: musb: gadget: add musb_match_ep() function Robert Baldyga
2015-08-05 12:02 ` [PATCH v6 8/8] usb: gadget: remove gadget_chips.h Robert Baldyga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150805175518.GI12328@saruman.tx.rr.com \
    --to=balbi@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=r.baldyga@samsung.com \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome