mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 19:08:57 +09:00
UPSTREAM: 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.
Change-Id: I07eaeb0ed388ef967eeb9c7513a9c1b260f8d9c5
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/1c1345bd66c97a9d32f77d63aaadd04b7b037143.1650593829.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 69e131d1ac)
This commit is contained in:
@@ -2646,8 +2646,11 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on)
|
||||
int ret;
|
||||
|
||||
is_on = !!is_on;
|
||||
vdwc->softconnect = is_on;
|
||||
|
||||
if (dwc->pullups_connected == is_on)
|
||||
return 0;
|
||||
|
||||
vdwc->softconnect = is_on;
|
||||
/*
|
||||
* Per databook, when we want to stop the gadget, if a control transfer
|
||||
* is still in process, complete it and get the core into setup phase.
|
||||
|
||||
Reference in New Issue
Block a user