FROMLIST: usb: dwc3: gadget: Avoid duplicate requests to enable Run/Stop

Relocate the pullups_connected check until after it is ensured that there
are no runtime PM transitions.  If another context triggered the DWC3
core's runtime resume, it may have already enabled the Run/Stop.  Do not
re-run the entire pullup sequence again, as it may issue a core soft
reset while Run/Stop is already set.

Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>

Bug: 240122498
Link: https://lore.kernel.org/linux-usb/20220728020647.9377-1-quic_wcheng@quicinc.com/
Change-Id: I8b819b4773420fbca3bd7a284d715401dcdd00c3
Signed-off-by: Mayank Rana <quic_mrana@quicinc.com>
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
This commit is contained in:
Wesley Cheng
2022-08-12 11:19:56 -07:00
committed by Todd Kjos
parent d4d10fb574
commit 4f5025129f

View File

@@ -2505,6 +2505,11 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on)
return 0;
}
if (dwc->pullups_connected == is_on) {
pm_runtime_put(dwc->dev);
return 0;
}
/*
* Synchronize and disable any further event handling while controller
* is being enabled/disabled.