Patch "usb: dwc3: gadget: Avoid duplicate requests to enable Run/Stop" 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: Avoid duplicate requests to enable Run/Stop

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-avoid-duplicate-requests-to-enable-r.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 764b064fdc8f4b289941786711040ea65dc54118
Author: Wesley Cheng <quic_wcheng@xxxxxxxxxxx>
Date:   Wed Jul 27 19:06:47 2022 -0700

    usb: dwc3: gadget: Avoid duplicate requests to enable Run/Stop
    
    [ Upstream commit 040f2dbd2010c43f33ad27249e6dac48456f4d99 ]
    
    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 69e131d1ac4e ("usb: dwc3: gadget: Prevent repeat pullup()")
    
    Fixes: 77adb8bdf422 ("usb: dwc3: gadget: Allow runtime suspend if UDC unbinded")
    Cc: stable <stable@xxxxxxxxxx>
    Signed-off-by: Wesley Cheng <quic_wcheng@xxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20220728020647.9377-1-quic_wcheng@xxxxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 484b5e1d921a..14dcdb923f40 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2470,9 +2470,6 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on)
 
 	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
@@ -2509,6 +2506,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;
+	}
+
 	if (!is_on) {
 		ret = dwc3_gadget_soft_disconnect(dwc);
 	} else {



[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