]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
usb: gadget: Refactor request completion
authorMichal Sojka <sojka@merica.cz>
Wed, 24 Sep 2014 20:43:19 +0000 (22:43 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Sep 2014 14:58:50 +0000 (16:58 +0200)
Use the recently introduced usb_gadget_giveback_request() in favor of
direct invocation of the completion routine.

All places in drivers/usb/ matching "[-.]complete(" were replaced with a
call to usb_gadget_giveback_request(). This was compile-tested with all
ARM drivers enabled and runtime-tested for musb.

Signed-off-by: Michal Sojka <sojka@merica.cz>
Acked-by: Felipe Balbi <balbi@ti.com>
Tested-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
29 files changed:
drivers/usb/chipidea/udc.c
drivers/usb/dwc2/gadget.c
drivers/usb/dwc3/gadget.c
drivers/usb/gadget/udc/amd5536udc.c
drivers/usb/gadget/udc/at91_udc.c
drivers/usb/gadget/udc/atmel_usba_udc.c
drivers/usb/gadget/udc/bcm63xx_udc.c
drivers/usb/gadget/udc/dummy_hcd.c
drivers/usb/gadget/udc/fotg210-udc.c
drivers/usb/gadget/udc/fsl_qe_udc.c
drivers/usb/gadget/udc/fsl_udc_core.c
drivers/usb/gadget/udc/fusb300_udc.c
drivers/usb/gadget/udc/goku_udc.c
drivers/usb/gadget/udc/gr_udc.c
drivers/usb/gadget/udc/lpc32xx_udc.c
drivers/usb/gadget/udc/m66592-udc.c
drivers/usb/gadget/udc/mv_u3d_core.c
drivers/usb/gadget/udc/mv_udc_core.c
drivers/usb/gadget/udc/net2272.c
drivers/usb/gadget/udc/net2280.c
drivers/usb/gadget/udc/omap_udc.c
drivers/usb/gadget/udc/pch_udc.c
drivers/usb/gadget/udc/pxa25x_udc.c
drivers/usb/gadget/udc/pxa27x_udc.c
drivers/usb/gadget/udc/r8a66597-udc.c
drivers/usb/gadget/udc/s3c-hsudc.c
drivers/usb/gadget/udc/s3c2410_udc.c
drivers/usb/musb/musb_gadget.c
drivers/usb/renesas_usbhs/mod_gadget.c

index b8125aa64ad8c74f2f3d12fb264eeacb80517603..0444d3f8971a855bda0aca672330d5b63f7d9534 100644 (file)
@@ -627,7 +627,7 @@ __acquires(hwep->lock)
 
                if (hwreq->req.complete != NULL) {
                        spin_unlock(hwep->lock);
-                       hwreq->req.complete(&hwep->ep, &hwreq->req);
+                       usb_gadget_giveback_request(&hwep->ep, &hwreq->req);
                        spin_lock(hwep->lock);
                }
        }
@@ -922,7 +922,7 @@ __acquires(hwep->lock)
                        if ((hwep->type == USB_ENDPOINT_XFER_CONTROL) &&
                                        hwreq->req.length)
                                hweptemp = hwep->ci->ep0in;
-                       hwreq->req.complete(&hweptemp->ep, &hwreq->req);
+                       usb_gadget_giveback_request(&hweptemp->ep, &hwreq->req);
                        spin_lock(hwep->lock);
                }
        }
@@ -1347,7 +1347,7 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req)
 
        if (hwreq->req.complete != NULL) {
                spin_unlock(hwep->lock);
-               hwreq->req.complete(&hwep->ep, &hwreq->req);
+               usb_gadget_giveback_request(&hwep->ep, &hwreq->req);
                spin_lock(hwep->lock);
        }
 
index 94f7a3ffebd5d3065f871e081b80560d40473a05..7b5856fadd93f350ddaaeb2dda9e63be534987e6 100644 (file)
@@ -1004,8 +1004,8 @@ static int s3c_hsotg_process_req_feature(struct s3c_hsotg *hsotg,
                                        hs_req = ep->req;
                                        ep->req = NULL;
                                        list_del_init(&hs_req->queue);
-                                       hs_req->req.complete(&ep->ep,
-                                                            &hs_req->req);
+                                       usb_gadget_giveback_request(&ep->ep,
+                                                                   &hs_req->req);
                                }
 
                                /* If we have pending request, then start it */
