From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roger Quadros Subject: Re: [PATCH v10 06/14] usb: gadget.h: Add OTG to gadget interface Date: Mon, 20 Jun 2016 12:43:11 +0300 Message-ID: <5767BAAF.9010307@ti.com> References: <1465564043-27163-1-git-send-email-rogerq@ti.com> <1465564043-27163-7-git-send-email-rogerq@ti.com> <87k2hkxr4d.fsf@linux.intel.com> <57679B30.6030809@ti.com> <87d1ncxopa.fsf@linux.intel.com> <5767A87C.20704@ti.com> <87inx4qkka.fsf@linux.intel.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="H08H8ABFebAQ4VTR7HvVF2bUIrreaAjAr" Return-path: In-Reply-To: <87inx4qkka.fsf-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> Sender: linux-usb-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Felipe Balbi , peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org Cc: tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org, gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org, dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org, mathias.nyman-VuQAYsv1563Yd54FQh9/CA@public.gmane.org, Joao.Pinto-HKixBCOQz3hWk0Htik3J/w@public.gmane.org, sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org, jun.li-KZfg59tc24xl57MIdRCFDg@public.gmane.org, grygorii.strashko-l0cyMroinI0@public.gmane.org, yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org, robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, nsekhar-l0cyMroinI0@public.gmane.org, b-liu-l0cyMroinI0@public.gmane.org, joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org, linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: devicetree@vger.kernel.org --H08H8ABFebAQ4VTR7HvVF2bUIrreaAjAr Content-Type: multipart/mixed; boundary="o54bPdH6RopKC3sfraJ7iG71Pxcjit4ti" From: Roger Quadros To: Felipe Balbi , peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org Cc: tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org, gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org, dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org, mathias.nyman-VuQAYsv1563Yd54FQh9/CA@public.gmane.org, Joao.Pinto-HKixBCOQz3hWk0Htik3J/w@public.gmane.org, sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org, jun.li-KZfg59tc24xl57MIdRCFDg@public.gmane.org, grygorii.strashko-l0cyMroinI0@public.gmane.org, yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org, robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, nsekhar-l0cyMroinI0@public.gmane.org, b-liu-l0cyMroinI0@public.gmane.org, joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org, linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Message-ID: <5767BAAF.9010307-l0cyMroinI0@public.gmane.org> Subject: Re: [PATCH v10 06/14] usb: gadget.h: Add OTG to gadget interface References: <1465564043-27163-1-git-send-email-rogerq-l0cyMroinI0@public.gmane.org> <1465564043-27163-7-git-send-email-rogerq-l0cyMroinI0@public.gmane.org> <87k2hkxr4d.fsf-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> <57679B30.6030809-l0cyMroinI0@public.gmane.org> <87d1ncxopa.fsf-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> <5767A87C.20704-l0cyMroinI0@public.gmane.org> <87inx4qkka.fsf-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> In-Reply-To: <87inx4qkka.fsf-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> --o54bPdH6RopKC3sfraJ7iG71Pxcjit4ti Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 20/06/16 12:24, Felipe Balbi wrote: >=20 > Hi, >=20 > Roger Quadros writes: >>>>> Roger Quadros writes: >>>>>> The OTG core will use struct otg_gadget_ops to >>>>>> start/stop the gadget controller. >>>>>> >>>>>> The main purpose of this interface is to avoid directly >>>>>> calling usb_gadget_start/stop() from the OTG core as they >>>>>> wouldn't be defined in the built-in symbol table if >>>>>> CONFIG_USB_GADGET is m. >>>>>> >>>>>> Signed-off-by: Roger Quadros >>>>>> --- >>>>>> include/linux/usb/gadget.h | 16 ++++++++++++++++ >>>>>> 1 file changed, 16 insertions(+) >>>>>> >>>>>> diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget= =2Eh >>>>>> index 2dd9e6b..f4fc0aa 100644 >>>>>> --- a/include/linux/usb/gadget.h >>>>>> +++ b/include/linux/usb/gadget.h >>>>>> @@ -639,6 +639,22 @@ struct usb_gadget_driver { >>>>>> }; >>>>>> =20 >>>>>> =20 >>>>>> +/*---------------------------------------------------------------= ----------*/ >>>>>> + >>>>>> +/** >>>>>> + * struct otg_gadget_ops - Interface between OTG core and gadget >>>>>> + * >>>>>> + * Provided by the gadget core to allow the OTG core to start/sto= p the gadget >>>>>> + * >>>>>> + * @start: function to start the gadget >>>>>> + * @stop: function to stop the gadget >>>>>> + * @connect_control: function to connect/disconnect from the bus >>>>>> + */ >>>>>> +struct otg_gadget_ops { >>>>>> + int (*start)(struct usb_gadget *gadget); >>>>>> + int (*stop)(struct usb_gadget *gadget); >>>>>> + int (*connect_control)(struct usb_gadget *gadget, bool connect);= >>>>>> +}; >>>>> >>>>> you shouldn't need these at all. They are already part of the gadge= t >>>>> framework as ->udc_start(), ->udc_stop() and ->pullup() >>>>> >>>> >>>> This is to avoid the undefined symbol errors during build when OTG h= as is >>>> built-in because USB (host) is built-in but GADGET is still a module= =2E >>> >>> change your Kconfig dependencies. OTG layer shouldn't be built-in unl= ess >>> both Gadget and Host are built-in. >>> >> >> That is only one side of the story. >> What happens if OTG is (m), Host is (m) but Gadget is (built in). >> >> Gadget build will fail because of undefined symbol errors for all of >> the OTG APIs. >=20 > So you created a circular dependency, right? That's not good either. I > suggest you clean that up because this is bound to create randconfig > build problems in the long run. >=20 We can't avoid the circular dependency. Gadget/Host has to register with otg. otg has to use gadget & host functi= ons. If you have better ideas, please let us know. cheers, -roger --o54bPdH6RopKC3sfraJ7iG71Pxcjit4ti-- --H08H8ABFebAQ4VTR7HvVF2bUIrreaAjAr Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXZ7qvAAoJENJaa9O+djCTF8wP/jgSEyLN66G2bq23eGHRnL5v HVBDVNZYFxfNl7x9H2AIBr152W9hf7jcSZEhhzoO2PbHHkd/y17D5F8PXxJjNXP5 BW10brvPbpQ3OaRceHuxx2ZcV3Y9dG0G8Rd8l691S2Hr+lPUONdExH9kFnJPLxjf SfdcZhNiJouBicYIbkF+Z7WgkZBJF7DiGVu395aoSEr4t1xV32BrnDKEMSzOAEe7 UZST27WBhmFTTtQZeIUTesKF9c/IpyEtitPGUqENpJWD0TLel8FIhW5ncyXbeHHD IpCVC3F5tNXEvwFoC3xJ5XLEiblzDC7G8sP9yganvZNQHHdqW4WjkO8Dv2lPG4zi /uwy3Y1Xg0FaGORWDi0PyGMQrYHiUCMHV5zxZLd9LtpY3X3/9qlyJIXoDoFHwpvK QAO5sla3gT08EaXRX3qqIoPjNBTqnTBiaPnq9b1TPiVFB7hFEdZlC2e8mKnogTpq ahEq1elTyd1aZameRVrnbl7ggE04Yj+ufkEX79eiS1dwFHQCfHNyRrQnYVetpP50 F2yNPJ0ImYF4+TtVaE3Tp5VisUGId3D/zoYSb3qtZNuPqnQFI3Y0AhU3OmWvoYn4 8jnU67Fp3N0b/JnICP+GYYNL9Cqj/Pin/6JPIJjCCggu/kitLvhyO16ApcNfrFJx R9AulB+f4/mTVkrmSGfr =3mk9 -----END PGP SIGNATURE----- --H08H8ABFebAQ4VTR7HvVF2bUIrreaAjAr-- -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html