devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Ayush Singh <ayush@beagleboard.org>
Cc: d-gole@ti.com, lorforlinux@beagleboard.org,
	jkridner@beagleboard.org, robertcnelson@beagleboard.org,
	nenad.marinkovic@mikroe.com, Andrew Davis <afd@ti.com>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Robert Nelson <robertcnelson@gmail.com>,
	devicetree-compiler@vger.kernel.org
Subject: Re: [PATCH 1/5] dtc: Allow path fixups in overlays
Date: Wed, 4 Dec 2024 11:35:01 +1100	[thread overview]
Message-ID: <Z0-jtUTp9qn0WAVr@zatzit> (raw)
In-Reply-To: <b34fa351-ba29-4e40-8ffa-69d40cdbb3c4@beagleboard.org>

[-- Attachment #1: Type: text/plain, Size: 3791 bytes --]

On Tue, Dec 03, 2024 at 12:59:28PM +0530, Ayush Singh wrote:
> On 03/12/24 09:47, David Gibson wrote:
> > On Sat, Nov 16, 2024 at 08:30:19PM +0530, Ayush Singh wrote:
> > > Enable generating fixups entries for path references. These are the same
> > > as the entries for phandles.
> > > 
> > > Path properties have empty value in generated overlay. This allows easy
> > > differentiation between path references (size > 0) and path references
> > > (size == 0).
> > > 
> > > Signed-off-by: Ayush Singh <ayush@beagleboard.org>
> > > ---
> > >   checks.c   |  6 ++++--
> > >   livetree.c | 19 +++++++++++++++++--
> > >   2 files changed, 21 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/checks.c b/checks.c
> > > index 6e06aeab5503f78c8a969f8d1d0e96be7b91749e..1ec59c6a1be375e1695b68203a0782cf23ee33fa 100644
> > > --- a/checks.c
> > > +++ b/checks.c
> > > @@ -651,8 +651,10 @@ static void fixup_path_references(struct check *c, struct dt_info *dti,
> > >   			refnode = get_node_by_ref(dt, m->ref);
> > >   			if (!refnode) {
> > > -				FAIL(c, dti, node, "Reference to non-existent node or label \"%s\"\n",
> > > -				     m->ref);
> > > +				if (!(dti->dtsflags & DTSF_PLUGIN))
> > > +					FAIL(c, dti, node,
> > > +					     "Reference to non-existent node or label \"%s\"\n",
> > > +					     m->ref);
> > >   				continue;
> > >   			}
> > > diff --git a/livetree.c b/livetree.c
> > > index 49f723002f855764452b30b5a979b6096730a33b..4e26d378e09407d6a395c2f1bbd73c1874de4ae0 100644
> > > --- a/livetree.c
> > > +++ b/livetree.c
> > > @@ -908,6 +908,13 @@ static bool any_fixup_tree(struct dt_info *dti, struct node *node)
> > >   			if (!get_node_by_ref(dti->dt, m->ref))
> > >   				return true;
> > >   		}
> > > +		m = prop->val.markers;
> > > +		for_each_marker_of_type(m, REF_PATH)
> > > +		{
> > 
> > Opening brace goes on the same line as the for_each()
> > 
> > > +			if (m->ref) {
> > 
> > 
> > As for phandle references, you don't need to emit a fixup if the
> > reference can be resolved within the current tree, so you want a
> > get_node_by_ref() before returning true.
> > 
> > > +				return true;
> > > +			}
> > 
> > No braces around single statements in dtc style.
> 
> Is there any clang-format config or something for dtc? I am currently using
> the format config from Linux kernel.

No, sorry.  Using the one from the kernel should be very close.

> 
> > 
> > > +		}
> > >   	}
> > >   	for_each_child(node, c) {
> > > @@ -924,8 +931,8 @@ static void add_fixup_entry(struct dt_info *dti, struct node *fn,
> > >   {
> > >   	char *entry;
> > > -	/* m->ref can only be a REF_PHANDLE, but check anyway */
> > > -	assert(m->type == REF_PHANDLE);
> > > +	/* m->ref can only be a REF_PHANDLE or REF_PATH, but check anyway */
> > > +	assert(m->type == REF_PHANDLE || m->type == REF_PATH);
> > >   	/* The format only permits fixups for references to label, not
> > >   	 * references to path */
> > > @@ -961,6 +968,14 @@ static void generate_fixups_tree_internal(struct dt_info *dti,
> > >   			if (!refnode)
> > >   				add_fixup_entry(dti, fn, node, prop, m);
> > >   		}
> > > +
> > > +		m = prop->val.markers;
> > > +		for_each_marker_of_type(m, REF_PATH)
> > > +		{
> > > +			refnode = get_node_by_ref(dt, m->ref);
> > > +			if (!refnode)
> > > +				add_fixup_entry(dti, fn, node, prop, m);
> > > +		}
> > 
> > I don't see how phandle fixups are distinguished from path fixups.
> > 
> > >   	}
> > >   	for_each_child(node, c)
> > > 
> > 
> 
> Ayush Singh
> 
> 

-- 
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 --]

  parent reply	other threads:[~2024-12-04  0:36 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-16 15:00 [PATCH 0/5] Add support for resolving path references in overlays Ayush Singh
2024-11-16 15:00 ` [PATCH 1/5] dtc: Allow path fixups " Ayush Singh
2024-12-03  4:17   ` David Gibson
2024-12-03  7:29     ` Ayush Singh
2024-12-03  8:14       ` Geert Uytterhoeven
2024-12-03  8:44         ` Ayush Singh
2024-12-04  0:36           ` David Gibson
2024-12-04  0:35       ` David Gibson [this message]
2024-11-16 15:00 ` [PATCH 2/5] libfdt: Add namelen variants for setprop Ayush Singh
2024-12-03  4:12   ` David Gibson
2024-12-03  7:31     ` Ayush Singh
2024-11-16 15:00 ` [PATCH 3/5] fdtoverlay: Implement resolving path references Ayush Singh
2024-12-03  4:37   ` David Gibson
2024-11-16 15:00 ` [PATCH 4/5] tests: Fix overlay tests Ayush Singh
2024-12-03  4:38   ` David Gibson
2024-11-16 15:00 ` [PATCH 5/5] tests: Add path tests for overlay Ayush Singh
2024-12-03  4:46   ` David Gibson
2024-12-14  4:45     ` Ayush Singh
2024-12-26  6:33       ` David Gibson
2024-11-16 15:07 ` [PATCH 0/5] Add support for resolving path references in overlays Ayush Singh

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=Z0-jtUTp9qn0WAVr@zatzit \
    --to=david@gibson.dropbear.id.au \
    --cc=afd@ti.com \
    --cc=ayush@beagleboard.org \
    --cc=d-gole@ti.com \
    --cc=devicetree-compiler@vger.kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=jkridner@beagleboard.org \
    --cc=lorforlinux@beagleboard.org \
    --cc=nenad.marinkovic@mikroe.com \
    --cc=robertcnelson@beagleboard.org \
    --cc=robertcnelson@gmail.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).