@@ -1262,7 +1262,7 @@ static void s3c_hsotg_complete_request(struct s3c_hsotg *hsotg,
 
        if (hs_req->req.complete) {
                spin_unlock(&hsotg->lock);
-               hs_req->req.complete(&hs_ep->ep, &hs_req->req);
+               usb_gadget_giveback_request(&hs_ep->ep, &hs_req->req);
                spin_lock(&hsotg->lock);
        }
 
index 0fcc0a35ae05fdc7df2f3c73422231c3ae8fa9ca..3818b26bfc05abf744f50bcc6266d49b0e83dfb3 100644 (file)
@@ -270,7 +270,7 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req,
        trace_dwc3_gadget_giveback(req);
 
        spin_unlock(&dwc->lock);
-       req->request.complete(&dep->endpoint, &req->request);
+       usb_gadget_giveback_request(&dep->endpoint, &req->request);
        spin_lock(&dwc->lock);
 }
 
index 41b062eb4de075077d01d9ee9a293e10906cdefd..3b9d13848a4f2ad9d5e5b15c7c98aad86eaa9b84 100644 (file)
@@ -841,7 +841,7 @@ __acquires(ep->dev->lock)
                &req->req, req->req.length, ep->ep.name, sts);
 
        spin_unlock(&dev->lock);
-       req->req.complete(&ep->ep, &req->req);
+       usb_gadget_giveback_request(&ep->ep, &req->req);
        spin_lock(&dev->lock);
        ep->halted = halted;
 }
index cfd18bcca723ef700d727fa1f8f8a39405eba13f..9968f5331fe4988fbb282febbe9b2071e2533388 100644 (file)
@@ -267,7 +267,7 @@ static void done(struct at91_ep *ep, struct at91_request *req, int status)
 
        ep->stopped = 1;
        spin_unlock(&udc->lock);
-       req->req.complete(&ep->ep, &req->req);
+       usb_gadget_giveback_request(&ep->ep, &req->req);
        spin_lock(&udc->lock);
        ep->stopped = stopped;
 
index c9fe67e29d35fcbe420b04a79f6797d531b852e9..1529926e20a08d5b7e5c1a567f06f4c7b9f3bb82 100644 (file)
@@ -463,7 +463,7 @@ static void receive_data(struct usba_ep *ep)
                        list_del_init(&req->queue);
                        usba_ep_writel(ep, CTL_DIS, USBA_RX_BK_RDY);
                        spin_unlock(&udc->lock);
-                       req->req.complete(&ep->ep, &req->req);
+                       usb_gadget_giveback_request(&ep->ep, &req->req);
                        spin_lock(&udc->lock);
                }
 
@@ -495,7 +495,7 @@ request_complete(struct usba_ep *ep, struct usba_request *req, int status)
                ep->ep.name, req, req->req.status, req->req.actual);
 
        spin_unlock(&udc->lock);
-       req->req.complete(&ep->ep, &req->req);
+       usb_gadget_giveback_request(&ep->ep, &req->req);
        spin_lock(&udc->lock);
 }
 
index e969eb809a853dbb38093a0f5d3d39f57f931bb7..2235b8808700be3ac5f0c5821b95fe213642e7db 100644 (file)
@@ -1088,7 +1088,7 @@ static int bcm63xx_ep_disable(struct usb_ep *ep)
                        breq->req.status = -ESHUTDOWN;
 
                        spin_unlock_irqrestore(&udc->lock, flags);
-                       breq->req.complete(&iudma->bep->ep, &breq->req);
+                       usb_gadget_giveback_request(&iudma->bep->ep, &breq->req);
                        spin_lock_irqsave(&udc->lock, flags);
                }
        }
index 2b54955d3166007b74a64f419cc34f8b76d440c3..81dc5959e36b9baa82e30d37374d67779e123a7c 100644 (file)
@@ -258,7 +258,7 @@ static void nuke(struct dummy *dum, struct dummy_ep *ep)
                req->req.status = -ESHUTDOWN;
 
                spin_unlock(&dum->lock);
-               req->req.complete(&ep->ep, &req->req);
+               usb_gadget_giveback_request(&ep->ep, &req->req);
                spin_lock(&dum->lock);
        }
 }
@@ -658,7 +658,7 @@ static int dummy_queue(struct usb_ep *_ep, struct usb_request *_req,
                spin_unlock(&dum->lock);
                _req->actual = _req->length;
                _req->status = 0;
-               _req->complete(_ep, _req);
+               usb_gadget_giveback_request(_ep, _req);
                spin_lock(&dum->lock);
        }  else
                list_add_tail(&req->queue, &ep->queue);
