Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755361AbcJMMSv (ORCPT ); Thu, 13 Oct 2016 08:18:51 -0400 Received: from mga06.intel.com ([134.134.136.31]:21652 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752481AbcJMMSc (ORCPT ); Thu, 13 Oct 2016 08:18:32 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,339,1473145200"; d="asc'?scan'208";a="19258387" From: Felipe Balbi To: Baolin Wang Cc: Janusz Dziedzic , 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> <871szkv6hq.fsf@linux.intel.com> Date: Thu, 13 Oct 2016 15:17:06 +0300 Message-ID: <87vawwtpdp.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: 2950 Lines: 79 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, Baolin Wang writes: >>>>>>>>>>>> @@ -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 comm= and. >>>>>>>> >>>>>>> What in such case: enumeration will not work and this will be becau= se >>>>>>> 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 m= ore >>>>> 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 > > I am sure I tested every patch I send to you. But this one is really > my mistake and I thought this is just one small change with just eye > review. I am really sorry for troubles. fair enough, luckily Janusz caught it before any harm could be done. Thanks for taking the time to explain. =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCAAGBQJX/3tCAAoJEMy+uJnhGpkG4M4P/jJBVK0/8pC/3Wfh59xysVbF sGYVYBy9QsyhI5Lrz1bbDU1/hjPxhNRvyZ7CIOGcEuGXa9Bl/T/2Pmz5iPSEvjqi K4rK5BQ/mFBZyNYR+TmO4QhOqVMqkGe+PomoD9zv8YG+42ZS29X5jz+OBxjGAtRF gj1b0UocIIKuUo2zDotE9yKSPxaqg/fRGHfvHoKiwABMEfIEybYg8DXCERx1NZzA eHf16gtzSmFHy2osIvi6uKk/ZviYORQEgdF+c+intOsoSxWce/3ORZzAdhwGEL6R /XKY+WRxP+9o66Yix4yNE1AdL8SiLvZlBD9RSOvCqkJHrLBe/r5AC/Gi++cRLy7N oj9HC2KE8gmRBbHx/KnxlODWBR+SATu2WiDj3Uz5YAQUKZn7FkSs8iGw6Djvtgdi HsbZA4Z/zpj9sdYAI23VZzx/qTY58vLj5tkEgFrJ8p8djDMXlKoNU5Xzu0VsxiDn rEgIJoHjiWMs7HA5vAirXq4Q4XRsFLYhW66HUQqaWLzXOBPuPhyzpOUnhF2aZWz2 u6wuOny+VnKcwoldSWc/T/q5ADlxmwykfiwpJXD10Yb02cujMkjCldjVjkDQem9i 9pz5qkxNjWcktOD4Pn96u5+ptKJQahUv5hl+WcROmPYKu3J9o5wZMCi1KMkDrmjq 1nx2iyzHlHjjNjW7zq+e =1mRK -----END PGP SIGNATURE----- --=-=-=--