From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754203AbcFTJus (ORCPT ); Mon, 20 Jun 2016 05:50:48 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:48729 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752803AbcFTJul (ORCPT ); Mon, 20 Jun 2016 05:50:41 -0400 Subject: Re: [PATCH v10 06/14] usb: gadget.h: Add OTG to gadget interface To: Felipe Balbi , 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> CC: , , , , , , , , , , , , , , , , From: Roger Quadros Message-ID: <5767BAAF.9010307@ti.com> Date: Mon, 20 Jun 2016 12:43:11 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <87inx4qkka.fsf@linux.intel.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="H08H8ABFebAQ4VTR7HvVF2bUIrreaAjAr" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --H08H8ABFebAQ4VTR7HvVF2bUIrreaAjAr Content-Type: multipart/mixed; boundary="o54bPdH6RopKC3sfraJ7iG71Pxcjit4ti" From: Roger Quadros To: Felipe Balbi , peter.chen@freescale.com Cc: tony@atomide.com, gregkh@linuxfoundation.org, dan.j.williams@intel.com, mathias.nyman@linux.intel.com, Joao.Pinto@synopsys.com, sergei.shtylyov@cogentembedded.com, jun.li@freescale.com, grygorii.strashko@ti.com, yoshihiro.shimoda.uh@renesas.com, robh@kernel.org, nsekhar@ti.com, b-liu@ti.com, joe@perches.com, linux-usb@vger.kernel.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Message-ID: <5767BAAF.9010307@ti.com> Subject: Re: [PATCH v10 06/14] usb: gadget.h: Add OTG to gadget interface 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> In-Reply-To: <87inx4qkka.fsf@linux.intel.com> --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--