Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752689AbbLJRYX (ORCPT ); Thu, 10 Dec 2015 12:24:23 -0500 Received: from bear.ext.ti.com ([192.94.94.41]:53754 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751512AbbLJRYW (ORCPT ); Thu, 10 Dec 2015 12:24:22 -0500 From: Felipe Balbi To: CC: , , , , "Du, Changbin" Subject: Re: [PATCH] usb: gadget: make usb_ep_enable return -EBUSY if ep has already enabled In-Reply-To: <1449213890-27390-1-git-send-email-changbin.du@intel.com> References: <1449213890-27390-1-git-send-email-changbin.du@intel.com> User-Agent: Notmuch/0.21 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Thu, 10 Dec 2015 11:24:16 -0600 Message-ID: <8737vajjy7.fsf@saruman.tx.rr.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2137 Lines: 65 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, changbin.du@intel.com writes: > From: "Du, Changbin" > > When usb_ep_enable on a enabled ep, the configuration of the ep probably > has changed. In this scenario, the ep configuration in hw should be > reprogrammed by udc driver. Hence, it is better to return an error to > inform the caller. > > Signed-off-by: Du, Changbin > --- > include/linux/usb/gadget.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h > index d813bd2..89f9fdd 100644 > --- a/include/linux/usb/gadget.h > +++ b/include/linux/usb/gadget.h > @@ -268,7 +268,7 @@ static inline int usb_ep_enable(struct usb_ep *ep) > int ret; >=20=20 > if (ep->enabled) > - return 0; > + return -EBUSY; While at that, can you add a WARN_ON() as well ? if (WARN_ON(ep->enabled)) return -EBUSY; =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWabVBAAoJEIaOsuA1yqREO1MQAJ7fYC8lfjL9zyeVB1SKDGuB QmBKAzI8NgshzEIVOR0qplRQ2yZs7vN9RHNMdIZIU6/emeo3dNbTwU7RSw/i14o6 bInz/VnQYAHvPv2+sCJEQAjwQy5Gs6MUNaO4sN//zIoPRS5JgusRQqSvwCNSNNHP kVRxPGRFUX0N2MjFiP4IfOUdgnx/e1VTd/O3QMioNI1B3RDORrGH1LwjYOg13pAD sKBjY6SHejugooCTHGZF41PWVbW1P1EEjBALx5U2xtF6PLNatcKNE+c3KuM6ZAoP 75cphwhPiynpwk3yuTQeWmcuQxiLS+INBEEEPdynMSVaWe/bu0i7PpKsIh9NjWrQ dVX1mBIxYuw1j3HCek0uAH84KMniF61JEqcIO8gdycXM3rVAVox12BE0GnXfJedC dMRQ+WaVfro3KaagZ9Z4U3ECwBalVlCbBggaqQ7/BTNwTxdKj8FUg1/mir3TPWM+ 1QWVzSXaiNktQFx6ye8PBj4hCIZefXu39ryrmGMfmqM9kvTaykZiP/urxSlC5yfV 1nCg0PRgVszA/xPzChT/sYREPSrNwmyThxk/Y1y6QXgo82Zi/nvRA8t9epbJ6bZ7 kzei+zNs5BQXiIeNc6WcSBy7r+UdpponpmJZAlk2je5R2e/eLT+TzU2Xgrx46X7v UPJMShsaVnolSmfRmOMA =PW+X -----END PGP SIGNATURE----- --=-=-=-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/