Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755298AbbLDHcq (ORCPT ); Fri, 4 Dec 2015 02:32:46 -0500 Received: from mga02.intel.com ([134.134.136.20]:63654 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752374AbbLDHcp (ORCPT ); Fri, 4 Dec 2015 02:32:45 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,380,1444719600"; d="scan'208";a="864483337" From: changbin.du@intel.com To: balbi@ti.com Cc: gregkh@linuxfoundation.org, John.Youn@synopsys.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, "Du, Changbin" Subject: [PATCH] usb: gadget: make usb_ep_enable return -EBUSY if ep has already enabled Date: Fri, 4 Dec 2015 15:24:50 +0800 Message-Id: <1449213890-27390-1-git-send-email-changbin.du@intel.com> X-Mailer: git-send-email 2.5.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1023 Lines: 33 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; if (ep->enabled) - return 0; + return -EBUSY; ret = ep->ops->enable(ep, ep->desc); if (ret) -- 2.5.0 -- 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/