@@ -702,7 +702,7 @@ static int dummy_dequeue(struct usb_ep *_ep, struct usb_request *_req)
                dev_dbg(udc_dev(dum),
                                "dequeued req %p from %s, len %d buf %p\n",
                                req, _ep->name, _req->length, _req->buf);
-               _req->complete(_ep, _req);
+               usb_gadget_giveback_request(_ep, _req);
        }
        local_irq_restore(flags);
        return retval;
@@ -1385,7 +1385,7 @@ top:
                        list_del_init(&req->queue);
 
                        spin_unlock(&dum->lock);
-                       req->req.complete(&ep->ep, &req->req);
+                       usb_gadget_giveback_request(&ep->ep, &req->req);
                        spin_lock(&dum->lock);
 
                        /* requests might have been unlinked... */
@@ -1761,7 +1761,7 @@ restart:
                                                req);
 
                                spin_unlock(&dum->lock);
-                               req->req.complete(&ep->ep, &req->req);
+                               usb_gadget_giveback_request(&ep->ep, &req->req);
                                spin_lock(&dum->lock);
                                ep->already_seen = 0;
                                goto restart;
index e143d69f601798f1e94ac1a39cdac71744e5fe6f..1d315921bf34dbc61c6701bacd315edcc630259f 100644 (file)
@@ -70,7 +70,7 @@ static void fotg210_done(struct fotg210_ep *ep, struct fotg210_request *req,
                req->req.status = status;
 
        spin_unlock(&ep->fotg210->lock);
-       req->req.complete(&ep->ep, &req->req);
+       usb_gadget_giveback_request(&ep->ep, &req->req);
        spin_lock(&ep->fotg210->lock);
 
        if (ep->epnum) {
index 7324308048418835447029da4f0939eeed1eab2c..dd18ea38e3917f272cdf3726b547a531ad208a09 100644 (file)
@@ -118,10 +118,7 @@ static void done(struct qe_ep *ep, struct qe_req *req, int status)
        ep->stopped = 1;
        spin_unlock(&udc->lock);
 
-       /* this complete() should a func implemented by gadget layer,
-        * eg fsg->bulk_in_complete() */
-       if (req->req.complete)
-               req->req.complete(&ep->ep, &req->req);
+       usb_gadget_giveback_request(&ep->ep, &req->req);
 
        spin_lock(&udc->lock);
 
@@ -2728,4 +2725,3 @@ module_platform_driver(udc_driver);
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_LICENSE("GPL");
-
index 75b23ea077a7c7ccff21f703dc99d70fcc08343c..c3620791a315ee77881c9eff81b705c410854111 100644 (file)
@@ -197,10 +197,8 @@ __acquires(ep->udc->lock)
        ep->stopped = 1;
 
        spin_unlock(&ep->udc->lock);
-       /* complete() is from gadget layer,
-        * eg fsg->bulk_in_complete() */
-       if (req->req.complete)
-               req->req.complete(&ep->ep, &req->req);
+
+       usb_gadget_giveback_request(&ep->ep, &req->req);
 
        spin_lock(&ep->udc->lock);
        ep->stopped = stopped;
index 5c5d1adda7eb23c1a57e4ee8ea5d8696c361ebbb..8286df72add425a669d1e921939e099727d37779 100644 (file)
@@ -876,7 +876,7 @@ static void done(struct fusb300_ep *ep, struct fusb300_request *req,
                req->req.status = status;
 
        spin_unlock(&ep->fusb300->lock);
-       req->req.complete(&ep->ep, &req->req);
+       usb_gadget_giveback_request(&ep->ep, &req->req);
        spin_lock(&ep->fusb300->lock);
 
        if (ep->epnum) {
index 6c85839e15adb8936c80cc8a449cca9981a166ba..bf9c5ef8b56b37aabb08854b34558f355af072dd 100644 (file)
@@ -320,7 +320,7 @@ done(struct goku_ep *ep, struct goku_request *req, int status)
        /* don't modify queue heads during completion callback */
        ep->stopped = 1;
        spin_unlock(&dev->lock);
-       req->req.complete(&ep->ep, &req->req);
+       usb_gadget_giveback_request(&ep->ep, &req->req);
        spin_lock(&dev->lock);
        ep->stopped = stopped;
 }
index ecd10b574bfd64b51f27616ac3bf61eae3220fc5..1b3048a6a2a3464ad1c7ad9898bc67507717a8b8 100644 (file)
@@ -357,7 +357,7 @@ static void gr_finish_request(struct gr_ep *ep, struct gr_request *req,
        } else if (req->req.complete) {
                spin_unlock(&dev->lock);
 
-               req->req.complete(&ep->ep, &req->req);
+               usb_gadget_giveback_request(&ep->ep, &req->req);
 
                spin_lock(&dev->lock);
        }
index 1629ad7dcb8086c75ef77f3d88747b931f505064..feab0bac8fdc34b409f395339337f7a93f90c30e 100644 (file)
@@ -1479,7 +1479,7 @@ static void done(struct lpc32xx_ep *ep, struct lpc32xx_request *req, int status)
 
        ep->req_pending = 0;
        spin_unlock(&udc->lock);
-       req->req.complete(&ep->ep, &req->req);
+       usb_gadget_giveback_request(&ep->ep, &req->req);
        spin_lock(&udc->lock);
 }
 
index de88d33b44b2897fea87b053b8709050c41adf1f..898565687a8cb6af2806f8772cd78eada513bc41 100644 (file)
@@ -729,7 +729,7 @@ __acquires(m66592->lock)
                restart = 1;
 
        spin_unlock(&ep->m66592->lock);
-       req->req.complete(&ep->ep, &req->req);
+       usb_gadget_giveback_request(&ep->ep, &req->req);
        spin_lock(&ep->m66592->lock);
 
        if (restart) {
index 16248711c152d86386131e91783b30691766b743..046a1f808b0d34d3726ac1dcde63683e7c30745d 100644 (file)
@@ -222,12 +222,8 @@ void mv_u3d_done(struct mv_u3d_ep *ep, struct mv_u3d_req *req, int status)
        }
 
        spin_unlock(&ep->u3d->lock);
-       /*
-        * complete() is from gadget layer,
-        * eg fsg->bulk_in_complete()
-        */
-       if (req->req.complete)
-               req->req.complete(&ep->ep, &req->req);
+
+       usb_gadget_giveback_request(&ep->ep, &req->req);
 
        spin_lock(&ep->u3d->lock);
 }
index 040fb169b162a1e381180bc92ab408bc9268170f..3c5db80ae325a15766810ed7891bf0456c9441a6 100644 (file)
@@ -248,12 +248,8 @@ static void done(struct mv_ep *ep, struct mv_req *req, int status)
        ep->stopped = 1;
 
        spin_unlock(&ep->udc->lock);
-       /*
-        * complete() is from gadget layer,
-        * eg fsg->bulk_in_complete()
-        */
-       if (req->req.complete)
-               req->req.complete(&ep->ep, &req->req);
+
+       usb_gadget_giveback_request(&ep->ep, &req->req);
 
        spin_lock(&ep->udc->lock);
        ep->stopped = stopped;
index 059cfe527982fbad2912cfdb61733560ba4ac589..84d7162a8022332b4edca2cbbed4e68b2da4d914 100644 (file)
@@ -394,7 +394,7 @@ net2272_done(struct net2272_ep *ep, struct net2272_request *req, int status)
        /* don't modify queue heads during completion callback */
        ep->stopped = 1;
        spin_unlock(&dev->lock);
-       req->req.complete(&ep->ep, &req->req);
+       usb_gadget_giveback_request(&ep->ep, &req->req);
        spin_lock(&dev->lock);
        ep->stopped = stopped;
 }
index 2e95715b50c0967f02550dbe11e88c159dbd5b5c..8d13337e2dde050fa3bcbc489f32b831c899c94a 100644 (file)
@@ -928,7 +928,7 @@ done(struct net2280_ep *ep, struct net2280_request *req, int status)
        /* don't modify queue heads during completion callback */
        ep->stopped = 1;
        spin_unlock(&dev->lock);
-       req->req.complete(&ep->ep, &req->req);
+       usb_gadget_giveback_request(&ep->ep, &req->req);
        spin_lock(&dev->lock);
        ep->stopped = stopped;
 }
index e731373fd4d713e1b8ad597a3f62081ede483bf3..dcdfea46003ba747bb6bd006b242e7f42c5dbb95 100644 (file)
@@ -315,7 +315,7 @@ done(struct omap_ep *ep, struct omap_req *req, int status)
        /* don't modify queue heads during completion callback */
        ep->stopped = 1;
        spin_unlock(&ep->udc->lock);
-       req->req.complete(&ep->ep, &req->req);
+       usb_gadget_giveback_request(&ep->ep, &req->req);
        spin_lock(&ep->udc->lock);
        ep->stopped = stopped;
 }
index 460d953c91b6c9b540d2af185b3f2664ea39613b..ccbe3d4a2a504f9c3deabeee9e424f6b26b98ef0 100644 (file)
@@ -1490,7 +1490,7 @@ static void complete_req(struct pch_udc_ep *ep, struct pch_udc_request *req,
        spin_unlock(&dev->lock);
        if (!ep->in)
                pch_udc_ep_clear_rrdy(ep);
-       req->req.complete(&ep->ep, &req->req);
+       usb_gadget_giveback_request(&ep->ep, &req->req);
        spin_lock(&dev->lock);
        ep->halted = halted;
 }
