All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] checks: Error on node-name and property name being the same
@ 2021-02-09 17:50 Kumar Gala
       [not found] ` <20210209175059.60057-1-kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Kumar Gala @ 2021-02-09 17:50 UTC (permalink / raw)
  To: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA,
	rob.herring-5wv7dgnIgG8, david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+
  Cc: Kumar Gala

Treat a node-name and property name at the same level of tree as
an error.

Signed-off-by: Kumar Gala <kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
 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,
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] checks: Error on node-name and property name being the same
       [not found] ` <20210209175059.60057-1-kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2021-02-09 18:29   ` Rob Herring
  2021-02-10  0:08   ` David Gibson
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Rob Herring @ 2021-02-09 18:29 UTC (permalink / raw)
  To: Kumar Gala; +Cc: Devicetree Compiler, Rob Herring, David Gibson

On Tue, Feb 9, 2021 at 12:06 PM Kumar Gala <kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
>
> Treat a node-name and property name at the same level of tree as
> an error.
>
> Signed-off-by: Kumar Gala <kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
>  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) {

To save some indentation:

if (!node->parent)
  return;

> +               for_each_property(node->parent, prop) {
> +                       if (strcmp(node->name, prop->name) == 0)

streq() is the dtc way.

> +                               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,
>
> --
> 2.29.2
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] checks: Error on node-name and property name being the same
       [not found] ` <20210209175059.60057-1-kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  2021-02-09 18:29   ` Rob Herring
@ 2021-02-10  0:08   ` David Gibson
       [not found]     ` <20210210000827.GB4450-l+x2Y8Cxqc4e6aEkudXLsA@public.gmane.org>
  2021-02-10  4:15   ` [PATCH v3] checks: Warn " Kumar Gala
  2021-02-10 19:39   ` [PATCH v4] " Kumar Gala
  3 siblings, 1 reply; 9+ messages in thread
From: David Gibson @ 2021-02-10  0:08 UTC (permalink / raw)
  To: Kumar Gala
  Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA, rob.herring-5wv7dgnIgG8

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

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-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

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.

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] checks: Error on node-name and property name being the same
       [not found]     ` <20210210000827.GB4450-l+x2Y8Cxqc4e6aEkudXLsA@public.gmane.org>
@ 2021-02-10  1:33       ` Kumar Gala
       [not found]         ` <035E7DE0-A9AC-4738-81CD-034784754B07-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Kumar Gala @ 2021-02-10  1:33 UTC (permalink / raw)
  To: David Gibson
  Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA, rob.herring-5wv7dgnIgG8



> On Feb 9, 2021, at 6:08 PM, David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org> 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-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> 
> 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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] checks: Error on node-name and property name being the same
       [not found]         ` <035E7DE0-A9AC-4738-81CD-034784754B07-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2021-02-10  1:57           ` David Gibson
  0 siblings, 0 replies; 9+ messages in thread
From: David Gibson @ 2021-02-10  1:57 UTC (permalink / raw)
  To: Kumar Gala
  Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA, rob.herring-5wv7dgnIgG8

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

On Tue, Feb 09, 2021 at 07:33:05PM -0600, Kumar Gala wrote:
> 
> 
> > On Feb 9, 2021, at 6:08 PM, David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org> 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-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> > 
> > 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.

A warning would be ok.

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v3] checks: Warn on node-name and property name being the same
       [not found] ` <20210209175059.60057-1-kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  2021-02-09 18:29   ` Rob Herring
  2021-02-10  0:08   ` David Gibson
