mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
usb: dwc3: Properly handle processing of pending events
commit3ddaa6a274upstream. If dwc3 is runtime suspended we defer processing the event buffer until resume, by setting the pending_events flag. Set this flag before triggering resume to avoid race with the runtime resume callback. While handling the pending events, in addition to checking the event buffer we also need to process it. Handle this by explicitly calling dwc3_thread_interrupt(). Also balance the runtime pm get() operation that triggered this processing. Cc: stable@vger.kernel.org Fixes:fc8bb91bc8("usb: dwc3: implement runtime PM") Signed-off-by: Elson Roy Serrao <quic_eserrao@quicinc.com> Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Reviewed-by: Roger Quadros <rogerq@kernel.org> Link: https://lore.kernel.org/r/20230801192658.19275-1-quic_eserrao@quicinc.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0d2d5282d3
commit
d2a4ded0ee
@@ -4342,9 +4342,14 @@ static irqreturn_t dwc3_check_event_buf(struct dwc3_event_buffer *evt)
|
|||||||
u32 count;
|
u32 count;
|
||||||
|
|
||||||
if (pm_runtime_suspended(dwc->dev)) {
|
if (pm_runtime_suspended(dwc->dev)) {
|
||||||
|
dwc->pending_events = true;
|
||||||
|
/*
|
||||||
|
* Trigger runtime resume. The get() function will be balanced
|
||||||
|
* after processing the pending events in dwc3_process_pending
|
||||||
|
* events().
|
||||||
|
*/
|
||||||
pm_runtime_get(dwc->dev);
|
pm_runtime_get(dwc->dev);
|
||||||
disable_irq_nosync(dwc->irq_gadget);
|
disable_irq_nosync(dwc->irq_gadget);
|
||||||
dwc->pending_events = true;
|
|
||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4609,6 +4614,8 @@ void dwc3_gadget_process_pending_events(struct dwc3 *dwc)
|
|||||||
{
|
{
|
||||||
if (dwc->pending_events) {
|
if (dwc->pending_events) {
|
||||||
dwc3_interrupt(dwc->irq_gadget, dwc->ev_buf);
|
dwc3_interrupt(dwc->irq_gadget, dwc->ev_buf);
|
||||||
|
dwc3_thread_interrupt(dwc->irq_gadget, dwc->ev_buf);
|
||||||
|
pm_runtime_put(dwc->dev);
|
||||||
dwc->pending_events = false;
|
dwc->pending_events = false;
|
||||||
enable_irq(dwc->irq_gadget);
|
enable_irq(dwc->irq_gadget);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user