Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] watchdog: qcom: Propagate errors from optional IRQ lookup
@ 2026-08-07  8:16 phucduc.bui
  2026-08-07  8:16 ` [PATCH 2/4] watchdog: mediatek: " phucduc.bui
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: phucduc.bui @ 2026-08-07  8:16 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Joel Stanley, Andrew Jeffery,
	AngeloGioacchino Del Regno
  Cc: linux-arm-msm, linux-mediatek, linux-watchdog, linux-kernel,
	linux-aspeed, linux-arm-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

platform_get_irq_optional() returns a positive IRQ number on success or
a negative error code on failure. For an optional IRQ, -ENXIO indicates
that no IRQ is available, while other errors should be propagated.

Instead of only checking for -EPROBE_DEFER, propagate all error codes
returned by platform_get_irq_optional() other than -ENXIO, so that
failures are properly reported to the caller.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 drivers/watchdog/qcom-wdt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/qcom-wdt.c b/drivers/watchdog/qcom-wdt.c
index 49bd04841f0c..a8eb1d8f24f0 100644
--- a/drivers/watchdog/qcom-wdt.c
+++ b/drivers/watchdog/qcom-wdt.c
@@ -298,8 +298,8 @@ static int qcom_wdt_probe(struct platform_device *pdev)
 		wdt->wdd.info = &qcom_wdt_pt_info;
 		wdt->wdd.pretimeout = 1;
 	} else {
-		if (irq == -EPROBE_DEFER)
-			return -EPROBE_DEFER;
+		if (irq != -ENXIO)
+			return irq;
 
 		wdt->wdd.info = &qcom_wdt_info;
 	}
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 2/4] watchdog: mediatek: Propagate errors from optional IRQ lookup
  2026-08-07  8:16 [PATCH 1/4] watchdog: qcom: Propagate errors from optional IRQ lookup phucduc.bui
@ 2026-08-07  8:16 ` phucduc.bui
  2026-08-09 15:02   ` Guenter Roeck
  2026-08-07  8:16 ` [PATCH 3/4] watchdog: dw_wdt: " phucduc.bui
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 18+ messages in thread
From: phucduc.bui @ 2026-08-07  8:16 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Joel Stanley, Andrew Jeffery,
	AngeloGioacchino Del Regno
  Cc: linux-arm-msm, linux-mediatek, linux-watchdog, linux-kernel,
	linux-aspeed, linux-arm-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

platform_get_irq_optional() returns a positive IRQ number on success or
a negative error code on failure. For an optional IRQ, -ENXIO indicates
that no IRQ is available, while other errors should be propagated.

