checks: Error on node-name and property name being the same
PATCH 1/1 checks: Error on node-name and property name being the same
Treat a node-name and property name at the same level of tree as an error.
--- checks.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
checks.c +17 -1
@@ -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,
Signature · 1 line
2.29.2
A message that is not in the archive (sent off-list or not yet received): 20210209175059.60057-1-kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org
Quoted 14 lines · Kumar Gala
Treat a node-name and property name at the same level of tree as an error.
Signed-off-by Kumar Gala <[email protected]>--- checks.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)checks.c +0
-0
checks.c static void check_node_name_format(struct check *c, struct dt_info *dti, · line 339
Quoted 10 lines
checks.c +7
-0@@ -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;
checks.c static void check_node_name_format(struct check *c, struct dt_info *dti, · line 341
Quoted 2 lines
checks.c +2
-0+for_each_property (node->parent, prop) { +if (strcmp (node->name, prop->name) ==0 )
streq() is the dtc way.
Quoted 22 lines
checks.c +8
-2+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
Quoted 4 lines · Kumar Gala
Treat a node-name and property name at the same level of tree as an error.
Signed-off-by Kumar Gala <[email protected]>
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.
Quoted 40 lines
--- checks.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)checks.c +17
-1@@ -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,
Signature · 4 lines
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
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 13 lines · David Gibson
Quoted 4 lines · Kumar Gala
Treat a node-name and property name at the same level of tree as an error.
Signed-off-by Kumar Gala <[email protected]>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
Quoted 47 lines
Quoted 41 lines
---
checks.c| 18 +++++++++++++++++-1 file changed, 17 insertions(+), 1 deletion(-)checks.c +17
-1@@ -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,Signature · 4 lines
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
A message that is not in the archive (sent off-list or not yet received): 035E7DE0-A9AC-4738-81CD-034784754B07-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org
Quoted 8 lines · Kumar Gala
Quoted 8 lines · David Gibson
Quoted 3 lines · Kumar Gala
Treat a node-name and property name at the same level of tree as an error.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Kumar Gala <[email protected]>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.
Quoted 46 lines
- k
Quoted 42 lines
Quoted 41 lines
---
checks.c| 18 +++++++++++++++++-1 file changed, 17 insertions(+), 1 deletion(-)checks.c +17
-1@@ -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,
Signature · 4 lines
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
PATCH v3 1/1 checks: Warn on node-name and property name being the same
In reply to a message not in the archiveTreat a node-name and property name at the same level of tree as a warning
--- checks.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
checks.c +18 -1
@@ -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,
Signature · 1 line
2.29.2
A message that is not in the archive (sent off-list or not yet received): 20210210041510.382114-1-kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org
Re: [PATCH v3] checks: Warn on node-name and property name being the same
Quoted 19 lines · Kumar Gala
Treat a node-name and property name at the same level of tree as a warning
Signed-off-by Kumar Gala <[email protected]>--- checks.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)checks.c +3
-0@@ -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)
checks.c static void check_node_name_format(struct check *c, struct dt_info *dti, · line 345
Quoted 10 lines
checks.c +10
-0+{ +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);
}Quoted 16 lines
checks.c +5
-1+} +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,
Signature · 4 lines
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
PATCH v4 1/1 checks: Warn on node-name and property name being the same
In reply to a message not in the archiveTreat a node-name and property name at the same level of tree as a warning
--- checks.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
checks.c +15 -1
@@ -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,
Signature · 1 line
2.29.2
A message that is not in the archive (sent off-list or not yet received): 20210210193912.799544-1-kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org
David Gibson
AppliedRe: [PATCH v4] checks: Warn on node-name and property name being the same
Quoted 2 lines · Kumar Gala
Treat a node-name and property name at the same level of tree as a warning
Applied, thanks.
Quoted 40 lines
Signed-off-by Kumar Gala <[email protected]>--- checks.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)checks.c +15
-1@@ -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,
Signature · 4 lines
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