From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753545AbcFTJZs (ORCPT ); Mon, 20 Jun 2016 05:25:48 -0400 Received: from mga01.intel.com ([192.55.52.88]:8592 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753044AbcFTJZl (ORCPT ); Mon, 20 Jun 2016 05:25:41 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,497,1459839600"; d="asc'?scan'208";a="979496569" From: Felipe Balbi To: Roger Quadros , 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 Subject: Re: [PATCH v10 06/14] usb: gadget.h: Add OTG to gadget interface In-Reply-To: <5767A87C.20704@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> User-Agent: Notmuch/0.22+51~gcc1a6d2 (http://notmuchmail.org) Emacs/25.0.93.2 (x86_64-pc-linux-gnu) Importance: low Date: Mon, 20 Jun 2016 12:24:53 +0300 Message-ID: <87inx4qkka.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, 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.h >>>>> 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 >>>>>=20=20 >>>>> +/*------------------------------------------------------------------= -------*/ >>>>> + >>>>> +/** >>>>> + * struct otg_gadget_ops - Interface between OTG core and gadget >>>>> + * >>>>> + * Provided by the gadget core to allow the OTG core to start/stop t= he 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 gadget >>>> framework as ->udc_start(), ->udc_stop() and ->pullup() >>>> >>> >>> This is to avoid the undefined symbol errors during build when OTG has = is >>> built-in because USB (host) is built-in but GADGET is still a module. >>=20 >> change your Kconfig dependencies. OTG layer shouldn't be built-in unless >> both Gadget and Host are built-in. >>=20 > > 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. 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. =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXZ7ZlAAoJEIaOsuA1yqREfYkP/R1xSGTH10UaHaKzuRE/OYja 7qonpnHP0lz/TxQg/A/ZzPyMUIZESJ1ls6qZHpMY1w2pg+9jO5BuhkvmOD/HA3pf 1E4fPnlL9M/6yCyWYLbJB7A86p9MjMg43RSty2rqyVoVDtT/+KPvkht6Fq0FVBiU 0zXqz6t3Zi/jmgXK3qFcFCoB0sIMN5M4UJbrksyx0Mi7doIWX26hRRmMR3+PkZT6 7oT+hbXLN1KP7OzNzJ9lq5POZz0P3oxMxUDKStZgP16DAzLTQTIQOd/Vjg0NRGfM kfwH/dcLvLVlaRET+K9WsauTr6mcz7IuPkFMKekASO1HHTW39usF/7Rhcx9Px/gE Ww2ZeUpEhnefkCmig0V4XzX1KRnBE+c32/60mpNdUNDYonDkRaRNHblvtktkQXaG 9eX5s+Vu7+wjWWSQVg4GdoYb0qK/uiQGEFhYWI6IUq5CqPDKbdMu9HS0Nf2sIjdS waw46DlJ7SThWP+LqmiEtQzedNCCGt/YshjCnaHKCtfKqTPh9GMEXudB/0fXiELz B/OZnE/kz+mlJVFHl2hgf/LUa6oxo8uTFf5+Ptu+CXXOdFIfKIwr3qoj5Y695rIa VbN5cdl8dVD+G8xERMV+L32ngHEeUvfP/QJ0l68pFpxf8+JKVDVYYGCBLIuQKt9G +GJ+9D5OlvSzl2tpOnhy =FpJd -----END PGP SIGNATURE----- --=-=-=--