From: Guenter Roeck <linux@roeck-us.net>
To: Bui Duc Phuc <phucduc.bui@gmail.com>
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>,
Joel Stanley <joel@jms.id.au>,
Andrew Jeffery <andrew@codeconstruct.com.au>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
linux-arm-msm@vger.kernel.org,
linux-mediatek@lists.infradead.org,
linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-aspeed@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/4] watchdog: qcom: Propagate errors from optional IRQ lookup
Date: Sun, 9 Aug 2026 07:54:02 -0700 [thread overview]
Message-ID: <ccd8fd7d-4555-4ac5-ae73-c16e98b8edc8@roeck-us.net> (raw)
In-Reply-To: <CAABR9nHu4pt-Rg8Aq0B6KfKFHX+C1xQmMk6=j8jq1Zn-MQ0p6Q@mail.gmail.com>
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
next prev parent reply other threads:[~2026-08-09 14:54 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2026-08-10 2:42 ` Bui Duc Phuc
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=ccd8fd7d-4555-4ac5-ae73-c16e98b8edc8@roeck-us.net \
--to=linux@roeck-us.net \
--cc=andrew@codeconstruct.com.au \
--cc=angelogioacchino.delregno@collabora.com \
--cc=joel@jms.id.au \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-aspeed@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=phucduc.bui@gmail.com \
--cc=wim@linux-watchdog.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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