Re: [PATCH] usb: dwc3: update link state when process wakeup interrupt

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

 




On 2/2/2023 3:05 AM, Thinh Nguyen wrote:
On Wed, Feb 01, 2023, Linyu Yuan wrote:
Consider there is interrpt sequences as suspend (U3) -> wakeup (U0) ->
interrupt?


thanks, will change next version.



suspend (U3), as there is no update to link state in wakeup interrupt,
Instead of "no update", can you note in the commit that the link state
change event is not enabled for most devices, so the driver doesn't
update its link_state.


thanks, will change next version.



the second suspend interrupt will not report to upper layer.

Fix it by update link state in wakeup interrupt handler.

Cc: stable@xxxxxxxxxxxxxxx
Can you add fix tag?


seem this change can apply to all current stable kernel.

I think CC stable is good. also it is not good to find appreciate tag.



Signed-off-by: Linyu Yuan <quic_linyyuan@xxxxxxxxxxx>
---
  drivers/usb/dwc3/gadget.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 89dcfac..3533241 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -4066,7 +4066,7 @@ static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc)
  	 */
  }
-static void dwc3_gadget_wakeup_interrupt(struct dwc3 *dwc)
+static void dwc3_gadget_wakeup_interrupt(struct dwc3 *dwc, unsigned int evtinfo)
  {
  	/*
  	 * TODO take core out of low power mode when that's
@@ -4078,6 +4078,8 @@ static void dwc3_gadget_wakeup_interrupt(struct dwc3 *dwc)
  		dwc->gadget_driver->resume(dwc->gadget);
  		spin_lock(&dwc->lock);
  	}
+
+	dwc->link_state = evtinfo & DWC3_LINK_STATE_MASK;
  }
static void dwc3_gadget_linksts_change_interrupt(struct dwc3 *dwc,
@@ -4227,7 +4229,7 @@ static void dwc3_gadget_interrupt(struct dwc3 *dwc,
  		dwc3_gadget_conndone_interrupt(dwc);
  		break;
  	case DWC3_DEVICE_EVENT_WAKEUP:
-		dwc3_gadget_wakeup_interrupt(dwc);
+		dwc3_gadget_wakeup_interrupt(dwc, event->event_info);
  		break;
  	case DWC3_DEVICE_EVENT_HIBER_REQ:
  		if (dev_WARN_ONCE(dwc->dev, !dwc->has_hibernation,
--
2.7.4

Thanks,
Thinh



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux