All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavankumar Kondeti <pkondeti-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
To: greg-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Pavankumar Kondeti
	<pkondeti-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Subject: [PATCH 5/7] USB: gadget: Use ep0out for control OUT data phase in ci13xxx_udc
Date: Fri, 29 Apr 2011 10:42:53 +0530	[thread overview]
Message-ID: <1304053975-1960-5-git-send-email-pkondeti@codeaurora.org> (raw)
In-Reply-To: <1304053975-1960-1-git-send-email-pkondeti-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>

The current code queue the control OUT data request to ep0in instead of
ep0out.  Check ep0_dir and use the correct control endpoint.

Signed-off-by: Pavankumar Kondeti <pkondeti-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
---
 drivers/usb/gadget/ci13xxx_udc.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/gadget/ci13xxx_udc.c b/drivers/usb/gadget/ci13xxx_udc.c
index 1b095cb..09c76a1 100644
--- a/drivers/usb/gadget/ci13xxx_udc.c
+++ b/drivers/usb/gadget/ci13xxx_udc.c
@@ -1843,6 +1843,7 @@ __releases(mEp->lock)
 __acquires(mEp->lock)
 {
 	struct ci13xxx_req *mReq, *mReqTemp;
+	struct ci13xxx_ep *mEpTemp = mEp;
 	int uninitialized_var(retval);
 
 	trace("%p", mEp);
@@ -1859,7 +1860,10 @@ __acquires(mEp->lock)
 		dbg_done(_usb_addr(mEp), mReq->ptr->token, retval);
 		if (mReq->req.complete != NULL) {
 			spin_unlock(mEp->lock);
-			mReq->req.complete(&mEp->ep, &mReq->req);
+			if ((mEp->type == USB_ENDPOINT_XFER_CONTROL) &&
+					mReq->req.length)
+				mEpTemp = &_udc->ep0in;
+			mReq->req.complete(&mEpTemp->ep, &mReq->req);
 			spin_lock(mEp->lock);
 		}
 	}
@@ -2248,11 +2252,15 @@ static int ep_queue(struct usb_ep *ep, struct usb_request *req,
 
 	spin_lock_irqsave(mEp->lock, flags);
 
-	if (mEp->type == USB_ENDPOINT_XFER_CONTROL &&
-	    !list_empty(&mEp->qh.queue)) {
-		_ep_nuke(mEp);
-		retval = -EOVERFLOW;
-		warn("endpoint ctrl %X nuked", _usb_addr(mEp));
+	if (mEp->type == USB_ENDPOINT_XFER_CONTROL) {
+		if (req->length)
+			mEp = (_udc->ep0_dir == RX) ?
+				&_udc->ep0out : &_udc->ep0in;
+		if (!list_empty(&mEp->qh.queue)) {
+			_ep_nuke(mEp);
+			retval = -EOVERFLOW;
+			warn("endpoint ctrl %X nuked", _usb_addr(mEp));
+		}
 	}
 
 	/* first nuke then test link, e.g. previous status has not sent */
-- 
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2011-04-29  5:12 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-28  7:58 [PATCH 1/5] USB: gadget: Fix unused variable warning in ci13xxx_udc Pavankumar Kondeti
2011-04-28  7:58 ` [PATCH 2/5] USB: gadget: Fix bug in endpoint feature request processing " Pavankumar Kondeti
     [not found] ` <1303977501-17115-1-git-send-email-pkondeti-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2011-04-28  7:58   ` [PATCH 3/5] USB: gadget: Use ep0out for control OUT data phase " Pavankumar Kondeti
2011-04-28  7:58 ` [PATCH 4/5] USB: gadget: Initialize ep0 once while registering gadget " Pavankumar Kondeti
2011-04-28  7:58 ` [PATCH 5/5] USB: OTG: msm: Clear in_lpm flag before enabling the IRQ in resume Pavankumar Kondeti
2011-04-28 10:01 ` [PATCH 1/5] USB: gadget: Fix unused variable warning in ci13xxx_udc Michal Nazarewicz
2011-04-28 10:19   ` Pavan Kondeti
     [not found]     ` <4DB93F48.4050803-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2011-04-28 16:30       ` David Brown
2011-04-29  5:12 ` [PATCH 1/7] USB: gadget: Fix typo (s/EBUSY/-EBUSY) " Pavankumar Kondeti
2011-04-29  5:12   ` [PATCH 2/7] USB: gadget: Use bitwise AND operator to test flags " Pavankumar Kondeti
2011-04-29  5:12   ` [PATCH 3/7] USB: gadget: Fix unused variable warning " Pavankumar Kondeti
2011-04-29  5:12   ` [PATCH 4/7] USB: gadget: Fix bug in endpoint feature request processing " Pavankumar Kondeti
     [not found]   ` <1304053975-1960-1-git-send-email-pkondeti-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2011-04-29  5:12     ` Pavankumar Kondeti [this message]
2011-04-29 16:04     ` [PATCH 1/7] USB: gadget: Fix typo (s/EBUSY/-EBUSY) " David Brown
     [not found]       ` <8yay62txcwc.fsf-AOX6H5vLt3Uj8izMo0bVsAC/G2K4zDHf@public.gmane.org>
2011-04-30  0:29         ` Greg KH
2011-05-02  5:44           ` Pavan Kondeti
2011-05-02  6:09       ` Pavan Kondeti
2011-04-29  5:12   ` [PATCH 6/7] USB: gadget: Initialize ep0 once while registering gadget " Pavankumar Kondeti
2011-04-29  5:12   ` [PATCH 7/7] USB: OTG: msm: Clear in_lpm flag before enabling the IRQ in resume Pavankumar Kondeti
2011-05-02  6:26 ` [PATCH V2 0/7] Typo & BUG fixes for MSM USB drivers Pavankumar Kondeti
     [not found]   ` <1304317593-21808-1-git-send-email-pkondeti-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2011-05-02  6:26     ` [PATCH V2 1/7] USB: gadget: Fix typo (s/EBUSY/-EBUSY) in ci13xxx_udc Pavankumar Kondeti
2011-05-02  6:26     ` [PATCH V2 3/7] USB: gadget: Fix unused variable warning " Pavankumar Kondeti
2011-05-02  6:26   ` [PATCH V2 2/7] USB: gadget: Use bitwise AND operator to test flags " Pavankumar Kondeti
2011-05-02  6:26   ` [PATCH V2 4/7] USB: gadget: Fix bug in endpoint feature request processing " Pavankumar Kondeti
2011-05-02  6:26   ` [PATCH V2 5/7] USB: gadget: Use ep0out for control OUT data phase " Pavankumar Kondeti
2011-05-02  6:26   ` [PATCH V2 6/7] USB: gadget: Initialize ep0 once while registering gadget " Pavankumar Kondeti
2011-05-02  6:26   ` [PATCH V2 7/7] USB: OTG: msm: Clear in_lpm flag before enabling the IRQ in resume Pavankumar Kondeti

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=1304053975-1960-5-git-send-email-pkondeti@codeaurora.org \
    --to=pkondeti-sgv2jx0feol9jmxxk+q4oq@public.gmane.org \
    --cc=greg-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org \
    --cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.