diff options
author | Michal Sojka <sojka@merica.cz> | 2014-09-24 22:43:19 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-09-25 16:58:50 +0200 |
commit | 304f7e5e1d08fa2f5674c1323bd0ebd806c86b81 (patch) | |
tree | 0d69327f14a23a66061fc9d39dee1ec7c6b56932 /drivers/usb | |
parent | 3fc2aa5522ab958374d93ef5d2e12df7ee233c91 (diff) | |
download | op-kernel-dev-304f7e5e1d08fa2f5674c1323bd0ebd806c86b81.zip op-kernel-dev-304f7e5e1d08fa2f5674c1323bd0ebd806c86b81.tar.gz |
usb: gadget: Refactor request completion
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>
Diffstat (limited to 'drivers/usb')
29 files changed, 41 insertions, 56 deletions
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index b8125aa..0444d3f 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -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); } diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 94f7a3f..7b5856f 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -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); } diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 0fcc0a3..3818b26 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -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); } diff --git a/drivers/usb/gadget/udc/amd5536udc.c b/drivers/usb/gadget/udc/amd5536udc.c index 41b062e..3b9d138 100644 --- a/drivers/usb/gadget/udc/amd5536udc.c +++ b/drivers/usb/gadget/udc/amd5536udc.c @@ -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; } diff --git a/drivers/usb/gadget/udc/at91_udc.c b/drivers/usb/gadget/udc/at91_udc.c index cfd18bc..9968f53 100644 --- a/drivers/usb/gadget/udc/at91_udc.c +++ b/drivers/usb/gadget/udc/at91_udc.c @@ -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; diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c index c9fe67e..1529926 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.c +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c @@ -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); } diff --git a/drivers/usb/gadget/udc/bcm63xx_udc.c b/drivers/usb/gadget/udc/bcm63xx_udc.c index e969eb8..2235b88 100644 --- a/drivers/usb/gadget/udc/bcm63xx_udc.c +++ b/drivers/usb/gadget/udc/bcm63xx_udc.c @@ -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); } } diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c index 2b54955..81dc595 100644 --- a/drivers/usb/gadget/udc/dummy_hcd.c +++ b/drivers/usb/gadget/udc/dummy_hcd.c @@ -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; diff --git a/drivers/usb/gadget/udc/fotg210-udc.c b/drivers/usb/gadget/udc/fotg210-udc.c index e143d69..1d31592 100644 --- a/drivers/usb/gadget/udc/fotg210-udc.c +++ b/drivers/usb/gadget/udc/fotg210-udc.c @@ -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) { diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c b/drivers/usb/gadget/udc/fsl_qe_udc.c index 7324308..dd18ea3 100644 --- a/drivers/usb/gadget/udc/fsl_qe_udc.c +++ b/drivers/usb/gadget/udc/fsl_qe_udc.c @@ -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"); - diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c index 75b23ea..c362079 100644 --- a/drivers/usb/gadget/udc/fsl_udc_core.c +++ b/drivers/usb/gadget/udc/fsl_udc_core.c @@ -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; diff --git a/drivers/usb/gadget/udc/fusb300_udc.c b/drivers/usb/gadget/udc/fusb300_udc.c index 5c5d1ad..8286df7 100644 --- a/drivers/usb/gadget/udc/fusb300_udc.c +++ b/drivers/usb/gadget/udc/fusb300_udc.c @@ -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) { diff --git a/drivers/usb/gadget/udc/goku_udc.c b/drivers/usb/gadget/udc/goku_udc.c index 6c85839..bf9c5ef 100644 --- a/drivers/usb/gadget/udc/goku_udc.c +++ b/drivers/usb/gadget/udc/goku_udc.c @@ -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; } diff --git a/drivers/usb/gadget/udc/gr_udc.c b/drivers/usb/gadget/udc/gr_udc.c index ecd10b5..1b3048a 100644 --- a/drivers/usb/gadget/udc/gr_udc.c +++ b/drivers/usb/gadget/udc/gr_udc.c @@ -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); } diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c b/drivers/usb/gadget/udc/lpc32xx_udc.c index 1629ad7..feab0ba 100644 --- a/drivers/usb/gadget/udc/lpc32xx_udc.c +++ b/drivers/usb/gadget/udc/lpc32xx_udc.c @@ -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); } diff --git a/drivers/usb/gadget/udc/m66592-udc.c b/drivers/usb/gadget/udc/m66592-udc.c index de88d33..8985656 100644 --- a/drivers/usb/gadget/udc/m66592-udc.c +++ b/drivers/usb/gadget/udc/m66592-udc.c @@ -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) { diff --git a/drivers/usb/gadget/udc/mv_u3d_core.c b/drivers/usb/gadget/udc/mv_u3d_core.c index 1624871..046a1f8 100644 --- a/drivers/usb/gadget/udc/mv_u3d_core.c +++ b/drivers/usb/gadget/udc/mv_u3d_core.c @@ -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); } diff --git a/drivers/usb/gadget/udc/mv_udc_core.c b/drivers/usb/gadget/udc/mv_udc_core.c index 040fb16..3c5db80 100644 --- a/drivers/usb/gadget/udc/mv_udc_core.c +++ b/drivers/usb/gadget/udc/mv_udc_core.c @@ -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; diff --git a/drivers/usb/gadget/udc/net2272.c b/drivers/usb/gadget/udc/net2272.c index 059cfe5..84d7162 100644 --- a/drivers/usb/gadget/udc/net2272.c +++ b/drivers/usb/gadget/udc/net2272.c @@ -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; } diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c index 2e95715..8d13337 100644 --- a/drivers/usb/gadget/udc/net2280.c +++ b/drivers/usb/gadget/udc/net2280.c @@ -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; } diff --git a/drivers/usb/gadget/udc/omap_udc.c b/drivers/usb/gadget/udc/omap_udc.c index e731373..dcdfea4 100644 --- a/drivers/usb/gadget/udc/omap_udc.c +++ b/drivers/usb/gadget/udc/omap_udc.c @@ -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; } diff --git a/drivers/usb/gadget/udc/pch_udc.c b/drivers/usb/gadget/udc/pch_udc.c index 460d953..ccbe3d4 100644 --- a/drivers/usb/gadget/udc/pch_udc.c +++ b/drivers/usb/gadget/udc/pch_udc.c @@ -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; } diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c b/drivers/usb/gadget/udc/pxa25x_udc.c index 251e4d5..42f7eeb 100644 --- a/drivers/usb/gadget/udc/pxa25x_udc.c +++ b/drivers/usb/gadget/udc/pxa25x_udc.c @@ -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; } diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c index 597d39f89..4868369 100644 --- a/drivers/usb/gadget/udc/pxa27x_udc.c +++ b/drivers/usb/gadget/udc/pxa27x_udc.c @@ -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); diff --git a/drivers/usb/gadget/udc/r8a66597-udc.c b/drivers/usb/gadget/udc/r8a66597-udc.c index de9c400..f818661 100644 --- a/drivers/usb/gadget/udc/r8a66597-udc.c +++ b/drivers/usb/gadget/udc/r8a66597-udc.c @@ -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) { diff --git a/drivers/usb/gadget/udc/s3c-hsudc.c b/drivers/usb/gadget/udc/s3c-hsudc.c index 10c6a12..dfbf557 100644 --- a/drivers/usb/gadget/udc/s3c-hsudc.c +++ b/drivers/usb/gadget/udc/s3c-hsudc.c @@ -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; } diff --git a/drivers/usb/gadget/udc/s3c2410_udc.c b/drivers/usb/gadget/udc/s3c2410_udc.c index 357b58e..ff423d1 100644 --- a/drivers/usb/gadget/udc/s3c2410_udc.c +++ b/drivers/usb/gadget/udc/s3c2410_udc.c @@ -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; } diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index d4aa779..24c8c02 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -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; } diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index 04e6505..2d17c10 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c @@ -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) |