Instead of only checking for -EPROBE_DEFER, propagate all error codes
returned by platform_get_irq_optional() other than -ENXIO, so that
failures are properly reported to the caller.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 drivers/watchdog/mtk_wdt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
index 91d110646e16..d9c30e4c80e3 100644
--- a/drivers/watchdog/mtk_wdt.c
+++ b/drivers/watchdog/mtk_wdt.c
@@ -422,8 +422,8 @@ static int mtk_wdt_probe(struct platform_device *pdev)
 		mtk_wdt->wdt_dev.info = &mtk_wdt_pt_info;
 		mtk_wdt->wdt_dev.pretimeout = WDT_MAX_TIMEOUT / 2;
 	} else {
-		if (irq == -EPROBE_DEFER)
-			return -EPROBE_DEFER;
+		if (irq != -ENXIO)
+			return irq;
 
 		mtk_wdt->wdt_dev.info = &mtk_wdt_info;
 	}
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 3/4] watchdog: dw_wdt: Propagate errors from optional IRQ lookup
  2026-08-07  8:16 [PATCH 1/4] watchdog: qcom: Propagate errors from optional IRQ lookup phucduc.bui
  2026-08-07  8:16 ` [PATCH 2/4] watchdog: mediatek: " phucduc.bui
@ 2026-08-07  8:16 ` phucduc.bui
  2026-08-09 15:03   ` Guenter Roeck
  2026-08-07  8:16 ` [PATCH 4/4] watchdog: aspeed: " phucduc.bui
  2026-08-08  0:23 ` [PATCH 1/4] watchdog: qcom: " Guenter Roeck
  3 siblings, 1 reply; 18+ messages in thread
From: phucduc.bui @ 2026-08-07  8:16 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Joel Stanley, Andrew Jeffery,
	AngeloGioacchino Del Regno
  Cc: linux-arm-msm, linux-mediatek, linux-watchdog, linux-kernel,
	linux-aspeed, linux-arm-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

platform_get_irq_optional() returns a positive IRQ number on success or
a negative error code on failure. For an optional IRQ, -ENXIO indicates
that no IRQ is available, while other errors should be propagated.

Instead of only checking for -EPROBE_DEFER, propagate all error codes
returned by platform_get_irq_optional() other than -ENXIO, so that
failures are properly reported to the caller.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 drivers/watchdog/dw_wdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
index c3fbb6068c52..39031445d754 100644
--- a/drivers/watchdog/dw_wdt.c
+++ b/drivers/watchdog/dw_wdt.c
@@ -611,7 +611,7 @@ static int dw_wdt_drv_probe(struct platform_device *pdev)
 
 		dw_wdt->wdd.info = &dw_wdt_pt_ident;
 	} else {
-		if (ret == -EPROBE_DEFER)
+		if (ret != -ENXIO)
 			return ret;
 
 		dw_wdt->wdd.info = &dw_wdt_ident;
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 4/4] watchdog: aspeed: Propagate errors from optional IRQ lookup
  2026-08-07  8:16 [PATCH 1/4] watchdog: qcom: Propagate errors from optional IRQ lookup phucduc.bui
  2026-08-07  8:16 ` [PATCH 2/4] watchdog: mediatek: " phucduc.bui
  2026-08-07  8:16 ` [PATCH 3/4] watchdog: dw_wdt: " phucduc.bui
@ 2026-08-07  8:16 ` phucduc.bui
  2026-08-09 15:05   ` Guenter Roeck
  2026-08-10  4:34   ` Guenter Roeck
  2026-08-08  0:23 ` [PATCH 1/4] watchdog: qcom: " Guenter Roeck
  3 siblings, 2 replies; 18+ messages in thread
From: phucduc.bui @ 2026-08-07  8:16 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Joel Stanley, Andrew Jeffery,
	AngeloGioacchino Del Regno
  Cc: linux-arm-msm, linux-mediatek, linux-watchdog, linux-kernel,
	linux-aspeed, linux-arm-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

platform_get_irq_optional() returns a positive IRQ number on success or
a negative error code on failure. For an optional IRQ, -ENXIO indicates
that no IRQ is available, while other errors should be propagated.

Propagate errors such as -EPROBE_DEFER and -EINVAL instead of continuing
probe without the IRQ.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 drivers/watchdog/aspeed_wdt.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c
index c9e79851504c..48454ac86074 100644
--- a/drivers/watchdog/aspeed_wdt.c
+++ b/drivers/watchdog/aspeed_wdt.c
@@ -429,6 +429,8 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
 	if (wdt->cfg->irq_mask) {
 		int irq = platform_get_irq_optional(pdev, 0);
 
+		if (irq < 0 && irq != -ENXIO)
+			return irq;
 		if (irq > 0) {
 			ret = devm_request_irq(dev, irq, aspeed_wdt_irq,
 					       IRQF_SHARED, dev_name(dev),
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/4] watchdog: qcom: Propagate errors from optional IRQ lookup
  2026-08-07  8:16 [PATCH 1/4] watchdog: qcom: Propagate errors from optional IRQ lookup phucduc.bui
                   ` (2 preceding siblings ...)
  2026-08-07  8:16 ` [PATCH 4/4] watchdog: aspeed: " phucduc.bui
@ 2026-08-08  0:23 ` Guenter Roeck
  2026-08-08  8:59   ` Bui Duc Phuc
  3 siblings, 1 reply; 18+ messages in thread
From: Guenter Roeck @ 2026-08-08  0:23 UTC (permalink / raw)
  To: phucduc.bui, Wim Van Sebroeck, Joel Stanley, Andrew Jeffery,
	AngeloGioacchino Del Regno
  Cc: linux-arm-msm, linux-mediatek, linux-watchdog, linux-kernel,
	linux-aspeed, linux-arm-kernel

On 8/7/26 01:16, phucduc.bui@gmail.com wrote:
> From: bui duc phuc <phucduc.bui@gmail.com>
> 
> platform_get_irq_optional() returns a positive IRQ number on success or
> a negative error code on failure. For an optional IRQ, -ENXIO indicates
> that no IRQ is available, while other errors should be propagated.
> 
> Instead of only checking for -EPROBE_DEFER, propagate all error codes
> returned by platform_get_irq_optional() other than -ENXIO, so that
> failures are properly reported to the caller.
> 
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
> ---
>   drivers/watchdog/qcom-wdt.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/watchdog/qcom-wdt.c b/drivers/watchdog/qcom-wdt.c
> index 49bd04841f0c..a8eb1d8f24f0 100644
> --- a/drivers/watchdog/qcom-wdt.c
> +++ b/drivers/watchdog/qcom-wdt.c
> @@ -298,8 +298,8 @@ static int qcom_wdt_probe(struct platform_device *pdev)
>   		wdt->wdd.info = &qcom_wdt_pt_info;
>   		wdt->wdd.pretimeout = 1;
>   	} else {
> -		if (irq == -EPROBE_DEFER)
> -			return -EPROBE_DEFER;
> +		if (irq != -ENXIO)
> +			return irq;

This is wrong. Check the if() path - the code ends up here if pretimeout == 0,
even if irq > 0.

Guenter



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/4] watchdog: qcom: Propagate errors from optional IRQ lookup
  2026-08-08  0:23 ` [PATCH 1/4] watchdog: qcom: " Guenter Roeck
