All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Abdurrahman Hussain <abdurrahman@nexthop.ai>
Cc: Saravana Kannan <saravanak@kernel.org>,
	Frank Rowand <frowand.list@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Shawn Guo <shawnguo@kernel.org>,
	Grant Likely <grant.likely@secretlab.ca>,
	Grant Likely <grant.likely@linaro.org>,
	Pantelis Antoniou <pantelis.antoniou@konsulko.com>,
	David Daney <david.daney@cavium.com>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v8 0/6] of: teach overlay code to keep /aliases in sync
Date: Thu, 5 Nov 2026 06:40:30 -0600	[thread overview]
Message-ID: <20261105124030.GA1449284-robh@kernel.org> (raw)
In-Reply-To: <20261014-nh-of-alias-overlay-v8-0-0f74f05ac762@nexthop.ai>

On Wed, Oct 14, 2026 at 04:17:25PM -0700, Abdurrahman Hussain wrote:
> /aliases entries added by a device-tree overlay are stored in the live
> tree but never enter the global aliases_lookup list that of_alias_scan()
> builds at boot. As a result, of_alias_get_id() returns -ENODEV for
> aliases declared inside overlays, and any driver that relies on
> alias-based numbering (i2c-xiic, spi, tty, mmc, ...) silently loses its
> pinned id and falls back to auto-assignment.
> 
> The gap has been public since 2015 [1] and reproduces trivially: apply
> an overlay that declares e.g. `i2c99 = &foo;`, ask
> of_alias_get_id(foo, "i2c") -> -ENODEV.

[...]

> Overlay aliases colliding with dynamic ids
> ------------------------------------------
> 
> On v7 you raised the question from the 2024 repost of Geert's series
> [2]: an overlay alias can name an id a subsystem has already handed
> out dynamically, because subsystems may pick any number that has no
> alias. I went through what the of_alias_get_id() users do in that
> case, and in every one of them the collision is a loud registration
> failure, never two devices on one number:
> 
>   i2c      i2c_allocate_adapter_id() does idr_alloc(nr, nr + 1), so a
>            taken index gives -EBUSY plus pr_err("adapter '%s': failed
>            to allocate id") and the adapter is not registered.
>   spi      spi_controller_id_alloc(bus_num, bus_num + 1) likewise:
>            WARN() and -EBUSY, controller not registered.
>   serial   serial_port.c sets port->line from the alias;
>            serial_core_add_one_port() returns -EINVAL if that line is
>            already occupied.
> 
> What this series changes is the failure mode for an overlay asking
> for an index a dynamic allocation already took: today the alias is
> ignored and the device quietly gets some other number, which is the
> bug being fixed, since the pinned number was the point of the alias.
> After it, the probe fails and says why. That seems the right
> contract -- an alias is a request for one specific number, and
> refusing it is more useful than pretending it was honored. It is also
> what already happens in the base DT when two aliases name the same
> index, or when a driver calls i2c_add_numbered_adapter() with a taken
> number.

I'd rather have my added device working than refusing to probe because 
some arbitrary device index couldn't be used. There may be some user 
that has a working system today and then this change would break them. 
We can't really have that. I view aliases as a request, not a 
requirement. It's perfectly valid for an OS to just ignore them 
completely. 

I have no issue if we make the failure to use an alias louder, but I 
guess that's not your main issue.

Rob

  parent reply	other threads:[~2026-11-05 12:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14 23:17 [PATCH v8 0/6] of: teach overlay code to keep /aliases in sync Abdurrahman Hussain
2026-10-14 23:17 ` [PATCH v8 1/6] of/overlay: look up absolute target-paths absolutely Abdurrahman Hussain
2026-10-14 23:17 ` [PATCH v8 2/6] of/overlay: return ERR_PTR from dup_and_fixup_symbol_prop() Abdurrahman Hussain
2026-10-14 23:17 ` [PATCH v8 3/6] of: hold a reference on of_aliases during alias path resolution Abdurrahman Hussain
2026-10-14 23:32   ` sashiko-bot
2026-10-14 23:17 ` [PATCH v8 4/6] of: update /aliases lookup on reconfig notifications Abdurrahman Hussain
2026-10-14 23:29   ` sashiko-bot
2026-10-14 23:17 ` [PATCH v8 5/6] of/overlay: rewrite /aliases path values to live-tree paths Abdurrahman Hussain
2026-10-14 23:27   ` sashiko-bot
2026-10-14 23:17 ` [PATCH v8 6/6] of: unittest: cover /aliases updates from overlay apply/revert Abdurrahman Hussain
2026-11-05  0:09 ` [PATCH v8 0/6] of: teach overlay code to keep /aliases in sync Abdurrahman Hussain
2026-11-05 12:40 ` Rob Herring [this message]
2026-11-06  2:11   ` Abdurrahman Hussain
2026-11-06 13:24     ` Rob Herring
2026-11-06 19:51       ` Abdurrahman Hussain
2026-11-12 22:12         ` Rob Herring

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=20261105124030.GA1449284-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=abdurrahman@nexthop.ai \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=david.daney@cavium.com \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=grant.likely@linaro.org \
    --cc=grant.likely@secretlab.ca \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pantelis.antoniou@konsulko.com \
    --cc=saravanak@kernel.org \
    --cc=shawnguo@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.