Skip to content

Commit 69e131d

Browse files
Thinh Nguyengregkh
authored andcommitted
usb: dwc3: gadget: Prevent repeat pullup()
Don't do soft-disconnect if it's previously done. Likewise, don't do soft-connect if the device is currently connected and running. It would break normal operation. Currently the caller of pullup() (udc's sysfs soft_connect) only checks if it had initiated disconnect to prevent repeating soft-disconnect. It doesn't check for soft-connect. To be safe, let's keep the check here regardless whether the udc core is fixed. Signed-off-by: Thinh Nguyen <[email protected]> Link: https://lore.kernel.org/r/1c1345bd66c97a9d32f77d63aaadd04b7b037143.1650593829.git.Thinh.Nguyen@synopsys.com Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent ca05b38 commit 69e131d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/usb/dwc3/gadget.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2514,6 +2514,10 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on)
25142514
int ret;
25152515

25162516
is_on = !!is_on;
2517+
2518+
if (dwc->pullups_connected == is_on)
2519+
return 0;
2520+
25172521
dwc->softconnect = is_on;
25182522
/*
25192523
* Per databook, when we want to stop the gadget, if a control transfer

0 commit comments

Comments
 (0)