index 251e4d5ee152b950cdd06e6a9a875526942ddcf2..42f7eeb8ff6f919395a29574f26549f4e437550a 100644 (file)
@@ -347,7 +347,7 @@ static void done(struct pxa25x_ep *ep, struct pxa25x_request *req, int status)
 
        /* don't modify queue heads during completion callback */
        ep->stopped = 1;
-       req->req.complete(&ep->ep, &req->req);
+       usb_gadget_giveback_request(&ep->ep, &req->req);
        ep->stopped = stopped;
 }
 
index 597d39f89420e3b4eb6c7b629a01f31ce52ffe5d..4868369eeec662140637e121664cb1dacc9a4092 100644 (file)
@@ -758,7 +758,7 @@ static void req_done(struct pxa_ep *ep, struct pxa27x_request *req, int status,
        if (pflags)
                spin_unlock_irqrestore(&ep->lock, *pflags);
        local_irq_save(flags);
-       req->req.complete(&req->udc_usb_ep->usb_ep, &req->req);
+       usb_gadget_giveback_request(&req->udc_usb_ep->usb_ep, &req->req);
        local_irq_restore(flags);
        if (pflags)
                spin_lock_irqsave(&ep->lock, *pflags);
index de9c400b9944a6de45ea3d6223efa0d848e86847..f8186613b53efcee5183d14588366d8886c2ea0b 100644 (file)
@@ -925,7 +925,7 @@ __acquires(r8a66597->lock)
                sudmac_free_channel(ep->r8a66597, ep, req);
 
        spin_unlock(&ep->r8a66597->lock);
-       req->req.complete(&ep->ep, &req->req);
+       usb_gadget_giveback_request(&ep->ep, &req->req);
        spin_lock(&ep->r8a66597->lock);
 
        if (restart) {
index 10c6a128250c6cd249bb56b35655ec946820dc32..dfbf55797360ad0ba1bd02e5ece0dc2d08ae939c 100644 (file)
@@ -258,8 +258,7 @@ static void s3c_hsudc_complete_request(struct s3c_hsudc_ep *hsep,
 
        hsep->stopped = 1;
        spin_unlock(&hsudc->lock);
-       if (hsreq->req.complete != NULL)
-               hsreq->req.complete(&hsep->ep, &hsreq->req);
+       usb_gadget_giveback_request(&hsep->ep, &hsreq->req);
        spin_lock(&hsudc->lock);
        hsep->stopped = stopped;
 }
index 357b58e0087bb285bc6a2bd69f2ca0baaff6068c..ff423d15beffab09cbd7ceaeccce00cf2fa2dc58 100644 (file)
@@ -272,7 +272,7 @@ static void s3c2410_udc_done(struct s3c2410_ep *ep,
                status = req->req.status;
 
        ep->halted = 1;
-       req->req.complete(&ep->ep, &req->req);
+       usb_gadget_giveback_request(&ep->ep, &req->req);
        ep->halted = halted;
 }
 
index d4aa779339f1c8ed9af9573d1eb92f80ee22f3c0..24c8c02197905b0da8638d3f3d09184940c61998 100644 (file)
@@ -176,7 +176,7 @@ __acquires(ep->musb->lock)
                                ep->end_point.name, request,
                                req->request.actual, req->request.length,
                                request->status);
-       req->request.complete(&req->ep->end_point, &req->request);
+       usb_gadget_giveback_request(&req->ep->end_point, &req->request);
        spin_lock(&musb->lock);
        ep->busy = busy;
 }
index 04e6505777d084ba4c815b47f0a4b09f3b53c649..2d17c10a0428684e9ffc07479d069ebe00ee9428 100644 (file)
@@ -129,7 +129,7 @@ static void usbhsg_queue_pop(struct usbhsg_uep *uep,
        dev_dbg(dev, "pipe %d : queue pop\n", usbhs_pipe_number(pipe));
 
        ureq->req.status = status;
-       ureq->req.complete(&uep->ep, &ureq->req);
+       usb_gadget_giveback_request(&uep->ep, &ureq->req);
 }
 
 static void usbhsg_queue_done(struct usbhs_priv *priv, struct usbhs_pkt *pkt)