Re: [PATCH] checks: Error on node-name and property name being the same

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




> On Feb 9, 2021, at 6:08 PM, David Gibson <david@xxxxxxxxxxxxxxxxxxxxx> wrote:
> 
> On Tue, Feb 09, 2021 at 11:50:59AM -0600, Kumar Gala wrote:
>> Treat a node-name and property name at the same level of tree as
>> an error.
>> 
>> Signed-off-by: Kumar Gala <kumar.gala@xxxxxxxxxx>
> 
> Nack.  Discouraging/banning this at the spec level for future trees is
> reasonable.  But dtc should be able to handle old trees that *do* have
> node/property conflicts as well.

Then we can make this a warning instead of an error.  Or a user is always about to disable this via the ’no-…’ command line option.

- k

> 
>> ---
>> checks.c | 18 +++++++++++++++++-
>> 1 file changed, 17 insertions(+), 1 deletion(-)
>> 
>> diff --git a/checks.c b/checks.c
>> index 17cb689..3f46043 100644
>> --- a/checks.c
>> +++ b/checks.c
>> @@ -330,6 +330,22 @@ static void check_node_name_format(struct check *c, struct dt_info *dti,
>> }
>> ERROR(node_name_format, check_node_name_format, NULL, &node_name_chars);
>> 
>> +static void check_node_name_vs_property_name(struct check *c,
>> +					     struct dt_info *dti,
>> +					     struct node *node)
>> +{
>> +	struct property *prop;
>> +
>> +	if (node->parent) {
>> +		for_each_property(node->parent, prop) {
>> +			if (strcmp(node->name, prop->name) == 0)
>> +				FAIL(c, dti, node, "node name and property name conflict");
>> +		}
>> +	}
>> +}
>> +ERROR(node_name_vs_property_name, check_node_name_vs_property_name,
>> +      NULL, &node_name_chars);
>> +
>> static void check_unit_address_vs_reg(struct check *c, struct dt_info *dti,
>> 				      struct node *node)
>> {
>> @@ -1796,7 +1812,7 @@ WARNING(graph_endpoint, check_graph_endpoint, NULL, &graph_nodes);
>> static struct check *check_table[] = {
>> 	&duplicate_node_names, &duplicate_property_names,
>> 	&node_name_chars, &node_name_format, &property_name_chars,
>> -	&name_is_string, &name_properties,
>> +	&name_is_string, &name_properties, &node_name_vs_property_name,
>> 
>> 	&duplicate_label,
>> 
> 
> -- 
> 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





[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