Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754323AbcJMLW4 (ORCPT ); Thu, 13 Oct 2016 07:22:56 -0400 Received: from mga11.intel.com ([192.55.52.93]:60164 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752717AbcJMLWs (ORCPT ); Thu, 13 Oct 2016 07:22:48 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,339,1473145200"; d="asc'?scan'208";a="1044138730" From: Felipe Balbi To: Janusz Dziedzic , Baolin Wang Cc: Greg KH , Mark Brown , USB , LKML Subject: Re: [RESEND PATCH v3 1/2] usb: dwc3: gadget: Add disconnect checking when changing function dynamically In-Reply-To: References: <521625dd7f5e335e2a681ec65ebffc5832207e5f.1475570367.git.baolin.wang@linaro.org> <87oa2ovicc.fsf@linux.intel.com> <87d1j4vasr.fsf@linux.intel.com> Date: Thu, 13 Oct 2016 14:22:09 +0300 Message-ID: <871szkv6hq.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-Length: 3116 Lines: 82 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, Janusz Dziedzic writes: >>> Baolin Wang writes: >>>>>>>>>> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget= .c >>>>>>>>>> index 1783406..ca2ae5b 100644 >>>>>>>>>> --- a/drivers/usb/dwc3/gadget.c >>>>>>>>>> +++ b/drivers/usb/dwc3/gadget.c >>>>>>>>>> @@ -241,6 +241,9 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *= dep, unsigned cmd, >>>>>>>>>> int susphy =3D false; >>>>>>>>>> int ret =3D -EINVAL; >>>>>>>>>> >>>>>>>>>> + if (!dwc->pullups_connected) >>>>>>>>>> + return -ESHUTDOWN; >>>>>>>>>> + >>>>>>> >>>>>>> you skip trace_dwc3_gadget_ep_cmd() >>>>>> >>>>>> Yes, we did not need trace here since we did not send out the comman= d. >>>>>> >>>>> What in such case: enumeration will not work and this will be because >>>>> this ESHUTDOWN or wrong pullups_connected usage. Without a trace you >>>>> will not know where the problem is. >>>>> In my opinion this trace could be useful. >>>> >>>> We have returned the '-ESHUTDOWN' error number for user to know what >>>> happened. >>> >>> No, this is actually not good and Janusz has a very valid point >>> here. When we're debugging something in dwc3, we want to rely on >>> tracepoints to tell us what's going on. I don't want to have to add more >>> debugging messages to print out that ESHUTDOWN error just so I can >>> figure out what's going on. You should be patching this in a way that >>> the tracepoint is still printed out properly. >> >> Fine. Will fix this in next version. >> > > BTW, did you test this patch with device mode? > Seems in my setup this fail - DWC3_DEPCMD_SETEPCONFIG for ep0out and > gadget_start() failed (enumeration fail). > Don't we need to queue ep0 cmds before pullup? Baolin, it's clear to me that you're not testing any of the patches you're sending me. I just reviewed this part of the code and we _do_ indeed enable the control pipe before connecting pullups and that *must* be done this way, otherwise we won't be able to receive first Setup packet from host. How have you tested this? Against which tree? =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCAAGBQJX/25hAAoJEMy+uJnhGpkGOQ4P/26dbseRsrQVrYIA3uuIjT2s 4ojZiaRTr4lXCVZ2t6bwHjCZaObi42xS6/3NADGul5tHkOcTgr3I774yJGoSouqO 2JXtEnVT/ZGSSqPhGjz2UzDJjo7jCf235mLDjq3lJIZWk185Z5C0nBxpOlmEdSya YFc9JvtRKJ0v6FPNXXUrBVGKKgeFwyRUcbUk2Nnj6YX2rc3Fu15HMRPavQwpKmYu kyKhSpNZJ6rc9I7Lk3Ij7SIXmCu/2i1BbLI/0oPSLuS1dYMmSMnQN94ZxvmRMLyC Oy4TOCWKssr+M/T13EBn8A1sAco5HfKTp4yHcEd05nEa71l0VX2J7KOsgzcPqC1f StD4tavp/LQZyG4ZC6jk27yG+aJDBVqh9mOSNB5dYTjjWqSTiY1F3qQBlBgBGRmD itIM/zrCiEzucxByojIkl8LQxR7jOA04BC6hc7n24ZWoK7w5Pps8jg3bQqWThKMo 03sBf2qQlQjO3hkgoBNRsB1PLs6P5IMl/Kw8s9Eixgq8FJrrA6eQyo7F9+pExEIf N/cp+4C7SyqXtFqMDP/i1hYZXuP1lg1qMpJD/u32FsH/MjqYQPyWqwoIO2jHLHAS a7K1eN8rhrOXOQyRQLkuQ3CKO5aQujSPvN17DwgPLpZUezNsJedEUPgsdlQg0eD3 p648HAmdz4E90B6Isck5 =9gvH -----END PGP SIGNATURE----- --=-=-=--