Devicetree Compiler
 help / color / mirror / Atom feed
From: Herve Codina <herve.codina@bootlin.com>
To: Simon Glass <sjg@chromium.org>
Cc: Devicetree Compiler <devicetree-compiler@vger.kernel.org>,
	David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [PATCH 2/2] dtc: Remove a deleted node or property from the tree
Date: Tue, 27 Oct 2026 08:45:37 +0100	[thread overview]
Message-ID: <20261027084537.49cb1dcb@bootlin.com> (raw)
In-Reply-To: <20261026173529.3080952-3-sjg@chromium.org>

Hi Simon,

On Mon, 26 Oct 2026 11:35:20 -0600
Simon Glass <sjg@chromium.org> wrote:

> Deleting a node or property only flags it as deleted, leaving it in
> place. If a later section adds it again, merge_nodes() finds the flagged
> entry and revives it where it was, along with its subnodes, which come
> back in their old order before any new ones. So deleting a node in
> order to redefine it does not give the order which the source shows.
> 
> Unlink a node or property from its parent when deleting it, so that
> adding it again creates a new entry after the existing ones. Nothing
> deleted then stays in the tree while parsing, so merge_nodes() has
> nothing to revive and can skip deleted entries like everything else.
> 
> Leave the node's next_sibling alone, since fixup_omit_unused_nodes()
> deletes nodes while walking over their siblings.
> 
> Note that this changes the output of existing dts files. When a dts
> deletes a node or property and then defines it again, the new definition
> now comes after its siblings instead of taking the old one's place, and
> its subnodes come in the order of the new definition alone.

Yes, makes sense.

> 
> This is the better behaviour because:
> 
> - Deleting is how a dts says to start again. A dts which wants to keep a
>   node's place can override the node without deleting it, since merging
>   already updates a node in place
> - Node order can matter. In issue 174, U-Boot's binman builds an image
>   from a node which is deleted and defined again, yet the image comes
>   out in the old order. The only workaround is to define the nodes in
>   the wanted order before including the file which defines them
> - It matches the previous patch, in which a node deleted and defined
>   again within a section, or deleted in the first section and defined
>   by a later one, already comes out where the new definition is
> 
> Closes: https://github.com/dgibson/dtc/issues/174
> Assisted-by: Claude:claude-opus-5-5
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---

LGTM.

Reviewed-by: Herve Codina <herve.codina@bootlin.com>

Best regards,
Hervé

      reply	other threads:[~2026-10-27  7:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26 17:35 [PATCH 0/2] dtc: Fix deletes within a section and before a redefinition Simon Glass
2026-10-26 17:35 ` [PATCH 1/2] dtc: Apply deletes in the section which has them Simon Glass
2026-10-27  7:41   ` Herve Codina
2026-10-28  3:47   ` David Gibson
2026-10-26 17:35 ` [PATCH 2/2] dtc: Remove a deleted node or property from the tree Simon Glass
2026-10-27  7:45   ` Herve Codina [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=20261027084537.49cb1dcb@bootlin.com \
    --to=herve.codina@bootlin.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=devicetree-compiler@vger.kernel.org \
    --cc=sjg@chromium.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