public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: Rosen Penev <rosenp@gmail•com>
To: linux-watchdog@vger•kernel.org
Cc: Nicolas Ferre <nicolas.ferre@microchip•com>,
	Alexandre Belloni <alexandre.belloni@bootlin•com>,
	Claudiu Beznea <claudiu.beznea@tuxon•dev>,
	Wim Van Sebroeck <wim@linux-watchdog•org>,
	Guenter Roeck <linux@roeck-us•net>,
	linux-arm-kernel@lists•infradead.org (moderated
	list:ARM/Microchip (AT91) SoC support),
	linux-kernel@vger•kernel.org (open list)
Subject: [PATCH 2/2] watchdog: sama5d4: use platform_get_irq_optional()
Date: Wed,  3 Jun 2026 18:05:42 -0700	[thread overview]
Message-ID: <20260604010542.23177-3-rosenp@gmail.com> (raw)
In-Reply-To: <20260604010542.23177-1-rosenp@gmail.com>

irq_of_parse_and_map() requires irq_dispose_mapping() on failure. Don't
bother with it as platform_get_irq_optional() doesn't need it.

Also handle EPROBE_DEFER.

Signed-off-by: Rosen Penev <rosenp@gmail•com>
---
 drivers/watchdog/sama5d4_wdt.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/sama5d4_wdt.c b/drivers/watchdog/sama5d4_wdt.c
index b7a8cfed335d..030029d50257 100644
--- a/drivers/watchdog/sama5d4_wdt.c
+++ b/drivers/watchdog/sama5d4_wdt.c
@@ -11,7 +11,6 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/of.h>
-#include <linux/of_irq.h>
 #include <linux/platform_device.h>
 #include <linux/reboot.h>
 #include <linux/watchdog.h>
@@ -245,7 +244,7 @@ static int sama5d4_wdt_probe(struct platform_device *pdev)
 	struct watchdog_device *wdd;
 	struct sama5d4_wdt *wdt;
 	void __iomem *regs;
-	u32 irq = 0;
+	int irq = 0;
 	u32 reg;
 	int ret;
 
@@ -281,8 +280,11 @@ static int sama5d4_wdt_probe(struct platform_device *pdev)
 		return ret;
 
 	if (wdt->need_irq) {
-		irq = irq_of_parse_and_map(dev->of_node, 0);
-		if (!irq) {
+		irq = platform_get_irq_optional(pdev, 0);
+		if (irq == -EPROBE_DEFER)
+			return irq;
+
+		if (irq < 0) {
 			dev_warn(dev, "failed to get IRQ from DT\n");
 			wdt->need_irq = false;
 		}
-- 
2.54.0



      parent reply	other threads:[~2026-06-04  1:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-04  1:05 [PATCH 0/2] watchdog: sama5d4: fix IRQ and timeout bugs, use platform_get_irq_optional Rosen Penev
2026-06-04  1:05 ` [PATCH 1/2] watchdog: sama5d4: fix shared IRQ and hardcoded timeout issues Rosen Penev
2026-06-04  1:05 ` Rosen Penev [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260604010542.23177-3-rosenp@gmail.com \
    --to=rosenp@gmail$(echo .)com \
    --cc=alexandre.belloni@bootlin$(echo .)com \
    --cc=claudiu.beznea@tuxon$(echo .)dev \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-watchdog@vger$(echo .)kernel.org \
    --cc=linux@roeck-us$(echo .)net \
    --cc=nicolas.ferre@microchip$(echo .)com \
    --cc=wim@linux-watchdog$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox