devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH v2 5/6] checks: add aliases node checks
Date: Tue, 12 Dec 2017 16:46:28 -0600	[thread overview]
Message-ID: <20171212224629.28738-5-robh@kernel.org> (raw)
In-Reply-To: <20171212224629.28738-1-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

Add checks for aliases node that all properties follow alias naming
convention and the values are a valid path.

Signed-off-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
v2:
- Drop known name check
- Add character set check for alias names

 checks.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/checks.c b/checks.c
index e0ec67be1b7a..66e5fd6405a5 100644
--- a/checks.c
+++ b/checks.c
@@ -636,6 +636,28 @@ static void check_names_is_string_list(struct check *c, struct dt_info *dti,
 }
 WARNING(names_is_string_list, check_names_is_string_list, NULL);
 
+static void check_alias_paths(struct check *c, struct dt_info *dti,
+				    struct node *node)
+{
+	struct property *prop;
+
+	if (!streq(node->name, "aliases"))
+		return;
+
+	for_each_property(node, prop) {
+		if (!prop->val.val || !get_node_by_path(dti->dt, prop->val.val)) {
+			FAIL(c, dti, "aliases property '%s' is not a valid node (%s)",
+			     prop->name, prop->val.val);
+			continue;
+		}
+		if (strspn(prop->name, LOWERCASE DIGITS "-") != strlen(prop->name))
+			FAIL(c, dti, "aliases property name '%s' is not valid",
+			     prop->name);
+
+	}
+}
+WARNING(alias_paths, check_alias_paths, NULL);
+
 static void fixup_addr_size_cells(struct check *c, struct dt_info *dti,
 				  struct node *node)
 {
@@ -1354,6 +1376,8 @@ static struct check *check_table[] = {
 	&gpios_property,
 	&interrupts_property,
 
+	&alias_paths,
+
 	&always_fail,
 };
 
-- 
2.14.1

  parent reply	other threads:[~2017-12-12 22:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-12 22:46 [PATCH v2 1/6] checks: add a string check for 'label' property Rob Herring
     [not found] ` <20171212224629.28738-1-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-12-12 22:46   ` [PATCH v2 2/6] checks: add string list check Rob Herring
     [not found]     ` <20171212224629.28738-2-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-12-13  9:24       ` David Gibson
2017-12-12 22:46   ` [PATCH v2 3/6] checks: add string list check for *-names properties Rob Herring
     [not found]     ` <20171212224629.28738-3-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-12-13  9:28       ` David Gibson
2017-12-12 22:46   ` [PATCH v2 4/6] checks: check for #{size,address}-cells without child nodes Rob Herring
     [not found]     ` <20171212224629.28738-4-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-12-13 10:06       ` David Gibson
2017-12-12 22:46   ` Rob Herring [this message]
2017-12-12 22:46   ` [PATCH v2 6/6] checks: add a chosen node check Rob Herring
     [not found]     ` <20171212224629.28738-6-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-12-13 10:39       ` David Gibson
2017-12-13  9:20   ` [PATCH v2 1/6] checks: add a string check for 'label' property 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=20171212224629.28738-5-robh@kernel.org \
    --to=robh-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@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).