diff --git a/drivers/usb/gadget/msm72k_udc.c b/drivers/usb/gadget/msm72k_udc.c index 3bf25a01..52b4ee2b 100644 --- a/drivers/usb/gadget/msm72k_udc.c +++ b/drivers/usb/gadget/msm72k_udc.c @@ -64,6 +64,7 @@ static const char driver_name[] = "msm72k_udc"; #define SETUP_BUF_SIZE 4096 +typedef void (*completion_func)(struct usb_ep *ep, struct usb_request *req); static const char *const ep_name[] = { "ep0out", "ep1out", "ep2out", "ep3out", @@ -108,9 +109,7 @@ struct msm_request { struct usb_request req; /* saved copy of req.complete */ - void (*gadget_complete)(struct usb_ep *ep, - struct usb_request *req); - + completion_func gadget_complete; struct usb_info *ui; struct msm_request *next; @@ -654,7 +653,7 @@ static void ep0_complete(struct usb_ep *ep, struct usb_request *req) struct usb_info *ui = ept->ui; req->complete = r->gadget_complete; - r->gadget_complete = 0; + r->gadget_complete = NULL; if (req->complete) req->complete(&ui->ep0in.ep, req); } @@ -666,6 +665,12 @@ static void ep0_queue_ack_complete(struct usb_ep *ep, struct msm_endpoint *ept = to_msm_endpoint(ep); struct usb_info *ui = ept->ui; struct usb_request *req = ui->setup_req; + completion_func gadget_complete = r->gadget_complete; + + if (gadget_complete) { + r->gadget_complete = NULL; + gadget_complete(ep, req); + } /* queue up the receive of the ACK response from the host */ if (_req->status == 0 && _req->actual == _req->length) { @@ -675,7 +680,7 @@ static void ep0_queue_ack_complete(struct usb_ep *ep, else usb_ept_queue_xfer(&ui->ep0in, req); _req->complete = r->gadget_complete; - r->gadget_complete = 0; + r->gadget_complete = NULL; if (_req->complete) _req->complete(&ui->ep0in.ep, _req); } else @@ -739,7 +744,7 @@ static void ep0_setup_send(struct usb_info *ui, unsigned length) req->length = length; req->complete = ep0_queue_ack_complete; - r->gadget_complete = 0; + r->gadget_complete = NULL; usb_ept_queue_xfer(ept, req); }