Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751629AbcJMHKC (ORCPT ); Thu, 13 Oct 2016 03:10:02 -0400 Received: from mga09.intel.com ([134.134.136.24]:62416 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750763AbcJMHJz (ORCPT ); Thu, 13 Oct 2016 03:09:55 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,339,1473145200"; d="asc'?scan'208";a="19176900" From: Felipe Balbi To: Baolin Wang Cc: gregkh@linuxfoundation.org, broonie@kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, baolin.wang@linaro.org Subject: Re: [RESEND PATCH v3 1/2] usb: dwc3: gadget: Add disconnect checking when changing function dynamically In-Reply-To: <521625dd7f5e335e2a681ec65ebffc5832207e5f.1475570367.git.baolin.wang@linaro.org> References: <521625dd7f5e335e2a681ec65ebffc5832207e5f.1475570367.git.baolin.wang@linaro.org> Date: Thu, 13 Oct 2016 10:06:11 +0300 Message-ID: <87oa2ovicc.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: 2542 Lines: 79 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, Baolin Wang writes: > When system has stpped the gadget, we should avoid queuing any requests queueing is *not* a problem. Starting is. In fact, that's what your patch is doing. > which will cause tranfer failed. Thus adding some disconnect checking to ^^^^^^^ transfer > avoid this situation. > > Signed-off-by: Baolin Wang > --- > Changes since v2: > - Move disconnect checking into dwc3_send_gadget_ep_cmd(). > - Rename completion name and issue complete() at one place. > - Move completion initialization into dwc3_gadget_init(). > > Changes since v1: > - Split into 2 separate ptaches. > - Choose complete mechanism instead of polling. > --- > drivers/usb/dwc3/gadget.c | 3 +++ > 1 file changed, 3 insertions(+) > > 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, unsi= gned cmd, > int susphy =3D false; > int ret =3D -EINVAL; >=20=20 > + if (!dwc->pullups_connected) > + return -ESHUTDOWN; > + > /* > * Synopsys Databook 2.60a states, on section 6.3.2.5.[1-8], that if > * we're issuing an endpoint command, we must check if > --=20 > 1.7.9.5 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCAAGBQJX/zJjAAoJEMy+uJnhGpkGvpkP/jL9tWToaTEL9ohVIUwz458a 64zTio1RFzPg2L2bdn1jcCRhw7cz0tSe7PkVyzWxknBwsxzDAsjCZ346SRCZGa0z HayhUcr9pYEe+Z9vre/JtdP7/yjqsyMQIzyN+Kb6hYr1wcjbFmiZj3ol5pmpYiY7 F528Q+hbQm/ZcSFyirN+pubZLcqdrhsxVx7WpdlGy2kq+lHzn/YETsGRR6d8QVlx H4Z8fUtBRn8OMVX1ytEigYbsRnLxsEkwNmtb9qAc4k73l14WiZhjjmU0v1t+52w3 SoW9izQ0XYz8z5B/rHz/OQduMy/4qK/iFCV4AM8c8tytGhVAtV//VgDcVn/8tebJ 8GuzNntRFBvW8xDStXJibTasPNpxXFVhUpaiQbNtF/TenuqZwSHGBuH/xfcnR3tG gzPBP/jQu62EdP5OBs5gyqHZtG3nQ3foxw8qnKAx9JuT5O2GP1TumzjU0jE1Ocvs wzEkEw+cbowNT8H48FvvsXT2IvcNb1PGs/CmPHnpLshDt+lZzNNWX956XiFjYMct 7yuszvQKl8feGndqSx3Ls6Zu9DLPKZaW9p28M5n6toA75WdZFQbWbW39PHQ/JAkw REweuE/JwE8ix2NeKyPzzEwjsMxD00JR7ZVXEHTfGemuXEiqEwQdNDdjkTgY3I5X v63m3zTaWf9aQaOCapdd =Exir -----END PGP SIGNATURE----- --=-=-=--