From 7a6428be4b1859a5d868429a76d537648302ce06 Mon Sep 17 00:00:00 2001 From: Jack Pham Date: Tue, 26 May 2020 23:33:16 -0700 Subject: [PATCH] usb: dwc3: gadget: Avoid spuriously printing NO_PULLUP in log This log message can come unnecessarily particularly when the controller is operating in host mode and the xHCI HCD driver is primarily handling interrupts. As there should be no gadget specific events there should not be any value showing in the GEVNTCOUNT registers so dwc3_interrupt() should normally return silently. Only print the "NO_PULLUP" log in case there are new/pending events and the gadget is in halted state. Change-Id: I4e5040409a14f18d454833fd67d41ca5d0f13501 Signed-off-by: Jack Pham --- drivers/usb/dwc3/gadget.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index e99806d537f2..bf9aaa6fb8dd 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -3775,15 +3775,6 @@ static irqreturn_t dwc3_check_event_buf(struct dwc3_event_buffer *evt) if (dwc->err_evt_seen) return IRQ_HANDLED; - /* Controller is being halted, ignore the interrupts */ - if (!dwc->pullups_connected) { - count = dwc3_readl(dwc->regs, DWC3_GEVNTCOUNT(0)); - count &= DWC3_GEVNTCOUNT_MASK; - dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), count); - dbg_event(0xFF, "NO_PULLUP", count); - return IRQ_HANDLED; - } - /* * With PCIe legacy interrupt, test shows that top-half irq handler can * be called again after HW interrupt deassertion. Check if bottom-half @@ -3798,6 +3789,13 @@ static irqreturn_t dwc3_check_event_buf(struct dwc3_event_buffer *evt) if (!count) return IRQ_NONE; + /* Controller is halted; ignore new/pending events */ + if (!dwc->pullups_connected) { + dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), count); + dbg_event(0xFF, "NO_PULLUP", count); + return IRQ_HANDLED; + } + evt->count = count; evt->flags |= DWC3_EVENT_PENDING;