checks: Change node-name check to match devicetree spec
PATCH 1/1 checks: Change node-name check to match devicetree spec
The devicetree spec limits the valid character set to:
A-Z
a-z
0-9
,._+-
while property can additionally have '?#'. Change the check to match the spec.
--- checks.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
checks.c +4 -3
@@ -297,7 +297,8 @@ ERROR(duplicate_property_names, check_duplicate_property_names, NULL);#define LOWERCASE "abcdefghijklmnopqrstuvwxyz"#define UPPERCASE "ABCDEFGHIJKLMNOPQRSTUVWXYZ"#define DIGITS "0123456789" -#define PROPNODECHARS LOWERCASE UPPERCASE DIGITS ",._+*#?-" +#define NODECHARS LOWERCASE UPPERCASE DIGITS ",._+-" +#define PROPCHARS LOWERCASE UPPERCASE DIGITS ",._+*#?-"#define PROPNODECHARSSTRICT LOWERCASE UPPERCASE DIGITS ",-" static void check_node_name_chars(struct check *c, struct dt_info *dti,
@@ -309,7 +310,7 @@ static void check_node_name_chars(struct check *c, struct dt_info *dti,FAIL (c, dti, node,"Bad character '%c' in node name" , node->name[n]); } -ERROR (node_name_chars, check_node_name_chars,PROPNODECHARS "@" ); +ERROR (node_name_chars, check_node_name_chars,NODECHARS "@" );static void check_node_name_chars_strict (struct check *c,struct dt_info *dti,struct node *node)
@@ -370,7 +371,7 @@ static void check_property_name_chars(struct check *c, struct dt_info *dti, prop->name[n]); } } -ERROR (property_name_chars, check_property_name_chars,PROPNODECHARS ); +ERROR (property_name_chars, check_property_name_chars,PROPCHARS ); static void check_property_name_chars_strict(struct check *c, struct dt_info *dti,
Signature · 1 line
2.29.2
A message that is not in the archive (sent off-list or not yet received): 20210209172451.56967-1-kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org
Quoted 30 lines · Kumar Gala
The devicetree spec limits the valid character set to:
A-Z
a-z
0-9
,._+-while property can additionally have '?#'. Change the check to match the spec.
Signed-off-by Kumar Gala <[email protected]>--- checks.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)checks.c +2
-1@@ -297,7 +297,8 @@ ERROR(duplicate_property_names, check_duplicate_property_names, NULL);#define LOWERCASE "abcdefghijklmnopqrstuvwxyz"#define UPPERCASE "ABCDEFGHIJKLMNOPQRSTUVWXYZ"#define DIGITS "0123456789" -#define PROPNODECHARS LOWERCASE UPPERCASE DIGITS ",._+*#?-" +#define NODECHARS LOWERCASE UPPERCASE DIGITS ",._+-" +#define PROPCHARS LOWERCASE UPPERCASE DIGITS ",._+*#?-"#define PROPNODECHARSSTRICT LOWERCASE UPPERCASE DIGITS ",-" static void check_node_name_chars(struct check *c, struct dt_info *dti,
checks.c static void check_node_name_chars(struct check *c, struct dt_info *dti, · line 313
Quoted 5 lines
checks.c +1
-1@@ -309,7 +310,7 @@ static void check_node_name_chars(struct check *c, struct dt_info *dti,FAIL (c, dti, node,"Bad character '%c' in node name" , node->name[n]); } -ERROR (node_name_chars, check_node_name_chars,PROPNODECHARS "@" ); +ERROR (node_name_chars, check_node_name_chars,NODECHARS "@" );
Since we split the character sets, you should just add '@' to NODECHARS.
Quoted 15 lines
checks.c +1
-2static void check_node_name_chars_strict (struct check *c,struct dt_info *dti,struct node *node)@@ -370,7 +371,7 @@ static void check_property_name_chars(struct check *c, struct dt_info *dti, prop->name[n]); } } -ERROR (property_name_chars, check_property_name_chars,PROPNODECHARS ); +ERROR (property_name_chars, check_property_name_chars,PROPCHARS ); static void check_property_name_chars_strict(struct check *c, struct dt_info *dti, --2.29.2
PATCH v2 1/1 checks: Error 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 an error.
--- 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" ); + } +} +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 +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
PATCH v2 1/1 checks: Change node-name check to match devicetree spec
In reply to a message not in the archiveThe devicetree spec limits the valid character set to:
A-Z
a-z
0-9
,._+-
while property can additionally have '?#'. Change the check to match the spec.
--- checks.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
checks.c +4 -3
@@ -297,7 +297,8 @@ ERROR(duplicate_property_names, check_duplicate_property_names, NULL);#define LOWERCASE "abcdefghijklmnopqrstuvwxyz"#define UPPERCASE "ABCDEFGHIJKLMNOPQRSTUVWXYZ"#define DIGITS "0123456789" -#define PROPNODECHARS LOWERCASE UPPERCASE DIGITS ",._+*#?-" +#define NODECHARS LOWERCASE UPPERCASE DIGITS ",._+-@" +#define PROPCHARS LOWERCASE UPPERCASE DIGITS ",._+*#?-"#define PROPNODECHARSSTRICT LOWERCASE UPPERCASE DIGITS ",-" static void check_node_name_chars(struct check *c, struct dt_info *dti,
@@ -309,7 +310,7 @@ static void check_node_name_chars(struct check *c, struct dt_info *dti,FAIL (c, dti, node,"Bad character '%c' in node name" , node->name[n]); } -ERROR (node_name_chars, check_node_name_chars,PROPNODECHARS "@" ); +ERROR (node_name_chars, check_node_name_chars,NODECHARS );static void check_node_name_chars_strict (struct check *c,struct dt_info *dti,struct node *node)
@@ -370,7 +371,7 @@ static void check_property_name_chars(struct check *c, struct dt_info *dti, prop->name[n]); } } -ERROR (property_name_chars, check_property_name_chars,PROPNODECHARS ); +ERROR (property_name_chars, check_property_name_chars,PROPCHARS ); static void check_property_name_chars_strict(struct check *c, struct dt_info *dti,
Signature · 1 line
2.29.2
A message that is not in the archive (sent off-list or not yet received): 20210209184641.63052-1-kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org
David Gibson
AppliedQuoted 10 lines · Kumar Gala
The devicetree spec limits the valid character set to:
A-Z
a-z
0-9
,._+-while property can additionally have '?#'. Change the check to match the spec.
Signed-off-by Kumar Gala <[email protected]>
Applied, thanks.
Quoted 36 lines
--- checks.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)checks.c +4
-3@@ -297,7 +297,8 @@ ERROR(duplicate_property_names, check_duplicate_property_names, NULL);#define LOWERCASE "abcdefghijklmnopqrstuvwxyz"#define UPPERCASE "ABCDEFGHIJKLMNOPQRSTUVWXYZ"#define DIGITS "0123456789" -#define PROPNODECHARS LOWERCASE UPPERCASE DIGITS ",._+*#?-" +#define NODECHARS LOWERCASE UPPERCASE DIGITS ",._+-@" +#define PROPCHARS LOWERCASE UPPERCASE DIGITS ",._+*#?-"#define PROPNODECHARSSTRICT LOWERCASE UPPERCASE DIGITS ",-" static void check_node_name_chars(struct check *c, struct dt_info *dti,@@ -309,7 +310,7 @@ static void check_node_name_chars(struct check *c, struct dt_info *dti,FAIL (c, dti, node,"Bad character '%c' in node name" , node->name[n]); } -ERROR (node_name_chars, check_node_name_chars,PROPNODECHARS "@" ); +ERROR (node_name_chars, check_node_name_chars,NODECHARS );static void check_node_name_chars_strict (struct check *c,struct dt_info *dti,struct node *node)@@ -370,7 +371,7 @@ static void check_property_name_chars(struct check *c, struct dt_info *dti, prop->name[n]); } } -ERROR (property_name_chars, check_property_name_chars,PROPNODECHARS ); +ERROR (property_name_chars, check_property_name_chars,PROPCHARS ); static void check_property_name_chars_strict(struct check *c, struct dt_info *dti,
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