devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kumar Gala <kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: David Gibson
	<david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>,
	rob.herring-5wv7dgnIgG8@public.gmane.org,
	Devicetree Compiler
	<devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: Kumar Gala <kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Subject: [PATCH v4] checks: Warn on node-name and property name being the same
Date: Wed, 10 Feb 2021 13:39:12 -0600	[thread overview]
Message-ID: <20210210193912.799544-1-kumar.gala@linaro.org> (raw)
In-Reply-To: <20210209175059.60057-1-kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

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


  parent reply	other threads:[~2021-02-10 19:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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   ` Kumar Gala [this message]
     [not found]     ` <20210210193912.799544-1-kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2021-02-15  6:17       ` [PATCH v4] " David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210210193912.799544-1-kumar.gala@linaro.org \
    --to=kumar.gala-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
    --cc=david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org \
    --cc=devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=rob.herring-5wv7dgnIgG8@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).