devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] checks: Warn about missing #address-cells for interrupt parents
@ 2024-12-13 14:14 Thierry Reding
  2024-12-16 19:37 ` Rob Herring
  2024-12-18  2:01 ` Brad Griffis
  0 siblings, 2 replies; 7+ messages in thread
From: Thierry Reding @ 2024-12-13 14:14 UTC (permalink / raw)
  To: devicetree-compiler; +Cc: Brad Griffis

From: Thierry Reding <treding@nvidia.com>

The device tree specification (v0.4) suggests that #address-cells is
mandatory for interrupt parent nodes. If this property is missing, Linux
will default to the value of 0.

A number of device tree files rely on Linux' fallback and don't specify
an explicit #address-cells as suggested by the specification. This can
cause issues when these device trees are passed to software with a more
pedantic interpretation of the DT spec.

Add a warning when this case is detected so that device tree files can
be fixed.

Reported-by: Brad Griffis <bgriffis@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
Applying this to Linux' copy reports on the order of 1300 issues that
originate from 29 .dtsi files. If this proposal is acceptable/useful, I
volunteer to patch those up so we don't get spammed by them.
---
 checks.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/checks.c b/checks.c
index 9e6a7b6a3e97..123f2eb425f4 100644
--- a/checks.c
+++ b/checks.c
@@ -1676,6 +1676,10 @@ static void check_interrupt_map(struct check *c,
 		cellprop = get_property(provider_node, "#address-cells");
 		if (cellprop)
 			parent_cellsize += propval_cell(cellprop);
+		else
+			FAIL_PROP(c, dti, node, irq_map_prop,
+				"Missing property '#address-cells' in node %s, using 0 as fallback",
+				provider_node->fullpath);
 
 		cell += 1 + parent_cellsize;
 		if (cell > map_cells)
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-12-19  4:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-13 14:14 [PATCH] checks: Warn about missing #address-cells for interrupt parents Thierry Reding
2024-12-16 19:37 ` Rob Herring
2024-12-18  5:07   ` David Gibson
2024-12-18  2:01 ` Brad Griffis
2024-12-18  5:03   ` David Gibson
2024-12-18 15:50   ` Rob Herring
2024-12-19  4:07     ` David Gibson

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).