diff options
author | Gregory Herrero <gregory.herrero@intel.com> | 2015-01-30 03:09:27 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2015-01-30 11:30:29 -0500 |
commit | c00dd4a6ec20a58ed38be85f8e47efda40625f17 (patch) | |
tree | d387b6bc306e1f96b364e016b3c494c55353ce48 | |
parent | b46146d59fdac6a6f559d5e6618f128abf0c2912 (diff) |
usb: dwc2: gadget: fix clear halt feature handling
When clearing HALT on an endpoint, req->complete of in progress
requests must be called with locks off. New request should only be
started if there is not already a pending request on the endpoint.
Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Gregory Herrero <gregory.herrero@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r-- | drivers/usb/dwc2/gadget.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 50ae09648cc1..02d0e9af9242 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c | |||
@@ -1007,16 +1007,22 @@ static int s3c_hsotg_process_req_feature(struct dwc2_hsotg *hsotg, | |||
1007 | hs_req = ep->req; | 1007 | hs_req = ep->req; |
1008 | ep->req = NULL; | 1008 | ep->req = NULL; |
1009 | list_del_init(&hs_req->queue); | 1009 | list_del_init(&hs_req->queue); |
1010 | usb_gadget_giveback_request(&ep->ep, | 1010 | if (hs_req->req.complete) { |
1011 | &hs_req->req); | 1011 | spin_unlock(&hsotg->lock); |
1012 | usb_gadget_giveback_request( | ||
1013 | &ep->ep, &hs_req->req); | ||
1014 | spin_lock(&hsotg->lock); | ||
1015 | } | ||
1012 | } | 1016 | } |
1013 | 1017 | ||
1014 | /* If we have pending request, then start it */ | 1018 | /* If we have pending request, then start it */ |
1015 | restart = !list_empty(&ep->queue); | 1019 | if (!ep->req) { |
1016 | if (restart) { | 1020 | restart = !list_empty(&ep->queue); |
1017 | hs_req = get_ep_head(ep); | 1021 | if (restart) { |
1018 | s3c_hsotg_start_req(hsotg, ep, | 1022 | hs_req = get_ep_head(ep); |
1019 | hs_req, false); | 1023 | s3c_hsotg_start_req(hsotg, ep, |
1024 | hs_req, false); | ||
1025 | } | ||
1020 | } | 1026 | } |
1021 | } | 1027 | } |
1022 | 1028 | ||