USB: dwc2: hande irq on dead controller correctly
Subsystems (2)
PATCH 1/1 USB: dwc2: hande irq on dead controller correctly
If the controller is dead, the honest answer to the question whether it has caused an irq is: unknown As the purpose of the irq return is to trigger switching off an IRQ, the correct response if you cannot determine if your device has caused the interrupt is IRQ_HANDLED
--- drivers/usb/dwc2/hcd_intr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/dwc2/hcd_intr.c +3 -1
@@ -2203,11 +2203,13 @@ static void dwc2_hc_intr(struct dwc2_hsotg *hsotg)irqreturn_t dwc2_handle_hcd_intr (struct dwc2_hsotg *hsotg) {u32 gintsts, dbg_gintsts; -irqreturn_t retval =IRQ_NONE ; +irqreturn_t retval =IRQ_HANDLED ;if (!dwc2_is_controller_alive (hsotg)) {dev_warn (hsotg->dev,"Controller is dead\n" );return retval; + }else { + retval =IRQ_NONE ; }spin_lock (&hsotg->lock);
Signature · 1 line
2.41.0
Hi Oliver,
Quoted 7 lines · Oliver Neukum
If the controller is dead, the honest answer to the question whether it has caused an irq is: unknown As the purpose of the irq return is to trigger switching off an IRQ, the correct response if you cannot determine if your device has caused the interrupt is
IRQ_HANDLED
If core is dead then it can not assert interrupt, it's more possible that it's spurious interrupt or interrupt from other device (IRQ is shared) and nothing should be handled. In this case reply by IRQ_HANDLED is incorrect because nothing is handled.
Thanks,
Minas
Quoted 24 lines
Signed-off-by Oliver Neukum <[email protected]>--- drivers/usb/dwc2/hcd_intr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/usb/dwc2/hcd_intr.c +3
-1@@ -2203,11 +2203,13 @@ static void dwc2_hc_intr(struct dwc2_hsotg *hsotg)irqreturn_t dwc2_handle_hcd_intr (struct dwc2_hsotg *hsotg) {u32 gintsts, dbg_gintsts; -irqreturn_t retval =IRQ_NONE ; +irqreturn_t retval =IRQ_HANDLED ;if (!dwc2_is_controller_alive (hsotg)) {dev_warn (hsotg->dev,"Controller is dead\n" );return retval; + }else { + retval =IRQ_NONE ; }spin_lock (&hsotg->lock);
On 28.08.23 12:52, Minas Harutyunyan wrote:
Hi,
Quoted 1 line
If core is dead then it can not assert interrupt, it's more possible
No, but it may have asserted the interrupt and then died.
Quoted 3 lines
that it's spurious interrupt or interrupt from other device (IRQ is shared) and nothing should be handled. In this case reply by
IRQ_HANDLEDis incorrect because nothing is handled.
In this case we cannot be sure if it was our interrupt. IRQ_NONE however means that we are sure. Likelihood is not a relevant question here. We must know for sure if we claim IRQ_NONE, because IRQ_NONE has consequences.
Regards
Oliver