From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: "Guenter Roeck" <linux@roeck-us.net>
Cc: "Wim Van Sebroeck" <wim@linux-watchdog.org>,
<linux-watchdog@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] watchdog: take all OF aliases into account when assigning id
Date: Mon, 13 Jul 2026 16:35:07 +0200 [thread overview]
Message-ID: <87se5nrm90.fsf@rasmusvillemoes.dk> (raw)
In-Reply-To: <15a059c9-b922-4d10-9ee2-3f362b5b603c@roeck-us.net> (Guenter Roeck's message of "Wed, 08 Jul 2026 07:53:46 -0700")
On Wed, Jul 08 2026, "Guenter Roeck" <linux@roeck-us.net> wrote:
> On Mon, Jun 15, 2026 at 04:57:59PM +0200, Rasmus Villemoes wrote:
>> If some, but not all, watchdog devices have device tree aliases, those
>> without aliases might (depending on probe order) be assigned an id
>> which would otherwise be assigned to one of those with an alias.
>>
>> This is problematic when for example watchdog0 is an alias for an
>> always-running gpio watchdog that userspace must handle, but the SOC's
>> watchdog device(s) get probed first and thus one of those become
>> /dev/watchdog0.
>>
>> Ensure that ids for devices without a device tree alias are allocated
>> from above the highest numbered alias, if any.
>>
>> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
>> ---
>>
>> This is similar to how the mmc, i2c, i3c and spi subsystems handle
>> device tree aliases and avoid using an id that might be assigned to a
>> device/bus that is probed later.
>
> The patch makes sense. Unfortunately, there are systems with aliased
> watchdogs which do not enable "watchdog0" (e.g., several Nuvoton based
> boards). On such systems, if they do have an unaliased / auto-generated
> watchdog, /dev/watchdog0 and with it /dev/watchdog would no longer be
> created. This would result in a ABI break.
>
> On top of that, the patch only affects systems with both aliased and
> un-aliased watchdogs, which makes me even more concerned.
Well, yes, the problem only occurs on exactly such systems.
- If all enabled watchdog devices have DT aliases, they all get their
assigned id.
- If no wathcdog device has a DT alias, they'll just get sequentially
assigned ids in probe order, and none of them will "accidentally" get an
id that should be assigned to a device with a DT alias.
> To apply this or a similar patch, we would have to ensure that there
> is no enabled watchdog with ID == 0.
I'm not sure I completely understand your concern(s), but I can see that
if there is any watchdog DT alias, we'll never use id 0 except if there
is a watchdog0 DT alias (and that device is actually enabled).
What if instead of assigning dynamic ids from above the highest existing
alias, we assign a dynamic id as usual, but skip existing aliases? So if
there's a watchdog1 alias, but no watchdog0 alias, the first unaliased
watchdog device being probed would become /dev/watchdog0 and hence
/dev/watchdog. Would that work?
Rasmus
next prev parent reply other threads:[~2026-07-13 14:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-15 14:57 Rasmus Villemoes
2026-07-08 14:53 ` Guenter Roeck
2026-07-13 14:35 ` Rasmus Villemoes [this message]
2026-07-13 15:48 ` Guenter Roeck
2026-07-14 11:08 ` Rasmus Villemoes
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=87se5nrm90.fsf@rasmusvillemoes.dk \
--to=linux@rasmusvillemoes.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--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
Powered by JetHome