Re: [PATCH 1/5] dtc: Allow path fixups in overlays

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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@xxxxxxxxxxxxxxx>
> > > ---
> > >   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: signature.asc
Description: PGP signature


[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux