mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-25 20:10:23 +09:00
UPSTREAM: usb: dwc3: gadget: Execute gadget stop after halting the controller
Do not call gadget stop until the poll for controller halt is completed. DEVTEN is cleared as part of gadget stop, so the intention to allow ep0 events to continue while waiting for controller halt is not happening. Fixes:c96683798e("usb: dwc3: ep0: Don't prepare beyond Setup stage") Cc: stable@vger.kernel.org Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com> Link: https://lore.kernel.org/r/20230420212759.29429-2-quic_wcheng@quicinc.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Bug: 318577849 Change-Id: I9c72fdd08b44a200505f8e4a91ba8c42338753ca (cherry picked from commit39674be56f) Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
This commit is contained in:
committed by
Matthias Männich
parent
0b1767af48
commit
154a4394d0
@@ -2489,7 +2489,6 @@ static int dwc3_gadget_soft_disconnect(struct dwc3 *dwc)
|
||||
* bit.
|
||||
*/
|
||||
dwc3_stop_active_transfers(dwc);
|
||||
__dwc3_gadget_stop(dwc);
|
||||
spin_unlock_irqrestore(&dwc->lock, flags);
|
||||
|
||||
/*
|
||||
@@ -2526,7 +2525,19 @@ static int dwc3_gadget_soft_disconnect(struct dwc3 *dwc)
|
||||
* remaining event generated by the controller while polling for
|
||||
* DSTS.DEVCTLHLT.
|
||||
*/
|
||||
return dwc3_gadget_run_stop(dwc, false);
|
||||
ret = dwc3_gadget_run_stop(dwc, false);
|
||||
|
||||
/*
|
||||
* Stop the gadget after controller is halted, so that if needed, the
|
||||
* events to update EP0 state can still occur while the run/stop
|
||||
* routine polls for the halted state. DEVTEN is cleared as part of
|
||||
* gadget stop.
|
||||
*/
|
||||
spin_lock_irqsave(&dwc->lock, flags);
|
||||
__dwc3_gadget_stop(dwc);
|
||||
spin_unlock_irqrestore(&dwc->lock, flags);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int dwc3_gadget_soft_connect(struct dwc3 *dwc)
|
||||
|
||||
Reference in New Issue
Block a user