Re: [RFC PATCH v2 35/74] checks: Get 'chosen' node using get_subnode()

From: David Gibson

Date: Wed Nov 25 2026 - 21:52:39 EST


On Wed, Nov 25, 2026 at 01:21:29PM +0100, Herve Codina wrote:
> hi David,
>
> On Wed, 25 Nov 2026 20:19:04 +1100
> David Gibson <david@xxxxxxxxxxxxxxxxxxxxx> wrote:
>
> > On Wed, Aug 26, 2026 at 11:49:04AM +0200, Herve Codina wrote:
> > > get_node_by_path() is going to be updated in order to handle orphan node
> > > support for addon device-tree.
> > >
> > > The 'chosen' node is a subnode of the root node and can perfectly be
> > > retrieved using get_subnode().
> >
> > The change certainly shouldn't break anything, but I don't really
> > understand the rationale for it. AIUI, get_node_by_path() should
> > still work, even if it's (trivially) more expensive.
>
> Removing the get_node_by_path() call here avoid a later modification when
> get_node_by_path() is changed.

Ok, "an upcoming change will be made simpler by avoiding
get_node_by_path()" is a reasonable thing to put into the commit message.

> The code can use get_subnode() here. I thought that using it was more relevant
> here (getting the 'choosen' sub-node from the root node) than using the more
> generic get_node_by_path() function.
>
> Well, if you prefer the get_node_by_path() call here, no problem, I can
> revert this change.
>
> Best regards,
> Hervé
>
> >
> >
> > > In preparation of the future change related to get_node_by_path(),
> > > replace its usage to get the 'chosen' node by a call to get_subnode().
> > >
> > > The modification doesn't introduce any functional changes.
> > >
> > > Signed-off-by: Herve Codina <herve.codina@xxxxxxxxxxx>
> > > ---
> > > checks.c | 3 +--
> > > 1 file changed, 1 insertion(+), 2 deletions(-)
> > >
> > > diff --git a/checks.c b/checks.c
> > > index 13e8b121..1332acc4 100644
> > > --- a/checks.c
> > > +++ b/checks.c
> > > @@ -1349,8 +1349,7 @@ static void check_obsolete_chosen_interrupt_controller(struct check *c,
> > > if (node != dt)
> > > return;
> > >
> > > -
> > > - chosen = get_node_by_path(dt, "/chosen");
> > > + chosen = get_subnode(dt, "chosen");
> > > if (!chosen)
> > > return;
> > >
> > > --
> > > 2.55.0
> > >
> > >
> >
>
>
>
> --
> Hervé Codina, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>

--
David Gibson (he or they) | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you, not the other way
| around.
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature