From: Stephen Warren <swarren@xxxxxxxxxxxxx> The top-level hcd interrupt handlers already used irq_return_t, but the functions to which it delegates the actual work and the common irq handler returned plain ints. In addition, they used the IRQ_RETVAL in the wrong way (but because of the values of the various constants, this didn't result in wrong behaviour). Signed-off-by: Stephen Warren <swarren@xxxxxxxxxxxxx> [matthijs@xxxxxxxx: Split patch from bigger patch and added commit message] Signed-off-by: Matthijs Kooijman <matthijs@xxxxxxxx> --- drivers/staging/dwc2/core_intr.c | 8 ++++---- drivers/staging/dwc2/hcd.c | 3 +-- drivers/staging/dwc2/hcd.h | 6 +++--- drivers/staging/dwc2/hcd_intr.c | 34 +++++++++++++++++++++++----------- 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/drivers/staging/dwc2/core_intr.c b/drivers/staging/dwc2/core_intr.c index fde1e23..454c502 100644 --- a/drivers/staging/dwc2/core_intr.c +++ b/drivers/staging/dwc2/core_intr.c @@ -450,7 +450,7 @@ irqreturn_t dwc2_handle_common_intr(int irq, void *dev) { struct dwc2_hsotg *hsotg = dev; u32 gintsts; - int retval = 0; + irqreturn_t retval = IRQ_NONE; if (dwc2_check_core_status(hsotg) < 0) { dev_warn(hsotg->dev, "Controller is disconnected"); @@ -461,7 +461,7 @@ irqreturn_t dwc2_handle_common_intr(int irq, void *dev) gintsts = dwc2_read_common_intr(hsotg); if (gintsts & ~GINTSTS_PRTINT) - retval = 1; + retval = IRQ_HANDLED; if (gintsts & GINTSTS_MODEMIS) dwc2_handle_mode_mismatch_intr(hsotg); @@ -494,12 +494,12 @@ irqreturn_t dwc2_handle_common_intr(int irq, void *dev) " --Port interrupt received in Device mode--\n"); gintsts = GINTSTS_PRTINT; writel(gintsts, hsotg->regs + GINTSTS); - retval = 1; + retval = IRQ_HANDLED; } } spin_unlock(&hsotg->lock); out: - return IRQ_RETVAL(retval); + return retval; } EXPORT_SYMBOL_GPL(dwc2_handle_common_intr); diff --git a/drivers/staging/dwc2/hcd.c b/drivers/staging/dwc2/hcd.c index c0a0999..1f375ac 100644 --- a/drivers/staging/dwc2/hcd.c +++ b/drivers/staging/dwc2/hcd.c @@ -2531,9 +2531,8 @@ static void _dwc2_hcd_endpoint_reset(struct usb_hcd *hcd, static irqreturn_t _dwc2_hcd_irq(struct usb_hcd *hcd) { struct dwc2_hsotg *hsotg = dwc2_hcd_to_hsotg(hcd); - int retval = dwc2_hcd_intr(hsotg); - return IRQ_RETVAL(retval); + return dwc2_hcd_intr(hsotg); } /* diff --git a/drivers/staging/dwc2/hcd.h b/drivers/staging/dwc2/hcd.h index 8d8e20b..5d90f4c 100644 --- a/drivers/staging/dwc2/hcd.h +++ b/drivers/staging/dwc2/hcd.h @@ -633,10 +633,10 @@ extern void dwc2_hcd_save_data_toggle(struct dwc2_hsotg *hsotg, * * @hsotg: The DWC2 HCD * - * Returns non zero if interrupt is handled - * Return 0 if interrupt is not handled + * Returns IRQ_HANDLED if interrupt is handled + * Return IRQ_NONE if interrupt is not handled */ -extern int dwc2_hcd_intr(struct dwc2_hsotg *hsotg); +extern irqreturn_t dwc2_hcd_intr(struct dwc2_hsotg *hsotg); /** * dwc2_hcd_stop() - Halts the DWC_otg host mode operation diff --git a/drivers/staging/dwc2/hcd_intr.c b/drivers/staging/dwc2/hcd_intr.c index 5b917b1..69ce22e 100644 --- a/drivers/staging/dwc2/hcd_intr.c +++ b/drivers/staging/dwc2/hcd_intr.c @@ -2054,10 +2054,10 @@ static void dwc2_hc_intr(struct dwc2_hsotg *hsotg) } /* This function handles interrupts for the HCD */ -int dwc2_hcd_intr(struct dwc2_hsotg *hsotg) +irqreturn_t dwc2_hcd_intr(struct dwc2_hsotg *hsotg) { u32 gintsts, dbg_gintsts; - int retval = 0; + irqreturn_t retval = IRQ_NONE; if (dwc2_check_core_status(hsotg) < 0) { dev_warn(hsotg->dev, "Controller is disconnected"); @@ -2074,8 +2074,6 @@ int dwc2_hcd_intr(struct dwc2_hsotg *hsotg) return 0; } - retval = 1; - dbg_gintsts = gintsts; #ifndef DEBUG_SOF dbg_gintsts &= ~GINTSTS_SOF; @@ -2089,21 +2087,35 @@ int dwc2_hcd_intr(struct dwc2_hsotg *hsotg) "DWC OTG HCD Interrupt Detected gintsts&gintmsk=0x%08x\n", gintsts); - if (gintsts & GINTSTS_SOF) + if (gintsts & GINTSTS_SOF) { dwc2_sof_intr(hsotg); - if (gintsts & GINTSTS_RXFLVL) + retval = IRQ_HANDLED; + } + if (gintsts & GINTSTS_RXFLVL) { dwc2_rx_fifo_level_intr(hsotg); - if (gintsts & GINTSTS_NPTXFEMP) + retval = IRQ_HANDLED; + } + if (gintsts & GINTSTS_NPTXFEMP) { dwc2_np_tx_fifo_empty_intr(hsotg); - if (gintsts & GINTSTS_I2CINT) + retval = IRQ_HANDLED; + } + if (gintsts & GINTSTS_I2CINT) { /* Todo: Implement i2cintr handler */ writel(GINTSTS_I2CINT, hsotg->regs + GINTSTS); - if (gintsts & GINTSTS_PRTINT) + retval = IRQ_HANDLED; + } + if (gintsts & GINTSTS_PRTINT) { dwc2_port_intr(hsotg); - if (gintsts & GINTSTS_HCHINT) + retval = IRQ_HANDLED; + } + if (gintsts & GINTSTS_HCHINT) { dwc2_hc_intr(hsotg); - if (gintsts & GINTSTS_PTXFEMP) + retval = IRQ_HANDLED; + } + if (gintsts & GINTSTS_PTXFEMP) { dwc2_perio_tx_fifo_empty_intr(hsotg); + retval = IRQ_HANDLED; + } if (dbg_gintsts) { dev_vdbg(hsotg->dev, -- 1.8.0 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html