@ 2026-08-08  8:59   ` Bui Duc Phuc
  2026-08-08 14:51     ` Guenter Roeck
  0 siblings, 1 reply; 18+ messages in thread
From: Bui Duc Phuc @ 2026-08-08  8:59 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Wim Van Sebroeck, Joel Stanley, Andrew Jeffery,
	AngeloGioacchino Del Regno, linux-arm-msm, linux-mediatek,
	linux-watchdog, linux-kernel, linux-aspeed, linux-arm-kernel

Hi Guenter,

Thanks for the review.

>
> This is wrong. Check the if() path - the code ends up here if pretimeout == 0,
> even if irq > 0.
>

You're right. I misunderstood the condition in the if() path.
I'll rewrite it as follows:

 irq = platform_get_irq_optional(pdev, 0);
+if (irq < 0 && irq != -ENXIO)
+        return irq;
if (data->pretimeout && irq > 0) {
.....
 } else {
- if (irq == -EPROBE_DEFER)
-       return -EPROBE_DEFER;
  wdt->wdd.info = &qcom_wdt_info;
 }

Best regards,
Phuc


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/4] watchdog: qcom: Propagate errors from optional IRQ lookup
  2026-08-08  8:59   ` Bui Duc Phuc
@ 2026-08-08 14:51     ` Guenter Roeck
  2026-08-09 10:01       ` Bui Duc Phuc
  0 siblings, 1 reply; 18+ messages in thread
From: Guenter Roeck @ 2026-08-08 14:51 UTC (permalink / raw)
  To: Bui Duc Phuc
  Cc: Wim Van Sebroeck, Joel Stanley, Andrew Jeffery,
	AngeloGioacchino Del Regno, linux-arm-msm, linux-mediatek,
	linux-watchdog, linux-kernel, linux-aspeed, linux-arm-kernel

On 8/8/26 01:59, Bui Duc Phuc wrote:
> Hi Guenter,
> 
> Thanks for the review.
> 
>>
>> This is wrong. Check the if() path - the code ends up here if pretimeout == 0,
>> even if irq > 0.
>>
> 
> You're right. I misunderstood the condition in the if() path.
> I'll rewrite it as follows:
> 
>   irq = platform_get_irq_optional(pdev, 0);
> +if (irq < 0 && irq != -ENXIO)
> +        return irq;

This is still wrong. If there is no pretimeout, it does not matter if there is an error.

Guenter

> if (data->pretimeout && irq > 0) {
> .....
>   } else {
> - if (irq == -EPROBE_DEFER)
> -       return -EPROBE_DEFER;
>    wdt->wdd.info = &qcom_wdt_info;
>   }
> 
> Best regards,
> Phuc



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/4] watchdog: qcom: Propagate errors from optional IRQ lookup
  2026-08-08 14:51     ` Guenter Roeck
@ 2026-08-09 10:01       ` Bui Duc Phuc
  2026-08-09 14:54         ` Guenter Roeck
  0 siblings, 1 reply; 18+ messages in thread
From: Bui Duc Phuc @ 2026-08-09 10:01 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Wim Van Sebroeck, Joel Stanley, Andrew Jeffery,
	AngeloGioacchino Del Regno, linux-arm-msm, linux-mediatek,
	linux-watchdog, linux-kernel, linux-aspeed, linux-arm-kernel

Hi Guenter

Thank you for your review .

> >   irq = platform_get_irq_optional(pdev, 0);
> > +if (irq < 0 && irq != -ENXIO)
> > +        return irq;
>
> This is still wrong. If there is no pretimeout, it does not matter if there is an error.
>

If checking data->pretimeout is required here, I'd propose one of the
following approaches
let me know which one you'd prefer:

Option A (minimal diff, keep existing structure):
---------------
irq = platform_get_irq_optional(pdev, 0);
if (data->pretimeout && irq > 0) {
        ret = devm_request_irq(dev, irq, qcom_wdt_isr, 0,
                                               "wdt_bark", &wdt->wdd);
        if (ret)
                return ret;

        wdt->wdd.info = &qcom_wdt_pt_info;
        wdt->wdd.pretimeout = 1;
} else {
        if (data->pretimeout && irq < 0 && irq != -ENXIO)
                return irq;

        wdt->wdd.info = &qcom_wdt_info;
}
------------------

Option B (check moved out, before the if/else):

------------------
irq = platform_get_irq_optional(pdev, 0);
if (data->pretimeout && irq < 0 && irq != -ENXIO)
        return irq;

if (data->pretimeout && irq > 0) {
        ret = devm_request_irq(dev, irq, qcom_wdt_isr, 0,
                                               "wdt_bark", &wdt->wdd);
        if (ret)
                return ret;

        wdt->wdd.info = &qcom_wdt_pt_info;
        wdt->wdd.pretimeout = 1;
} else {
        wdt->wdd.info = &qcom_wdt_info;
}
----------------------

Option C (default-then-override, only look up the IRQ when pretimeout
is supported):

----------------------
wdt->wdd.info = &qcom_wdt_info;

if (data->pretimeout) {
        irq = platform_get_irq_optional(pdev, 0);
        if(irq < 0 && irq != -ENXIO)
                return irq;

        if (irq > 0){
                ret = devm_request_irq(dev, irq, qcom_wdt_isr, 0,
                                                       "wdt_bark", &wdt->wdd);
                if(ret)
                        return ret;

                wdt->wdd.info= &qcom_wdt_pt_info;
                wdt->wdd.pretimeout = 1;
        }
}
-----------------------

Let me know which one you think fits best, or if you'd prefer something else.

Best regards,
Phuc


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/4] watchdog: qcom: Propagate errors from optional IRQ lookup
  2026-08-09 10:01       ` Bui Duc Phuc
@ 2026-08-09 14:54         ` Guenter Roeck
  2026-08-10  2:42           ` Bui Duc Phuc
  0 siblings, 1 reply; 18+ messages in thread
From: Guenter Roeck @ 2026-08-09 14:54 UTC (permalink / raw)
  To: Bui Duc Phuc
  Cc: Wim Van Sebroeck, Joel Stanley, Andrew Jeffery,
	AngeloGioacchino Del Regno, linux-arm-msm, linux-mediatek,
	linux-watchdog, linux-kernel, linux-aspeed, linux-arm-kernel

On 8/9/26 03:01, Bui Duc Phuc wrote:
> Hi Guenter
> 
> Thank you for your review .
> 
>>>    irq = platform_get_irq_optional(pdev, 0);
>>> +if (irq < 0 && irq != -ENXIO)
>>> +        return irq;
>>
>> This is still wrong. If there is no pretimeout, it does not matter if there is an error.
>>
> 
> If checking data->pretimeout is required here, I'd propose one of the
> following approaches
> let me know which one you'd prefer:
> 
> Option A (minimal diff, keep existing structure):
> ---------------
> irq = platform_get_irq_optional(pdev, 0);
> if (data->pretimeout && irq > 0) {
>          ret = devm_request_irq(dev, irq, qcom_wdt_isr, 0,
>                                                 "wdt_bark", &wdt->wdd);
>          if (ret)
>                  return ret;
> 
>          wdt->wdd.info = &qcom_wdt_pt_info;
>          wdt->wdd.pretimeout = 1;
> } else {
>          if (data->pretimeout && irq < 0 && irq != -ENXIO)
>                  return irq;
> 
>          wdt->wdd.info = &qcom_wdt_info;
> }
> ------------------
> 
> Option B (check moved out, before the if/else):
> 
> ------------------
> irq = platform_get_irq_optional(pdev, 0);
> if (data->pretimeout && irq < 0 && irq != -ENXIO)
>          return irq;
> 
> if (data->pretimeout && irq > 0) {
>          ret = devm_request_irq(dev, irq, qcom_wdt_isr, 0,
>                                                 "wdt_bark", &wdt->wdd);
>          if (ret)
>                  return ret;
> 
>          wdt->wdd.info = &qcom_wdt_pt_info;
>          wdt->wdd.pretimeout = 1;
> } else {
>          wdt->wdd.info = &qcom_wdt_info;
> }
> ----------------------
> 
> Option C (default-then-override, only look up the IRQ when pretimeout
> is supported):
> 
> ----------------------
> wdt->wdd.info = &qcom_wdt_info;
> 
> if (data->pretimeout) {
>          irq = platform_get_irq_optional(pdev, 0);
>          if(irq < 0 && irq != -ENXIO)
>                  return irq;
> 
>          if (irq > 0){
>                  ret = devm_request_irq(dev, irq, qcom_wdt_isr, 0,
>                                                         "wdt_bark", &wdt->wdd);
>                  if(ret)
>                          return ret;
> 
>                  wdt->wdd.info= &qcom_wdt_pt_info;
>                  wdt->wdd.pretimeout = 1;
>          }
> }
> -----------------------
> 
> Let me know which one you think fits best, or if you'd prefer something else.
> 

I wpuld probably implement something like

	if (data->pretimeout) {
		irq = platform_get_irq_optional(pdev, 0);
		if (irq < 0 && irq != -ENXIO)
			return irq;
	        ret = devm_request_irq(dev, irq, qcom_wdt_isr, 0,
				       "wdt_bark", &wdt->wdd);
	        if (ret)
         	        return ret;

	        wdt->wdd.info = &qcom_wdt_pt_info;
         	wdt->wdd.pretimeout = 1;
	} else {
         	wdt->wdd.info = &qcom_wdt_info;
	}

(which I think would be a combination of B and C) but ultimately it is
POV and doesn't really matter.

Thanks,
Guenter



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/4] watchdog: mediatek: Propagate errors from optional IRQ lookup
  2026-08-07  8:16 ` [PATCH 2/4] watchdog: mediatek: " phucduc.bui
@ 2026-08-09 15:02   ` Guenter Roeck
  0 siblings, 0 replies; 18+ messages in thread
From: Guenter Roeck @ 2026-08-09 15:02 UTC (permalink / raw)
  To: phucduc.bui
  Cc: Wim Van Sebroeck, Joel Stanley, Andrew Jeffery,
	AngeloGioacchino Del Regno, linux-arm-msm, linux-mediatek,
	linux-watchdog, linux-kernel, linux-aspeed, linux-arm-kernel

On Fri, Aug 07, 2026 at 03:16:50PM +0700, phucduc.bui@gmail.com wrote:
> From: bui duc phuc <phucduc.bui@gmail.com>
> 
> platform_get_irq_optional() returns a positive IRQ number on success or
> a negative error code on failure. For an optional IRQ, -ENXIO indicates
> that no IRQ is available, while other errors should be propagated.
> 
> Instead of only checking for -EPROBE_DEFER, propagate all error codes
> returned by platform_get_irq_optional() other than -ENXIO, so that
> failures are properly reported to the caller.
> 
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>

Applied.

Thanks,
Guenter


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/4] watchdog: dw_wdt: Propagate errors from optional IRQ lookup
  2026-08-07  8:16 ` [PATCH 3/4] watchdog: dw_wdt: " phucduc.bui
@ 2026-08-09 15:03   ` Guenter Roeck
  0 siblings, 0 replies; 18+ messages in thread
From: Guenter Roeck @ 2026-08-09 15:03 UTC (permalink / raw)
  To: phucduc.bui
  Cc: Wim Van Sebroeck, Joel Stanley, Andrew Jeffery,
	AngeloGioacchino Del Regno, linux-arm-msm, linux-mediatek,
	linux-watchdog, linux-kernel, linux-aspeed, linux-arm-kernel

On Fri, Aug 07, 2026 at 03:16:51PM +0700, phucduc.bui@gmail.com wrote:
> From: bui duc phuc <phucduc.bui@gmail.com>
> 
> platform_get_irq_optional() returns a positive IRQ number on success or
> a negative error code on failure. For an optional IRQ, -ENXIO indicates
> that no IRQ is available, while other errors should be propagated.
> 
> Instead of only checking for -EPROBE_DEFER, propagate all error codes
> returned by platform_get_irq_optional() other than -ENXIO, so that
> failures are properly reported to the caller.
> 
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>

Applied.

Thanks,
Guenter


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 4/4] watchdog: aspeed: Propagate errors from optional IRQ lookup
  2026-08-07  8:16 ` [PATCH 4/4] watchdog: aspeed: " phucduc.bui
@ 2026-08-09 15:05   ` Guenter Roeck
  2026-08-10  2:38     ` Bui Duc Phuc
  2026-08-10  4:34   ` Guenter Roeck
  1 sibling, 1 reply; 18+ messages in thread
From: Guenter Roeck @ 2026-08-09 15:05 UTC (permalink / raw)
  To: phucduc.bui
  Cc: Wim Van Sebroeck, Joel Stanley, Andrew Jeffery,
	AngeloGioacchino Del Regno, linux-arm-msm, linux-mediatek,
	linux-watchdog, linux-kernel, linux-aspeed, linux-arm-kernel

On Fri, Aug 07, 2026 at 03:16:52PM +0700, phucduc.bui@gmail.com wrote:
> From: bui duc phuc <phucduc.bui@gmail.com>
> 
> platform_get_irq_optional() returns a positive IRQ number on success or
> a negative error code on failure. For an optional IRQ, -ENXIO indicates
> that no IRQ is available, while other errors should be propagated.
> 
> Propagate errors such as -EPROBE_DEFER and -EINVAL instead of continuing
> probe without the IRQ.
> 
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
> ---
>  drivers/watchdog/aspeed_wdt.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c
> index c9e79851504c..48454ac86074 100644
> --- a/drivers/watchdog/aspeed_wdt.c
> +++ b/drivers/watchdog/aspeed_wdt.c
> @@ -429,6 +429,8 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
>  	if (wdt->cfg->irq_mask) {
>  		int irq = platform_get_irq_optional(pdev, 0);
>  
> +		if (irq < 0 && irq != -ENXIO)
> +			return irq;
>  		if (irq > 0) {

This if () is no longer needed.

Thanks,
Guenter

>  			ret = devm_request_irq(dev, irq, aspeed_wdt_irq,
>  					       IRQF_SHARED, dev_name(dev),


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 4/4] watchdog: aspeed: Propagate errors from optional IRQ lookup
  2026-08-09 15:05   ` Guenter Roeck
@ 2026-08-10  2:38     ` Bui Duc Phuc
  2026-08-10  3:58       ` Guenter Roeck
  0 siblings, 1 reply; 18+ messages in thread
From: Bui Duc Phuc @ 2026-08-10  2:38 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Wim Van Sebroeck, Joel Stanley, Andrew Jeffery,
	AngeloGioacchino Del Regno, linux-arm-msm, linux-mediatek,
	linux-watchdog, linux-kernel, linux-aspeed, linux-arm-kernel

Hi Guenter,

Thank you for your review.

> > +             if (irq < 0 && irq != -ENXIO)
> > +                     return irq;
> >               if (irq > 0) {
>
> This if () is no longer needed.
>

If we remove the if (irq > 0) check, irq can be -ENXIO and would be
passed to devm_request_irq().
I see that the irq argument of devm_request_irq() is an unsigned int.
Would it be safe to pass -ENXIO to it in this case?

Best regards,
Phuc


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/4] watchdog: qcom: Propagate errors from optional IRQ lookup
  2026-08-09 14:54         ` Guenter Roeck
@ 2026-08-10  2:42           ` Bui Duc Phuc
  0 siblings, 0 replies; 18+ messages in thread
From: Bui Duc Phuc @ 2026-08-10  2:42 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Wim Van Sebroeck, Joel Stanley, Andrew Jeffery,
	AngeloGioacchino Del Regno, linux-arm-msm, linux-mediatek,
	linux-watchdog, linux-kernel, linux-aspeed, linux-arm-kernel

Hi Guenter,

Thank you for your feedback.

>
> I wpuld probably implement something like
>
>         if (data->pretimeout) {
>                 irq = platform_get_irq_optional(pdev, 0);
>                 if (irq < 0 && irq != -ENXIO)
>                         return irq;
>                 ret = devm_request_irq(dev, irq, qcom_wdt_isr, 0,
>                                        "wdt_bark", &wdt->wdd);
>                 if (ret)
>                         return ret;
>
>                 wdt->wdd.info = &qcom_wdt_pt_info;
>                 wdt->wdd.pretimeout = 1;
>         } else {
>                 wdt->wdd.info = &qcom_wdt_info;
>         }
>
> (which I think would be a combination of B and C) but ultimately it is
> POV and doesn't really matter.
>

I'll go with your suggested approach.

Best regards,
Phuc


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 4/4] watchdog: aspeed: Propagate errors from optional IRQ lookup
  2026-08-10  2:38     ` Bui Duc Phuc
@ 2026-08-10  3:58       ` Guenter Roeck
  2026-08-10  9:45         ` Bui Duc Phuc
  0 siblings, 1 reply; 18+ messages in thread
From: Guenter Roeck @ 2026-08-10  3:58 UTC (permalink / raw)
  To: Bui Duc Phuc
  Cc: Wim Van Sebroeck, Joel Stanley, Andrew Jeffery,
	AngeloGioacchino Del Regno, linux-arm-msm, linux-mediatek,
	linux-watchdog, linux-kernel, linux-aspeed, linux-arm-kernel

On 8/9/26 19:38, Bui Duc Phuc wrote:
> Hi Guenter,
> 
> Thank you for your review.
> 
>>> +             if (irq < 0 && irq != -ENXIO)
>>> +                     return irq;
>>>                if (irq > 0) {
>>
>> This if () is no longer needed.
>>
> 
> If we remove the if (irq > 0) check, irq can be -ENXIO and would be
> passed to devm_request_irq().
> I see that the irq argument of devm_request_irq() is an unsigned int.
> Would it be safe to pass -ENXIO to it in this case?
> 
No, sorry, I was wrong.

Guenter



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 4/4] watchdog: aspeed: Propagate errors from optional IRQ lookup
  2026-08-07  8:16 ` [PATCH 4/4] watchdog: aspeed: " phucduc.bui
  2026-08-09 15:05   ` Guenter Roeck
@ 2026-08-10  4:34   ` Guenter Roeck
  1 sibling, 0 replies; 18+ messages in thread
From: Guenter Roeck @ 2026-08-10  4:34 UTC (permalink / raw)
  To: phucduc.bui
  Cc: Wim Van Sebroeck, Joel Stanley, Andrew Jeffery,
	AngeloGioacchino Del Regno, linux-arm-msm, linux-mediatek,
	linux-watchdog, linux-kernel, linux-aspeed, linux-arm-kernel

On Fri, Aug 07, 2026 at 03:16:52PM +0700, phucduc.bui@gmail.com wrote:
> From: bui duc phuc <phucduc.bui@gmail.com>
> 
> platform_get_irq_optional() returns a positive IRQ number on success or
> a negative error code on failure. For an optional IRQ, -ENXIO indicates
> that no IRQ is available, while other errors should be propagated.
> 
> Propagate errors such as -EPROBE_DEFER and -EINVAL instead of continuing
> probe without the IRQ.
> 
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>

Applied.

