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" <changbin.du@intel.com>
Subject: [PATCH v2] usb: gadget: make usb_ep_enable return -EBUSY if ep has already enabled
Date: Mon, 14 Dec 2015 11:40:21 +0800 [thread overview]
Message-ID: <1450064421-30553-1-git-send-email-changbin.du@intel.com> (raw)
In-Reply-To: <8737vajjy7.fsf@saruman.tx.rr.com>
From: "Du, Changbin" <changbin.du@intel.com>
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 <changbin.du@intel.com>
---
change from v1: add WARN_ON_ONCE message.
---
include/linux/usb/gadget.h | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 3d583a1..b88df2a 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -267,8 +267,12 @@ static inline int usb_ep_enable(struct usb_ep *ep)
{
int ret;
- if (ep->enabled)
- return 0;
+ /**
+ * An enabled ep may has requests in progress, hence shouldn't
+ * reprogram its hw configuration.
+ */
+ if (WARN_ON_ONCE(ep->enabled))
+ return -EBUSY;
ret = ep->ops->enable(ep, ep->desc);
if (ret)
--
2.5.0
prev parent reply other threads:[~2015-12-14 3:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-04 7:24 [PATCH] " changbin.du
2015-12-10 17:24 ` Felipe Balbi
2015-12-14 3:16 ` Du, Changbin
2015-12-14 3:40 ` changbin.du [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1450064421-30553-1-git-send-email-changbin.du@intel.com \
--to=changbin.du@intel.com \
--cc=John.Youn@synopsys.com \
--cc=balbi@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®