Commit 76cd9cfb authored by Pavankumar Kondeti's avatar Pavankumar Kondeti Committed by Greg Kroah-Hartman

USB: gadget: Use ep0out for control OUT data phase in ci13xxx_udc

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: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 4c5212b7
...@@ -1843,6 +1843,7 @@ __releases(mEp->lock) ...@@ -1843,6 +1843,7 @@ __releases(mEp->lock)
__acquires(mEp->lock) __acquires(mEp->lock)
{ {
struct ci13xxx_req *mReq, *mReqTemp; struct ci13xxx_req *mReq, *mReqTemp;
struct ci13xxx_ep *mEpTemp = mEp;
int uninitialized_var(retval); int uninitialized_var(retval);
trace("%p", mEp); trace("%p", mEp);
...@@ -1859,7 +1860,10 @@ __acquires(mEp->lock) ...@@ -1859,7 +1860,10 @@ __acquires(mEp->lock)
dbg_done(_usb_addr(mEp), mReq->ptr->token, retval); dbg_done(_usb_addr(mEp), mReq->ptr->token, retval);
if (mReq->req.complete != NULL) { if (mReq->req.complete != NULL) {
spin_unlock(mEp->lock); 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); spin_lock(mEp->lock);
} }
} }
...@@ -2248,12 +2252,16 @@ static int ep_queue(struct usb_ep *ep, struct usb_request *req, ...@@ -2248,12 +2252,16 @@ static int ep_queue(struct usb_ep *ep, struct usb_request *req,
spin_lock_irqsave(mEp->lock, flags); spin_lock_irqsave(mEp->lock, flags);
if (mEp->type == USB_ENDPOINT_XFER_CONTROL && if (mEp->type == USB_ENDPOINT_XFER_CONTROL) {
!list_empty(&mEp->qh.queue)) { if (req->length)
mEp = (_udc->ep0_dir == RX) ?
&_udc->ep0out : &_udc->ep0in;
if (!list_empty(&mEp->qh.queue)) {
_ep_nuke(mEp); _ep_nuke(mEp);
retval = -EOVERFLOW; retval = -EOVERFLOW;
warn("endpoint ctrl %X nuked", _usb_addr(mEp)); warn("endpoint ctrl %X nuked", _usb_addr(mEp));
} }
}
/* first nuke then test link, e.g. previous status has not sent */ /* first nuke then test link, e.g. previous status has not sent */
if (!list_empty(&mReq->queue)) { if (!list_empty(&mReq->queue)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment