Skip to content

Commit 040f2db

Browse files
Wesley Chenggregkh
authored andcommitted
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. This patch depends on commit 69e131d ("usb: dwc3: gadget: Prevent repeat pullup()") Fixes: 77adb8b ("usb: dwc3: gadget: Allow runtime suspend if UDC unbinded") Cc: stable <[email protected]> Signed-off-by: Wesley Cheng <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent bad0d1d commit 040f2db

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/usb/dwc3/gadget.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2539,9 +2539,6 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on)
25392539

25402540
is_on = !!is_on;
25412541

2542-
if (dwc->pullups_connected == is_on)
2543-
return 0;
2544-
25452542
dwc->softconnect = is_on;
25462543

25472544
/*
@@ -2566,6 +2563,11 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on)
25662563
return 0;
25672564
}
25682565

2566+
if (dwc->pullups_connected == is_on) {
2567+
pm_runtime_put(dwc->dev);
2568+
return 0;
2569+
}
2570+
25692571
if (!is_on) {
25702572
ret = dwc3_gadget_soft_disconnect(dwc);
25712573
} else {

0 commit comments

Comments
 (0)