* [PATCH] USB: dwc2: hande irq on dead controller correctly
@ 2023-08-22 11:24 Oliver Neukum
2023-08-28 10:52 ` Minas Harutyunyan
0 siblings, 1 reply; 3+ messages in thread
From: Oliver Neukum @ 2023-08-22 11:24 UTC (permalink / raw)
To: hminas, gregkh, linux-usb; +Cc: 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
Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
drivers/usb/dwc2/hcd_intr.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc2/hcd_intr.c b/drivers/usb/dwc2/hcd_intr.c
index c9740caa5974..0144ca8350c3 100644
--- a/drivers/usb/dwc2/hcd_intr.c
+++ b/drivers/usb/dwc2/hcd_intr.c
@@ -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);
--
2.41.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] USB: dwc2: hande irq on dead controller correctly
2023-08-22 11:24 [PATCH] USB: dwc2: hande irq on dead controller correctly Oliver Neukum
@ 2023-08-28 10:52 ` Minas Harutyunyan
2023-08-28 11:53 ` Oliver Neukum
0 siblings, 1 reply; 3+ messages in thread
From: Minas Harutyunyan @ 2023-08-28 10:52 UTC (permalink / raw)
To: Oliver Neukum, Minas Harutyunyan, gregkh@linuxfoundation.org,
linux-usb@vger.kernel.org
Hi Oliver,
On 8/22/23 15:24, Oliver Neukum wrote:
> 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
> Signed-off-by: Oliver Neukum <oneukum@suse.com>
> ---
> drivers/usb/dwc2/hcd_intr.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/dwc2/hcd_intr.c b/drivers/usb/dwc2/hcd_intr.c
> index c9740caa5974..0144ca8350c3 100644
> --- a/drivers/usb/dwc2/hcd_intr.c
> +++ b/drivers/usb/dwc2/hcd_intr.c
> @@ -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);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] USB: dwc2: hande irq on dead controller correctly
2023-08-28 10:52 ` Minas Harutyunyan
@ 2023-08-28 11:53 ` Oliver Neukum
0 siblings, 0 replies; 3+ messages in thread
From: Oliver Neukum @ 2023-08-28 11:53 UTC (permalink / raw)
To: Minas Harutyunyan, Oliver Neukum, gregkh@linuxfoundation.org,
linux-usb@vger.kernel.org
On 28.08.23 12:52, Minas Harutyunyan wrote:
Hi,
> 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.
> 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.
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-28 11:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-22 11:24 [PATCH] USB: dwc2: hande irq on dead controller correctly Oliver Neukum
2023-08-28 10:52 ` Minas Harutyunyan
2023-08-28 11:53 ` Oliver Neukum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox