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; 7+ 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] 7+ 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-07  8:16 ` [PATCH 3/4] watchdog: dw_wdt: " phucduc.bui
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ 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] 7+ 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-07  8:16 ` [PATCH 4/4] watchdog: aspeed: " phucduc.bui
  2026-08-08  0:23 ` [PATCH 1/4] watchdog: qcom: " Guenter Roeck
  3 siblings, 0 replies; 7+ 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] 7+ 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-08  0:23 ` [PATCH 1/4] watchdog: qcom: " Guenter Roeck
  3 siblings, 0 replies; 7+ 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] 7+ 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; 7+ 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] 7+ 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; 7+ 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] 7+ 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
  0 siblings, 0 replies; 7+ 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] 7+ messages in thread

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

Thread overview: 7+ 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-07  8:16 ` [PATCH 3/4] watchdog: dw_wdt: " phucduc.bui
2026-08-07  8:16 ` [PATCH 4/4] watchdog: aspeed: " phucduc.bui
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

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