@ 2021-02-10  4:15   ` Kumar Gala
       [not found]     ` <20210210041510.382114-1-kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  2021-02-10 19:39   ` [PATCH v4] " Kumar Gala
  3 siblings, 1 reply; 9+ messages in thread
From: Kumar Gala @ 2021-02-10  4:15 UTC (permalink / raw)
  To: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA,
	rob.herring-5wv7dgnIgG8, david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+
  Cc: Kumar Gala

Treat a node-name and property name at the same level of tree as
a warning

Signed-off-by: Kumar Gala <kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
 checks.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/checks.c b/checks.c
index 17cb689..7f9e670 100644
--- a/checks.c
+++ b/checks.c
@@ -330,6 +330,23 @@ 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)
+		return;
+
+	for_each_property(node->parent, prop) {
+		if (streq(node->name, prop->name))
+			FAIL(c, dti, node, "node name and property name conflict");
+	}
+}
+WARNING(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 +1813,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,
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v3] checks: Warn on node-name and property name being the same
       [not found]     ` <20210210041510.382114-1-kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2021-02-10  4:49       ` David Gibson
  0 siblings, 0 replies; 9+ messages in thread
From: David Gibson @ 2021-02-10  4:49 UTC (permalink / raw)
  To: Kumar Gala
  Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA, rob.herring-5wv7dgnIgG8

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

On Tue, Feb 09, 2021 at 10:15:10PM -0600, Kumar Gala wrote:
> Treat a node-name and property name at the same level of tree as
> a warning
> 
> Signed-off-by: Kumar Gala <kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
>  checks.c | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/checks.c b/checks.c
> index 17cb689..7f9e670 100644
> --- a/checks.c
> +++ b/checks.c
> @@ -330,6 +330,23 @@ 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)
> +		return;
> +
> +	for_each_property(node->parent, prop) {
> +		if (streq(node->name, prop->name))
> +			FAIL(c, dti, node, "node name and property name conflict");
> +	}

This seems a somewhat roundabout way of detecting this.  Instead of
having a check for "sibling" properties of the same name, why not just do:

	for_each_subnode(...) {
		if (get_property(node, subnode->name))
			FAIL(..., "Has both subnode and property named %s", subnode->name);
	}


> +}
> +WARNING(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 +1813,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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v4] checks: Warn on node-name and property name being the same
       [not found] ` <20210209175059.60057-1-kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
                     ` (2 preceding siblings ...)
  2021-02-10  4:15   ` [PATCH v3] checks: Warn " Kumar Gala
@ 2021-02-10 19:39   ` Kumar Gala
       [not found]     ` <20210210193912.799544-1-kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  3 siblings, 1 reply; 9+ messages in thread
From: Kumar Gala @ 2021-02-10 19:39 UTC (permalink / raw)
  To: David Gibson, rob.herring-5wv7dgnIgG8, Devicetree Compiler; +Cc: Kumar Gala

Treat a node-name and property name at the same level of tree as
a warning

Signed-off-by: Kumar Gala <kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
 checks.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/checks.c b/checks.c
index 48e7fe9..c420772 100644
--- a/checks.c
+++ b/checks.c
@@ -331,6 +331,20 @@ 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)
+{
+	if (!node->parent)
+		return;
+
+	if (get_property(node->parent, node->name)) {
+		FAIL(c, dti, node, "node name and property name conflict");
+	}
+}
+WARNING(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)
 {
@@ -1797,7 +1811,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,
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v4] checks: Warn on node-name and property name being the same
       [not found]     ` <20210210193912.799544-1-kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2021-02-15  6:17       ` David Gibson
  0 siblings, 0 replies; 9+ messages in thread
From: David Gibson @ 2021-02-15  6:17 UTC (permalink / raw)
  To: Kumar Gala; +Cc: rob.herring-5wv7dgnIgG8, Devicetree Compiler

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

On Wed, Feb 10, 2021 at 01:39:12PM -0600, Kumar Gala wrote:
> Treat a node-name and property name at the same level of tree as
> a warning

Applied, thanks.

> 
> Signed-off-by: Kumar Gala <kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
>  checks.c | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/checks.c b/checks.c
> index 48e7fe9..c420772 100644
> --- a/checks.c
> +++ b/checks.c
> @@ -331,6 +331,20 @@ 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)
> +{
> +	if (!node->parent)
> +		return;
> +
> +	if (get_property(node->parent, node->name)) {
> +		FAIL(c, dti, node, "node name and property name conflict");
> +	}
> +}
> +WARNING(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)
>  {
> @@ -1797,7 +1811,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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-02-15  6:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-09 17:50 [PATCH] checks: Error on node-name and property name being the same Kumar Gala
     [not found] ` <20210209175059.60057-1-kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2021-02-09 18:29   ` Rob Herring
2021-02-10  0:08   ` David Gibson
     [not found]     ` <20210210000827.GB4450-l+x2Y8Cxqc4e6aEkudXLsA@public.gmane.org>
2021-02-10  1:33       ` Kumar Gala
     [not found]         ` <035E7DE0-A9AC-4738-81CD-034784754B07-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2021-02-10  1:57           ` David Gibson
2021-02-10  4:15   ` [PATCH v3] checks: Warn " Kumar Gala
     [not found]     ` <20210210041510.382114-1-kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2021-02-10  4:49       ` David Gibson
2021-02-10 19:39   ` [PATCH v4] " Kumar Gala
     [not found]     ` <20210210193912.799544-1-kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2021-02-15  6:17       ` David Gibson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.