This patch updates the "busy" field to reflect the current status of the
endpoint.  This fix is critical to enable the request queuing logic to prevent
a queued request from overwriting/interfering in-flight request.

Signed-off-by: Swaminathan S <[EMAIL PROTECTED]>
---
 drivers/usb/musb/musb_gadget.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 491a3e7..38daf66 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -106,7 +106,6 @@ __acquires(ep->musb->lock)
 {
        struct musb_request     *req;
        struct musb             *musb;
-       int                     busy = ep->busy;
 
        req = to_musb_request(request);
 
@@ -115,7 +114,6 @@ __acquires(ep->musb->lock)
                req->request.status = status;
        musb = req->musb;
 
-       ep->busy = 1;
        spin_unlock(&musb->lock);
        if (is_dma_capable()) {
                if (req->mapped) {
@@ -146,7 +144,7 @@ __acquires(ep->musb->lock)
                                request->status);
        req->request.complete(&req->ep->end_point, &req->request);
        spin_lock(&musb->lock);
-       ep->busy = busy;
+       ep->busy = 0;
 }
 
 /* ----------------------------------------------------------------------- */
@@ -187,7 +185,10 @@ static void nuke(struct musb_ep *ep, const int status)
                req = container_of(ep->req_list.next, struct musb_request,
                                request.list);
                musb_g_giveback(ep, &req->request, status);
+               ep->busy = 1;
        }
+
+       ep->busy = 0;
 }
 
 /* ----------------------------------------------------------------------- */
@@ -288,6 +289,8 @@ static void txstate(struct musb *musb, struct musb_request 
*req)
        DBG(4, "hw_ep%d, maxpacket %d, fifo count %d, txcsr %03x\n",
                        epnum, musb_ep->packet_sz, fifo_count,
                        csr);
+       
+       musb_ep->busy = 1;
 
 #ifndef        CONFIG_MUSB_PIO_ONLY
        if (is_dma_capable() && musb_ep->dma) {
@@ -580,6 +583,8 @@ static void rxstate(struct musb *musb, struct musb_request 
*req)
 
        csr = musb_readw(epio, MUSB_RXCSR);
 
+       musb_ep->busy = 1;
+
        if (is_cppi_enabled() && musb_ep->dma) {
                struct dma_controller   *c = musb->dma_controller;
                struct dma_channel      *channel = musb_ep->dma;
-- 
1.6.0.rc1.64.g61192

_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to