Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752237AbbLNDQp (ORCPT ); Sun, 13 Dec 2015 22:16:45 -0500 Received: from mga02.intel.com ([134.134.136.20]:26589 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752029AbbLNDQo convert rfc822-to-8bit (ORCPT ); Sun, 13 Dec 2015 22:16:44 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,425,1444719600"; d="scan'208";a="872921702" From: "Du, Changbin" To: Felipe Balbi CC: "gregkh@linuxfoundation.org" , "John.Youn@synopsys.com" , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] usb: gadget: make usb_ep_enable return -EBUSY if ep has already enabled Thread-Topic: [PATCH] usb: gadget: make usb_ep_enable return -EBUSY if ep has already enabled Thread-Index: AQHRLmX+EDWPhVhgmkCobzBfo5vIqJ7D/EgAgAXgO4A= Date: Mon, 14 Dec 2015 03:16:39 +0000 Message-ID: <0C18FE92A7765D4EB9EE5D38D86A563A01DF60A2@SHSMSX103.ccr.corp.intel.com> References: <1449213890-27390-1-git-send-email-changbin.du@intel.com> <8737vajjy7.fsf@saruman.tx.rr.com> In-Reply-To: <8737vajjy7.fsf@saruman.tx.rr.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1153 Lines: 35 > > 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; > > > > 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; > > -- > balbi I will update the patch, thanks. -- 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/