Thanks,
Guenter


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 4/4] watchdog: aspeed: Propagate errors from optional IRQ lookup
  2026-08-10  3:58       ` Guenter Roeck
@ 2026-08-10  9:45         ` Bui Duc Phuc
  2026-08-10 14:24           ` Guenter Roeck
  0 siblings, 1 reply; 18+ messages in thread
From: Bui Duc Phuc @ 2026-08-10  9:45 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Wim Van Sebroeck, Joel Stanley, Andrew Jeffery,
	AngeloGioacchino Del Regno, linux-arm-msm, linux-mediatek,
	linux-watchdog, linux-kernel, linux-aspeed, linux-arm-kernel

Hi Guenter,


Thank you for your feedback.

> >>> +                     return irq;
> >>>                if (irq > 0) {
> >>
> >> This if () is no longer needed.
> >>
> >
> > If we remove the if (irq > 0) check, irq can be -ENXIO and would be
> > passed to devm_request_irq().
> > I see that the irq argument of devm_request_irq() is an unsigned int.
> > Would it be safe to pass -ENXIO to it in this case?
> >
> No, sorry, I was wrong.
>

So this means there are no issues with this patch.
Patches 2 and 3 have already been applied by you.
I will temporarily resend only patch 1:
" watchdog: qcom: Propagate errors from optional IRQ lookup "

Best regards,
Phuc


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 4/4] watchdog: aspeed: Propagate errors from optional IRQ lookup
  2026-08-10  9:45         ` Bui Duc Phuc
@ 2026-08-10 14:24           ` Guenter Roeck
  0 siblings, 0 replies; 18+ messages in thread
From: Guenter Roeck @ 2026-08-10 14:24 UTC (permalink / raw)
  To: Bui Duc Phuc
  Cc: Wim Van Sebroeck, Joel Stanley, Andrew Jeffery,
	AngeloGioacchino Del Regno, linux-arm-msm, linux-mediatek,
	linux-watchdog, linux-kernel, linux-aspeed, linux-arm-kernel

On Mon, Aug 10, 2026 at 04:45:07PM +0700, Bui Duc Phuc wrote:
> Hi Guenter,
> 
> 
> Thank you for your feedback.
> 
> > >>> +                     return irq;
> > >>>                if (irq > 0) {
> > >>
> > >> This if () is no longer needed.
> > >>
> > >
> > > If we remove the if (irq > 0) check, irq can be -ENXIO and would be
> > > passed to devm_request_irq().
> > > I see that the irq argument of devm_request_irq() is an unsigned int.
> > > Would it be safe to pass -ENXIO to it in this case?
> > >
> > No, sorry, I was wrong.
> >
> 
> So this means there are no issues with this patch.
> Patches 2 and 3 have already been applied by you.
> I will temporarily resend only patch 1:
> " watchdog: qcom: Propagate errors from optional IRQ lookup "
> 
Correct. Note that gmail may swallow this reply, claiming that it is spam.

Guenter


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2026-08-10 14:24 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-07  8:16 [PATCH 1/4] watchdog: qcom: Propagate errors from optional IRQ lookup phucduc.bui
2026-08-07  8:16 ` [PATCH 2/4] watchdog: mediatek: " phucduc.bui
2026-08-09 15:02   ` Guenter Roeck
2026-08-07  8:16 ` [PATCH 3/4] watchdog: dw_wdt: " phucduc.bui
2026-08-09 15:03   ` Guenter Roeck
2026-08-07  8:16 ` [PATCH 4/4] watchdog: aspeed: " phucduc.bui
2026-08-09 15:05   ` Guenter Roeck
2026-08-10  2:38     ` Bui Duc Phuc
2026-08-10  3:58       ` Guenter Roeck
2026-08-10  9:45         ` Bui Duc Phuc
2026-08-10 14:24           ` Guenter Roeck
2026-08-10  4:34   ` Guenter Roeck
2026-08-08  0:23 ` [PATCH 1/4] watchdog: qcom: " Guenter Roeck
2026-08-08  8:59   ` Bui Duc Phuc
2026-08-08 14:51     ` Guenter Roeck
2026-08-09 10:01       ` Bui Duc Phuc
2026-08-09 14:54         ` Guenter Roeck
2026-08-10  2:42           ` Bui Duc Phuc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox