[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87r1f95w6q.fsf@kernel.org>
Date: Wed, 04 Aug 2021 13:41:02 +0300
From: Felipe Balbi <balbi@...nel.org>
To: Wesley Cheng <wcheng@...eaurora.org>
Cc: gregkh@...uxfoundation.org, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org, jackp@...eaurora.org
Subject: Re: [PATCH v2] usb: dwc3: gadget: Avoid runtime resume if disabling
pullup
Wesley Cheng <wcheng@...eaurora.org> writes:
> If the device is already in the runtime suspended state, any call to
> the pullup routine will issue a runtime resume on the DWC3 core
> device. If the USB gadget is disabling the pullup, then avoid having
> to issue a runtime resume, as DWC3 gadget has already been
> halted/stopped.
>
> This fixes an issue where the following condition occurs:
>
> usb_gadget_remove_driver()
> -->usb_gadget_disconnect()
> -->dwc3_gadget_pullup(0)
> -->pm_runtime_get_sync() -> ret = 0
> -->pm_runtime_put() [async]
> -->usb_gadget_udc_stop()
> -->dwc3_gadget_stop()
> -->dwc->gadget_driver = NULL
> ...
>
> dwc3_suspend_common()
> -->dwc3_gadget_suspend()
> -->DWC3 halt/stop routine skipped, driver_data == NULL
>
> This leads to a situation where the DWC3 gadget is not properly
> stopped, as the runtime resume would have re-enabled EP0 and event
> interrupts, and since we avoided the DWC3 gadget suspend, these
> resources were never disabled.
>
> Fixes: 77adb8bdf422 ("usb: dwc3: gadget: Allow runtime suspend if UDC unbinded")
> Signed-off-by: Wesley Cheng <wcheng@...eaurora.org>
Acked-by: Felipe Balbi <balbi@...nel.org>
--
balbi
Powered by blists - more mailing lists