Skip to content

Commit

Permalink
usb: dwc2: gadget: prevent new request submission during suspend
Browse files Browse the repository at this point in the history
If usb controller is in partial power down, any write to registers may
cause unpredictable behavior.
Thus, prevent any new request submission once controller is in partial
power down.

Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Gregory Herrero <gregory.herrero@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Gregory Herrero authored and Felipe Balbi committed Apr 29, 2015
1 parent 9e77977 commit 7ababa9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/usb/dwc2/gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,13 @@ static int s3c_hsotg_ep_queue(struct usb_ep *ep, struct usb_request *req,
ep->name, req, req->length, req->buf, req->no_interrupt,
req->zero, req->short_not_ok);

/* Prevent new request submission when controller is suspended */
if (hs->lx_state == DWC2_L2) {
dev_dbg(hs->dev, "%s: don't submit request while suspended\n",
__func__);
return -EAGAIN;
}

/* initialise status of the request */
INIT_LIST_HEAD(&hs_req->queue);
req->actual = 0;
Expand Down

0 comments on commit 7ababa9

Please sign in to comment.