Re: [PATCH] dtc: Merge nodes if possible in plugins

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



On Mon, Sep 10, 2018 at 11:55:10PM +0200, Fredrik Markstrom wrote:
> This patch makes it possible to use references to labels in plugins
> without creating additional fragments.
> 
> Previously the dts below would generate two fragments:
> 
> /dts-v1/;
> /plugin/;
> &x { a: a@0 {};};
> &a { b {}; };
> 
> Signed-off-by: Fredrik Markstrom <fredrik.markstrom@xxxxxxxxx>

I've considered a change like this before, and it might be a good
idea.  I'm not certain though, because it does make the mapping
between what appears in the dts and the dtbo a bit less obvious than
it might be otherwise.

Do you have a concrete reason to prefer this approach?

> ---
>  dtc-parser.y | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/dtc-parser.y b/dtc-parser.y
> index dd70ebf..4f2f6dd 100644
> --- a/dtc-parser.y
> +++ b/dtc-parser.y
> @@ -196,13 +196,13 @@ devicetree:
>  			 *   versioninfo plugindecl memreserves devicetree
>  			 * so $-1 is what we want (plugindecl)
>  			 */
> -			if ($<flags>-1 & DTSF_PLUGIN) {
> -				add_orphan_node($1, $3, $2);
> -			} else {
> -				struct node *target = get_node_by_ref($1, $2);
> +			struct node *target = get_node_by_ref($1, $2);
>  
> -				if (target)
> -					merge_nodes(target, $3);
> +			if (target)
> +				merge_nodes(target, $3);
> +			else {
> +				if ($<flags>-1 & DTSF_PLUGIN)
> +					add_orphan_node($1, $3, $2);
>  				else
>  					ERROR(&@2, "Label or path %s not found", $2);
>  			}

-- 
David Gibson			| 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