* [PATCH] checks: Change node-name check to match devicetree spec
@ 2021-02-09 17:24 Kumar Gala
[not found] ` <20210209172451.56967-1-kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Kumar Gala @ 2021-02-09 17:24 UTC (permalink / raw)
To: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA; +Cc: 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 <kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
checks.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/checks.c b/checks.c
index 17cb689..24e6816 100644
--- a/checks.c
+++ b/checks.c
@@ -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,
--
2.29.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] checks: Change node-name check to match devicetree spec
[not found] ` <20210209172451.56967-1-kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2021-02-09 18:31 ` Rob Herring
2021-02-09 18:38 ` [PATCH v2] checks: Error on node-name and property name being the same Kumar Gala
2021-02-09 18:46 ` [PATCH v2] checks: Change node-name check to match devicetree spec Kumar Gala
2 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2021-02-09 18:31 UTC (permalink / raw)
To: Kumar Gala; +Cc: Devicetree Compiler
On Tue, Feb 9, 2021 at 11:26 AM Kumar Gala <kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
>
> 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 <kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
> checks.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/checks.c b/checks.c
> index 17cb689..24e6816 100644
> --- a/checks.c
> +++ b/checks.c
> @@ -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 "@");
Since we split the character sets, you should just add '@' to 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,
> --
> 2.29.2
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] checks: Error on node-name and property name being the same
[not found] ` <20210209172451.56967-1-kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2021-02-09 18:31 ` Rob Herring
@ 2021-02-09 18:38 ` Kumar Gala
2021-02-09 18:46 ` [PATCH v2] checks: Change node-name check to match devicetree spec Kumar Gala
2 siblings, 0 replies; 5+ messages in thread
From: Kumar Gala @ 2021-02-09 18:38 UTC (permalink / raw)
To: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA; +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 | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/checks.c b/checks.c
index 17cb689..4d1a4ef 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");
+ }
+}
+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,
--
2.29.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2] checks: Change node-name check to match devicetree spec
[not found] ` <20210209172451.56967-1-kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2021-02-09 18:31 ` Rob Herring
2021-02-09 18:38 ` [PATCH v2] checks: Error on node-name and property name being the same Kumar Gala
@ 2021-02-09 18:46 ` Kumar Gala
[not found] ` <20210209184641.63052-1-kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2 siblings, 1 reply; 5+ messages in thread
From: Kumar Gala @ 2021-02-09 18:46 UTC (permalink / raw)
To: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA,
rob.herring-5wv7dgnIgG8, David Gibson
Cc: 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 <kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
checks.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/checks.c b/checks.c
index 17cb689..48e7fe9 100644
--- a/checks.c
+++ b/checks.c
@@ -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,
--
2.29.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] checks: Change node-name check to match devicetree spec
[not found] ` <20210209184641.63052-1-kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2021-02-10 5:29 ` David Gibson
0 siblings, 0 replies; 5+ messages in thread
From: David Gibson @ 2021-02-10 5:29 UTC (permalink / raw)
To: Kumar Gala
Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA, rob.herring-5wv7dgnIgG8
[-- Attachment #1: Type: text/plain, Size: 2125 bytes --]
On Tue, Feb 09, 2021 at 12:46:41PM -0600, Kumar Gala wrote:
> 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 <kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Applied, thanks.
> ---
> checks.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/checks.c b/checks.c
> index 17cb689..48e7fe9 100644
> --- a/checks.c
> +++ b/checks.c
> @@ -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,
--
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] 5+ messages in thread
end of thread, other threads:[~2021-02-10 5:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-09 17:24 [PATCH] checks: Change node-name check to match devicetree spec Kumar Gala
[not found] ` <20210209172451.56967-1-kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2021-02-09 18:31 ` Rob Herring
2021-02-09 18:38 ` [PATCH v2] checks: Error on node-name and property name being the same Kumar Gala
2021-02-09 18:46 ` [PATCH v2] checks: Change node-name check to match devicetree spec Kumar Gala
[not found] ` <20210209184641.63052-1-kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2021-02-10 5:29 ` 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.