Patch "usb: dwc3: gadget: Prevent repeat pullup()" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    usb: dwc3: gadget: Prevent repeat pullup()

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     usb-dwc3-gadget-prevent-repeat-pullup.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit beb57089f4057802801d51973a5a8128d834edd5
Author: Thinh Nguyen <Thinh.Nguyen@xxxxxxxxxxxx>
Date:   Thu Apr 21 19:22:31 2022 -0700

    usb: dwc3: gadget: Prevent repeat pullup()
    
    [ Upstream commit 69e131d1ac4e52a59ec181ab4f8aa8c48cd8fb64 ]
    
    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 <Thinh.Nguyen@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/1c1345bd66c97a9d32f77d63aaadd04b7b037143.1650593829.git.Thinh.Nguyen@xxxxxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Stable-dep-of: 040f2dbd2010 ("usb: dwc3: gadget: Avoid duplicate requests to enable Run/Stop")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 761065336322..61499b657129 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2442,6 +2442,10 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on)
 	int			ret;
 
 	is_on = !!is_on;
+
+	if (dwc->pullups_connected == is_on)
+		return 0;
+
 	dwc->softconnect = is_on;
 	/*
 	 * Per databook, when we want to stop the gadget, if a control transfer



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux