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
Cc: Andre Przywara <andre.przywara-5wv7dgnIgG8@public.gmane.org>
Subject: [PATCH 3/3] checks: Ensure '#interrupt-cells' only exists in interrupt providers
Date: Tue, 28 Sep 2021 16:23:35 -0500	[thread overview]
Message-ID: <20210928212335.2061125-3-robh@kernel.org> (raw)
In-Reply-To: <20210928212335.2061125-1-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

The interrupt provider check currently checks if an interrupt provider
has #interrupt-cells, but not whether #interrupt-cells is present
outside of interrupt-providers. Rework the check to cover the latter
case.

Cc: Andre Przywara <andre.przywara-5wv7dgnIgG8@public.gmane.org>
Signed-off-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 checks.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/checks.c b/checks.c
index 2efa36377e80..7f769e92ef71 100644
--- a/checks.c
+++ b/checks.c
@@ -1573,14 +1573,20 @@ static void check_interrupt_provider(struct check *c,
 				     struct node *node)
 {
 	struct property *prop;
+	bool irq_provider = node_is_interrupt_provider(node);
 
-	if (!node_is_interrupt_provider(node))
+	prop = get_property(node, "#interrupt-cells");
+	if (irq_provider && !prop) {
+		FAIL(c, dti, node,
+		     "Missing '#interrupt-cells' in interrupt-controller");
 		return;
+	}
 
-	prop = get_property(node, "#interrupt-cells");
-	if (!prop)
+	if (!irq_provider && prop) {
 		FAIL(c, dti, node,
-		     "Missing #interrupt-cells in interrupt provider");
+		     "'#interrupt-cells' found, but node is not an interrupt provider");
+		return;
+	}
 }
 WARNING(interrupt_provider, check_interrupt_provider, NULL);
 
-- 
2.30.2


  parent reply	other threads:[~2021-09-28 21:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-28 21:23 [PATCH 1/3] checks: Add an interrupt-map check Rob Herring
     [not found] ` <20210928212335.2061125-1-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2021-09-28 21:23   ` [PATCH 2/3] checks: Drop interrupt provider '#address-cells' check Rob Herring
     [not found]     ` <20210928212335.2061125-2-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2021-10-11  4:57       ` David Gibson
2021-09-28 21:23   ` Rob Herring [this message]
     [not found]     ` <20210928212335.2061125-3-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2021-10-11  4:58       ` [PATCH 3/3] checks: Ensure '#interrupt-cells' only exists in interrupt providers David Gibson
2021-10-11  4:56   ` [PATCH 1/3] checks: Add an interrupt-map check David Gibson
2021-10-11 16:56     ` Rob Herring
     [not found]       ` <CAL_JsqKrRAOiuY=71xsZ0RRojsOraXmSaLpDYSXx1E84SF_qDQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-10-13  3:43         ` 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=20210928212335.2061125-3-robh@kernel.org \
    --to=robh-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=andre.przywara-5wv7dgnIgG8@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 read-only IMAP folder(s) and NNTP newsgroup(s).