All of lore.kernel.org
 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 v2 6/6] doc: dts-format: Describe later definitions and deletes
Date: Wed, 28 Oct 2026 19:25:18 +0100	[thread overview]
Message-ID: <20261028192518.534ab384@bootlin.com> (raw)
In-Reply-To: <20261028093620.3705074-7-sjg@chromium.org>

On Wed, 28 Oct 2026 03:36:13 -0600
Simon Glass <sjg@chromium.org> wrote:

> dts-format.txt does not say that a node can be defined more than once,
> nor describe /delete-property/ and /delete-node/, so the rules for
> deletes in the earlier patches are not written down anywhere.
> 
> Add a section on how later definitions are merged and how deletes
> behave: within a definition, before a node or property is defined
> again, and in an overlay.
> 
> Assisted-by: Claude:claude-opus-5-5
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
> Changes in v2:
> - Add new patch to document deletes
> 
>  Documentation/dts-format.txt | 44 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 44 insertions(+)
> 
> diff --git a/Documentation/dts-format.txt b/Documentation/dts-format.txt
> index 41741df..d594822 100644
> --- a/Documentation/dts-format.txt
> +++ b/Documentation/dts-format.txt
> @@ -116,6 +116,50 @@ Version 1 DTS files have the overall layout:
>  * C style (/* ... */) and C++ style (// ...) comments are supported.
>  
>  
> +Later definitions and deletes
> +-----------------------------
> +
> +A node may be defined more than once, for example in an included file
> +and again in the file which includes it. A later definition refers to
> +the node by '&' followed by its label or full path in braces, or
> +repeats the path from the root. The definitions are merged in source
> +order: a property which is defined again takes the new value, and new
> +properties and child nodes are added.
> +
> +	e.g. / {
> +		serial: serial@1000 {
> +			status = "disabled";
> +			clock-frequency = <100000000>;
> +		};
> +	     };
> +
> +	     &serial {
> +		status = "okay";
> +		/delete-property/ clock-frequency;
> +	     };
> +
> +Within a node definition, a property or child node can be removed with:
> +	/delete-property/ property-name;
> +	/delete-node/ node-name;
> +and outside any node, a node can be removed with:
> +	/delete-node/ &label;
> +
> +* A delete removes the property or node as defined so far, including
> +  earlier in the same node definition, but not one defined after it.
> +  Outside an overlay, a delete within a node definition with nothing to
> +  remove is ignored.
> +
> +* A property or node which is deleted and then defined again comes
> +  after the existing ones, like any new property or node. A node defined
> +  again has only the properties and child nodes of its new definition.
> +
> +* In an overlay (a file with /plugin/), a delete can only remove
> +  something defined earlier in the same fragment, i.e. the same
> +  &label { ... } or &{/path} { ... }. An overlay cannot delete anything
> +  from the tree it is applied to, so dtc reports an error for a delete
> +  with nothing to remove in its fragment.
> +
> +

Not so sure:
--- 8< ---
/plugin/

&target1 {
	node: node1 {
		...
	};
};

/delete-node/ &node;  <--- It is not defined in the *same* fragment
--- 8< ---

Agree that an overlay cannot delete something in the tree it is applied to.
But /delete-node/ can be outside any fragments and delete something in a
fragment.

Best regards,
Hervé

  reply	other threads:[~2026-10-28 18:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-28  9:36 [PATCH v2 0/6] dtc: Fix deletes within a section and before a redefinition Simon Glass
2026-10-28  9:36 ` [PATCH v2 1/6] dtc: Apply deletes in the section which has them Simon Glass
2026-10-28  9:36 ` [PATCH v2 2/6] dtc: Remove a deleted node or property from the tree Simon Glass
2026-10-28  9:36 ` [PATCH v2 3/6] dtc: Clarify when delete placeholders are dropped Simon Glass
2026-10-28 17:56   ` Herve Codina
2026-10-29  8:59     ` Simon Glass
2026-10-28  9:36 ` [PATCH v2 4/6] tests: Allow dtc-fatal.sh to check the error message Simon Glass
2026-10-28 18:02   ` Herve Codina
2026-10-29  7:21   ` Herve Codina
2026-10-29  9:01     ` Simon Glass
2026-10-28  9:36 ` [PATCH v2 5/6] dtc: Report an error for a delete in an overlay fragment Simon Glass
2026-10-28 18:17   ` Herve Codina
2026-10-29  9:04     ` Simon Glass
2026-10-28  9:36 ` [PATCH v2 6/6] doc: dts-format: Describe later definitions and deletes Simon Glass
2026-10-28 18:25   ` Herve Codina [this message]
2026-10-29  9:06     ` Simon Glass
2026-10-29  2:49 ` [PATCH v2 0/6] dtc: Fix deletes within a section and before a redefinition David Gibson

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=20261028192518.534ab384@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 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.