From: David Gibson <david@gibson.dropbear.id.au>
To: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Cc: devicetree-compiler@vger.kernel.org
Subject: Re: [PATCH 4/6] Restore labels from __symbols__ node
Date: Thu, 21 Aug 2025 14:25:06 +1000 [thread overview]
Message-ID: <aKafognYFAUlPS-V@zatzit> (raw)
In-Reply-To: <79aef5658c9105c6d6891fcdf930e5a073a06699.1755692822.git.u.kleine-koenig@baylibre.com>
[-- Attachment #1: Type: text/plain, Size: 2581 bytes --]
On Wed, Aug 20, 2025 at 03:11:30PM +0200, Uwe Kleine-König wrote:
> If the input has a __symbols__ node, restore the named labels for the
> respective nodes.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> dtc.c | 2 ++
> dtc.h | 1 +
> livetree.c | 21 +++++++++++++++++++++
> 3 files changed, 24 insertions(+)
>
> diff --git a/dtc.c b/dtc.c
> index b3445b7d6473..63a6c85da5cf 100644
> --- a/dtc.c
> +++ b/dtc.c
> @@ -338,6 +338,8 @@ int main(int argc, char *argv[])
> if (auto_label_aliases)
> generate_label_tree(dti, "aliases", false);
>
> + generate_labels_from_tree(dti, "__symbols__");
> +
> if (generate_symbols)
> generate_label_tree(dti, "__symbols__", true);
>
> diff --git a/dtc.h b/dtc.h
> index 3a220b9afc99..f97f3c29e2d4 100644
> --- a/dtc.h
> +++ b/dtc.h
> @@ -339,6 +339,7 @@ struct dt_info *build_dt_info(unsigned int dtsflags,
> struct reserve_info *reservelist,
> struct node *tree, uint32_t boot_cpuid_phys);
> void sort_tree(struct dt_info *dti);
> +void generate_labels_from_tree(struct dt_info *dti, const char *name);
> void generate_label_tree(struct dt_info *dti, const char *name, bool allocph);
> void generate_fixups_tree(struct dt_info *dti, const char *name);
> void generate_local_fixups_tree(struct dt_info *dti, const char *name);
> diff --git a/livetree.c b/livetree.c
> index f328824c3bc6..8aafc9aa5cd6 100644
> --- a/livetree.c
> +++ b/livetree.c
> @@ -1112,6 +1112,27 @@ static int generate_local_fixups_tree_internal(struct dt_info *dti,
> return ret;
> }
>
> +void generate_labels_from_tree(struct dt_info *dti, const char *name)
> +{
> + struct node *an;
> + struct property *p;
> +
> + an = get_subnode(dti->dt, name);
> + if (!an)
> + return;
> +
> + for_each_property(an, p) {
> + struct node *labeled_node;
> +
> + labeled_node = get_node_by_path(dti->dt, p->val.val);
> + if (labeled_node)
> + add_label(&labeled_node->labels, p->name);
> + else if (quiet < 1)
> + fprintf(stderr, "Warning: Path %s referenced in property %s/%s missing",
> + p->val.val, name, p->name);
> + }
> +}
> +
> void generate_label_tree(struct dt_info *dti, const char *name, bool allocph)
> {
> if (!any_label_tree(dti, dti->dt))
--
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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2025-08-21 4:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-20 13:11 [PATCH 0/6] Restore phandles from binary representations Uwe Kleine-König
2025-08-20 13:11 ` [PATCH 1/6] Emit /plugin/ when compiling to .dts with DTSF_PLUGIN set Uwe Kleine-König
2025-08-21 4:24 ` David Gibson
2025-08-20 13:11 ` [PATCH 2/6] Set DTSF_PLUGIN if needed when compiling from dtb Uwe Kleine-König
2025-08-21 4:24 ` David Gibson
2025-08-20 13:11 ` [PATCH 3/6] Improve type guessing when compiling to dts format Uwe Kleine-König
2025-08-21 4:24 ` David Gibson
2025-08-20 13:11 ` [PATCH 4/6] Restore labels from __symbols__ node Uwe Kleine-König
2025-08-21 4:25 ` David Gibson [this message]
2025-08-20 13:11 ` [PATCH 5/6] Restore phandle references from __local_fixups__ node Uwe Kleine-König
2025-08-21 4:23 ` David Gibson
2025-08-20 13:11 ` [PATCH 6/6] Restore phandle references from __fixups__ node Uwe Kleine-König
2025-08-21 4:31 ` 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=aKafognYFAUlPS-V@zatzit \
--to=david@gibson.dropbear.id.au \
--cc=devicetree-compiler@vger.kernel.org \
--cc=u.kleine-koenig@baylibre.com \
/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;
as well as URLs for NNTP newsgroup(s).