Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753181AbbHER4L (ORCPT ); Wed, 5 Aug 2015 13:56:11 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:53778 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751495AbbHER4K (ORCPT ); Wed, 5 Aug 2015 13:56:10 -0400 Date: Wed, 5 Aug 2015 12:56:02 -0500 From: Felipe Balbi To: Alan Stern CC: Robert Baldyga , , , , Subject: Re: [PATCH v6 4/8] usb: gadget: move find_ep() from epautoconf to gadget.h Message-ID: <20150805175518.GI12328@saruman.tx.rr.com> Reply-To: References: <1438776130-29716-5-git-send-email-r.baldyga@samsung.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="qD3brAgIG4LbUq6d" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2867 Lines: 80 --qD3brAgIG4LbUq6d Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 05, 2015 at 10:30:54AM -0400, Alan Stern wrote: > On Wed, 5 Aug 2015, Robert Baldyga wrote: >=20 > > Move find_ep() function to gadget.h, rename it to gadget_find_ep_by_nam= e() > > and make it static inline. It can be used in UDC drivers, especially in > > 'match_ep' callback after moving chip-specific endpoint matching logic = =66rom > > epautoconf to UDC drivers. >=20 > > --- 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) > > =20 > > +/** > > + * 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; > > +} >=20 > Minor point: Is this function short enough to be worth inlining? My=20 > general feeling has been that anything containing a nontrivial loop=20 > 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 ? --=20 balbi --qD3brAgIG4LbUq6d Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVwk4yAAoJEIaOsuA1yqRE+SEP/0Wa4OMOVbqau1TkRxlCXj0X 4PPTCwiK+ZY8Kse0Qfti0M1KnB9x8f7iMIYIJjl4dMe7hvnl/eOV6NK799Cv651S Cryu/4DceMrVGrmz6af0bKTZCM0x7COratqd6yhwvagZBgMhUMdk+IO5Kdt3a0+Y Kxpn4h3iLwFn6pML4kK+lIFhCULsTr7VjqZHhRmytWakFBOauAsvGNJQaQTR0+t8 rgcZGYAJ96NlS/9ACHvQoim1JCoxFhw/bGGat8NmvseT8+a73H+fzpZiHOnEm4FK LS1AUr5fx6z2AgOInclNvea9QQo8PGy0hAkyfI9cbXK1jetGr9D74wyKG7Q/Xc81 tGYCdvfXXu+tbQm0MotEGYckmifHxJn4qKW0V5QQuG3vaGhe65d6rQFKCG3AUPAp mixCqD4gRLCpQvONN9dE3/sEHrTU8Ygd2TGJm8bifyMptOTrLGAiEq2wwA3Ve+Tk UCxP+m/oaGr/Nf2Pjw91IAIddy2S0Lb4hQjm2pOoTOA1bVi9TPkD509daGBh2Att RnuN/dF/QlHjtVVk/K8gpV99MU1256oNrt9HV6nnGBHkLsNUhjdrQyVHrEv+clJ2 jeqoUUTBIUtqkZnA4GcARuiMH9tqf8PQ5dHuM0rfNkpGVxVOazsCAMy+IcGk6tdN IlmMIrP6cIhni8yA7o+n =UPTc -----END PGP SIGNATURE----- --qD3brAgIG4LbUq6d-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/