From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753972AbbEZRKV (ORCPT ); Tue, 26 May 2015 13:10:21 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:47470 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752740AbbEZRKR (ORCPT ); Tue, 26 May 2015 13:10:17 -0400 Date: Tue, 26 May 2015 12:08:10 -0500 From: Felipe Balbi To: Robert Baldyga CC: , , , , , Subject: Re: [PATCH v2 0/5] usb: gadget: Fix gadget deactivaton feature Message-ID: <20150526170810.GR26599@saruman.tx.rr.com> Reply-To: References: <1430744115-22096-1-git-send-email-r.baldyga@samsung.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ShzQXCswyqjgWi6k" Content-Disposition: inline In-Reply-To: <1430744115-22096-1-git-send-email-r.baldyga@samsung.com> 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 --ShzQXCswyqjgWi6k Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, May 04, 2015 at 02:55:10PM +0200, Robert Baldyga wrote: > Hi, >=20 > This patch set introduces two functions usb_gadget_deactivate() and > usb_gadget_activate(), designed to prevent udc-core from showing binded > gadget to host until it will be ready to work. It also makes > usb_function_deactivate()/activate() using these functions. >=20 > So far gadget deactivation was made by calling usb_gadget_disconnect(), > but since we have usb_gadget_connect() called after gadget->bind() > (in udc_bind_to_driver()) this method doesn't provide expected result. > Calling function usb_gadget_disconnect() before gadget connection doesn't > prevent udc-core from connecting gadget to driver - usb_gadget_disconnect= () > call is ignored and gadget is connected regardless to it. This usually > results with errors, for example because we binded gadget with 0 > configurations. >=20 > This patch set fixes this problem adding functions allowing to perform > effective gadget deactivation from gadget->bind(). >=20 > According to Felipe's suggestion, in v2 there is one new patch adding > 'bind_deactivated' flag, which should be used by functions which want > to be binded as deactivated (for example because they need to wait for > userspace daemon). Functions using this flag have to call > usb_function_activate() to tell composite core they are ready to work. > I have also converted functions which are using deactivation feature > to make them using 'bind_deactivated' flag. Patches are also attached > to this patch set. >=20 > I was considering removing usb_function_deactivate() function since we > have this flag, but I see that some of USB functions use it not only > in bind() but also e.g. when userspace daemon disconnects. This is also > the reason why I haven't named this flag 'controls_pullup', because this > name doesn't describe precisely what does it mean. >=20 > We also need to consider what to do when deactivation fails (which can > happen if our UDC driver doesn't support the pullup callback). So far, > when usb_function_deactivate() was called in bind(), we have had ability > to decide what to do, when it fails. Now we preform function deactivation > before its bind(), and when deactivation fails we fail to add the function > to gadget. Maybe we should to allow it to continue despite deactivation > failure and inform function (somehow) about this situation. If only it > makes any sense, because in this form it looks more complicated that > it was, and moreover it actually doesn't add any new features. I'll defer this series for v4.3 merge window because I'm still not entirely convinced we need this new reference counter. Sorry about that. --=20 balbi --ShzQXCswyqjgWi6k Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVZKh6AAoJEIaOsuA1yqRE4a8QAJoJTVPRZBidDVGxA3m0X5n/ 5ImZaYNQh7XBdwaJB2+dxiRP+2se206Qs3o9lHX6OdBdNaxdh8kqdysWMWC+rOlU zqt+ihLgIqPwTYx9zOtW4JJ8doSZX5P2+mXToPHNGz8cRoj9JZY481f2SDxbmUxQ xWB9nJBmN8GPA51AAmXmA7QoYjf6rmpcRqRiHuh2u1IqrF1YxpXizj7J8VZRBr0w 20LSXNWh29xwt4dAo63hWeSXQCgXtf1ciEp1yXEazNTF0ilCd9UWXk6TWHRpAJ+9 tTLoNVyUMRHxNfkmikite4mhdi3Usxiu1QL/UV+KOqqHFojI5gAT/cMlpi80yoP5 3uXKgFfB19CCLOgaRgGUkumhShWSkfmdbxV+chQncUeHqqltiShAc4lNNIo/LiHj uqIB+q0L4rqpRinb9iHIfboXlPOx3Udwh7LrYRVfxYVqIGXPP5H+ESxBPa6ZxLw5 7stPLFab7YcvC+mglFogFdk6PsoAhZTiAUAyQHYfbxDSeFfUImznd6gIl5wqpljK lOcfn4WW71G3WzFaCVL4NuXcfndoaFJsxkhbfR3eHjE4xMLECCnDhOGu+2tvJtOc ebtNT2RZ0njVk1PHF9ge2/egIPQ8j/L8aWiZoLPzkXpb5VkOWa7nHdn8qUeAdRCl eACVk25pu1PmV/ebhWIX =/u4G -----END PGP SIGNATURE----- --ShzQXCswyqjgWi6k--