[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aWiOcrj-1EB4cfO-@zatzit>
Date: Thu, 15 Jan 2026 17:51:30 +1100
From: David Gibson <david@...son.dropbear.id.au>
To: Herve Codina <herve.codina@...tlin.com>
Cc: Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Ayush Singh <ayush@...gleboard.org>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
devicetree-compiler@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, devicetree-spec@...r.kernel.org,
Hui Pu <hui.pu@...ealthcare.com>,
Ian Ray <ian.ray@...ealthcare.com>,
Luca Ceresoli <luca.ceresoli@...tlin.com>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>
Subject: Re: [RFC PATCH 46/77] dtc: Introduce dti_get_marker_label()
On Mon, Jan 12, 2026 at 03:19:36PM +0100, Herve Codina wrote:
> The future introduction of orphan nodes for addons device-tree will lead
> to more than one tree in the addons data. Those trees will be:
> - the classical root tree starting at the root node
> - trees related to orphan nodes
>
> Also, an addon device-tree can have only trees based on orphan nodes. In
> other words an addon device-tree is valid without having the classical
> 'root' tree.
>
> To prepare this change, introduce and use dti_get_marker_label().
>
> dti_get_marker_label() retrieves a marker and its related node and
> property based on the label value. It behaves in the same way as
> get_marker_label() but it works at the struct dt_info level.
>
> It handles the case where a 'root' device-tree is not present and will
> handle orphan nodes trees as soon as they will be introduced.
>
> This introduction doesn't lead to any functional changes.
For all of these functions, if the new one is basically replacing the
old one, don't change the name, just change the signature.
>
> Signed-off-by: Herve Codina <herve.codina@...tlin.com>
> ---
> checks.c | 5 ++---
> dtc.h | 4 ++--
> livetree.c | 18 +++++++++++++++++-
> 3 files changed, 21 insertions(+), 6 deletions(-)
>
> diff --git a/checks.c b/checks.c
> index 75040c0..0a855f9 100644
> --- a/checks.c
> +++ b/checks.c
> @@ -439,7 +439,6 @@ static void check_duplicate_label(struct check *c, struct dt_info *dti,
> const char *label, struct node *node,
> struct property *prop, struct marker *mark)
> {
> - struct node *dt = dti->dt;
> struct node *othernode = NULL;
> struct property *otherprop = NULL;
> struct marker *othermark = NULL;
> @@ -449,8 +448,8 @@ static void check_duplicate_label(struct check *c, struct dt_info *dti,
> if (!othernode)
> otherprop = dti_get_property_by_label(dti, label, &othernode);
> if (!othernode)
> - othermark = get_marker_label(dt, label, &othernode,
> - &otherprop);
> + othermark = dti_get_marker_label(dti, label, &othernode,
> + &otherprop);
>
> if (!othernode)
> return;
> diff --git a/dtc.h b/dtc.h
> index 399e7fa..d45a84c 100644
> --- a/dtc.h
> +++ b/dtc.h
> @@ -318,8 +318,6 @@ const char *get_unitname(struct node *node);
> struct property *get_property(struct node *node, const char *propname);
> cell_t propval_cell(struct property *prop);
> cell_t propval_cell_n(struct property *prop, unsigned int n);
> -struct marker *get_marker_label(struct node *tree, const char *label,
> - struct node **node, struct property **prop);
> struct node *get_subnode(struct node *node, const char *nodename);
>
> uint32_t guess_boot_cpuid(struct node *tree);
> @@ -358,6 +356,8 @@ cell_t dti_get_node_phandle(struct dt_info *dti, struct node *node);
> struct property *dti_get_property_by_label(struct dt_info *dti,
> const char *label,
> struct node **node);
> +struct marker *dti_get_marker_label(struct dt_info *dti, const char *label,
> + struct node **node, struct property **prop);
>
> /* DTS version flags definitions */
> #define DTSF_V1 0x0001 /* /dts-v1/ */
> diff --git a/livetree.c b/livetree.c
> index d023075..79f7b55 100644
> --- a/livetree.c
> +++ b/livetree.c
> @@ -620,7 +620,7 @@ static struct property *get_property_by_label(struct node *tree, const char *lab
> return NULL;
> }
>
> -struct marker *get_marker_label(struct node *tree, const char *label,
> +static struct marker *get_marker_label(struct node *tree, const char *label,
> struct node **node, struct property **prop)
> {
> struct marker *m;
> @@ -853,6 +853,22 @@ struct property *dti_get_property_by_label(struct dt_info *dti,
> return NULL;
> }
>
> +struct marker *dti_get_marker_label(struct dt_info *dti, const char *label,
> + struct node **node, struct property **prop)
> +{
> + struct marker *marker;
> +
> + if (dti->dt) {
> + marker = get_marker_label(dti->dt, label, node, prop);
> + if (marker)
> + return marker;
> + }
> +
> + *prop = NULL;
> + *node = NULL;
> + return NULL;
> +}
> +
> static void add_phandle_property(struct node *node,
> const char *name, int format)
> {
> --
> 2.52.0
>
>
--
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
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists