Skip to content

Commit

Permalink
usb: gadget: s3c-hsotg: fix clear feature ENDPOINT_HALT
Browse files Browse the repository at this point in the history
All requests for endpoint are completed when it was halted and the halt was
cleared by CLEAR_FEATURE, but not when new state is same as previous.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Robert Baldyga authored and Felipe Balbi committed Oct 15, 2013
1 parent a18ed7b commit bd9ef7b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion drivers/usb/gadget/s3c-hsotg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1115,6 +1115,7 @@ static int s3c_hsotg_process_req_feature(struct s3c_hsotg *hsotg,
bool set = (ctrl->bRequest == USB_REQ_SET_FEATURE);
struct s3c_hsotg_ep *ep;
int ret;
bool halted;

dev_dbg(hsotg->dev, "%s: %s_FEATURE\n",
__func__, set ? "SET" : "CLEAR");
Expand All @@ -1129,6 +1130,8 @@ static int s3c_hsotg_process_req_feature(struct s3c_hsotg *hsotg,

switch (le16_to_cpu(ctrl->wValue)) {
case USB_ENDPOINT_HALT:
halted = ep->halted;

s3c_hsotg_ep_sethalt(&ep->ep, set);

ret = s3c_hsotg_send_reply(hsotg, ep0, NULL, 0);
Expand All @@ -1138,7 +1141,12 @@ static int s3c_hsotg_process_req_feature(struct s3c_hsotg *hsotg,
return ret;
}

if (!set) {
/*
* we have to complete all requests for ep if it was
* halted, and the halt was cleared by CLEAR_FEATURE
*/

if (!set && halted) {
/*
* If we have request in progress,
* then complete it
Expand Down

0 comments on commit bd9ef7b

Please sign in to comment.