All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/9] dtc: dt-check-style: Improvements for false positives
@ 2026-07-26 15:47 Krzysztof Kozlowski
  2026-07-26 15:47 ` [PATCH 1/9] dtc: dt-check-style: Add missing /dts-v1/ to few test cases Krzysztof Kozlowski
                   ` (8 more replies)
  0 siblings, 9 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-26 15:47 UTC (permalink / raw)
  To: Rob Herring, Saravana Kannan, Test User, Krzysztof Kozlowski,
	Conor Dooley
  Cc: devicetree, linux-kernel, Krzysztof Kozlowski

Few improvements and proper handling of top-level node (name, not unit
address sorting) and property (model before compatible) sorting.

Best regards,
Krzysztof

---
Krzysztof Kozlowski (9):
      dtc: dt-check-style: Add missing /dts-v1/ to few test cases
      dtc: dt-check-style: Simplify setting depth of DtsLine
      dtc: dt-check-style: Handle root node in overlays
      dtc: dt-check-style: Handle sorting of top-level nodes and properties
      dtc: dt-check-style: Drop stray backslash before quote for continuation-alignment
      dtc: dt-check-style: Fix alignment of values in continued property lines
      dtc: dt-check-style: Consistently call 'kind' as 'file_type'
      dtc: dt-check-style: Introduce 'stricter' mode
      MAINTAINERS: dt-bindings: Include dt-check-style in DT binding entry

 MAINTAINERS                                        |   2 +
 scripts/dtc/dt-check-style                         | 151 +++++++++++++--------
 .../dt-style-selftest/bad/dts-child-name-order.dts |   2 +
 .../dtc/dt-style-selftest/bad/dts-cont-align.dts   |  23 ++++
 .../{good => bad}/dts-digit-node-order.dts         |  15 +-
 .../bad/dts-extend-node-child-name-order.dts       |   2 +
 .../bad/dts-extend-node-digit-node-order.dts       |   2 +
 .../dtc/dt-style-selftest/bad/dts-line-length.dts  |  21 +++
 .../dt-style-selftest/bad/dts-property-order.dts   |   5 +
 ...-property-order.dts => dts-property-order.dtso} |   8 +-
 .../dtc/dt-style-selftest/bad/dts-unused-label.dts |  21 +++
 .../dtc/dt-style-selftest/bad/yaml-cont-align.yaml |   4 +-
 .../expected/dts-child-name-order.dts.txt          |   2 +-
 .../expected/dts-cont-align.dts.txt                |   8 ++
 .../expected/dts-digit-node-order.dts.txt          |   2 +
 .../dts-extend-node-child-name-order.dts.txt       |   2 +-
 .../dts-extend-node-digit-node-order.dts.txt       |   2 +-
 .../expected/dts-line-length.dts.txt               |   2 +
 .../expected/dts-property-order.dts.txt            |  12 +-
 .../expected/dts-property-order.dtso.txt           |   8 ++
 .../expected/dts-unused-label.dts.txt              |   2 +
 .../expected/yaml-cont-align.yaml.txt              |   3 +-
 .../expected/yaml-value-ws-multiline.yaml.txt      |   1 +
 .../good/dts-child-name-order.dts                  |   2 +
 .../dtc/dt-style-selftest/good/dts-cont-align.dts  |  11 +-
 .../good/dts-digit-node-order.dts                  |   5 +-
 .../good/dts-extend-node-child-name-order.dts      |   2 +
 .../good/dts-extend-node-digit-node-order.dts      |   2 +
 .../dt-style-selftest/good/dts-property-order.dts  |   5 +
 scripts/dtc/dt-style-selftest/good/soc.dtsi        |   2 +
 .../{bad => good}/yaml-cont-align.yaml             |   8 +-
 31 files changed, 254 insertions(+), 83 deletions(-)
---
base-commit: be3b57e0fa77f8a1c8e6ebea5cf62ab71453ef54
change-id: 20260726-n-dts-style-checker-continued-b6a05e278891

Best regards,
--  
Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>


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

* [PATCH 1/9] dtc: dt-check-style: Add missing /dts-v1/ to few test cases
  2026-07-26 15:47 [PATCH 0/9] dtc: dt-check-style: Improvements for false positives Krzysztof Kozlowski
@ 2026-07-26 15:47 ` Krzysztof Kozlowski
  2026-07-26 15:47 ` [PATCH 2/9] dtc: dt-check-style: Simplify setting depth of DtsLine Krzysztof Kozlowski
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-26 15:47 UTC (permalink / raw)
  To: Rob Herring, Saravana Kannan, Test User, Krzysztof Kozlowski,
	Conor Dooley
  Cc: devicetree, linux-kernel, Krzysztof Kozlowski

The selftest DTS should still look like a real DTS, so it needs
'/dts-v1/' marking.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
 scripts/dtc/dt-style-selftest/bad/dts-child-name-order.dts              | 2 ++
 scripts/dtc/dt-style-selftest/bad/dts-extend-node-child-name-order.dts  | 2 ++
 scripts/dtc/dt-style-selftest/bad/dts-extend-node-digit-node-order.dts  | 2 ++
 scripts/dtc/dt-style-selftest/expected/dts-child-name-order.dts.txt     | 2 +-
 .../dt-style-selftest/expected/dts-extend-node-child-name-order.dts.txt | 2 +-
 .../dt-style-selftest/expected/dts-extend-node-digit-node-order.dts.txt | 2 +-
 scripts/dtc/dt-style-selftest/good/dts-child-name-order.dts             | 2 ++
 scripts/dtc/dt-style-selftest/good/dts-digit-node-order.dts             | 2 ++
 scripts/dtc/dt-style-selftest/good/dts-extend-node-child-name-order.dts | 2 ++
 scripts/dtc/dt-style-selftest/good/dts-extend-node-digit-node-order.dts | 2 ++
 scripts/dtc/dt-style-selftest/good/soc.dtsi                             | 2 ++
 11 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/scripts/dtc/dt-style-selftest/bad/dts-child-name-order.dts b/scripts/dtc/dt-style-selftest/bad/dts-child-name-order.dts
index 49c5c10c92d7..54be9f07b680 100644
--- a/scripts/dtc/dt-style-selftest/bad/dts-child-name-order.dts
+++ b/scripts/dtc/dt-style-selftest/bad/dts-child-name-order.dts
@@ -1,4 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+/dts-v1/;
+
 / {
 	#address-cells = <1>;
 	#size-cells = <1>;
diff --git a/scripts/dtc/dt-style-selftest/bad/dts-extend-node-child-name-order.dts b/scripts/dtc/dt-style-selftest/bad/dts-extend-node-child-name-order.dts
index 575dadd03c38..296c58a545d5 100644
--- a/scripts/dtc/dt-style-selftest/bad/dts-extend-node-child-name-order.dts
+++ b/scripts/dtc/dt-style-selftest/bad/dts-extend-node-child-name-order.dts
@@ -1,4 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+/dts-v1/;
+
 / {
 	#address-cells = <1>;
 	#size-cells = <1>;
diff --git a/scripts/dtc/dt-style-selftest/bad/dts-extend-node-digit-node-order.dts b/scripts/dtc/dt-style-selftest/bad/dts-extend-node-digit-node-order.dts
index f3ffc47365a3..813900e3393c 100644
--- a/scripts/dtc/dt-style-selftest/bad/dts-extend-node-digit-node-order.dts
+++ b/scripts/dtc/dt-style-selftest/bad/dts-extend-node-digit-node-order.dts
@@ -1,4 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+/dts-v1/;
+
 / {
 	#address-cells = <1>;
 	#size-cells = <1>;
diff --git a/scripts/dtc/dt-style-selftest/expected/dts-child-name-order.dts.txt b/scripts/dtc/dt-style-selftest/expected/dts-child-name-order.dts.txt
index 86b1de9bd654..e2eea0862102 100644
--- a/scripts/dtc/dt-style-selftest/expected/dts-child-name-order.dts.txt
+++ b/scripts/dtc/dt-style-selftest/expected/dts-child-name-order.dts.txt
@@ -1,2 +1,2 @@
 # mode=strict
-bad/dts-child-name-order.dts:14: [child-name-order] child node 'bar' out of name order
+bad/dts-child-name-order.dts:16: [child-name-order] child node 'bar' out of name order
diff --git a/scripts/dtc/dt-style-selftest/expected/dts-extend-node-child-name-order.dts.txt b/scripts/dtc/dt-style-selftest/expected/dts-extend-node-child-name-order.dts.txt
index e3d8fd367e09..b6e74e6f923e 100644
--- a/scripts/dtc/dt-style-selftest/expected/dts-extend-node-child-name-order.dts.txt
+++ b/scripts/dtc/dt-style-selftest/expected/dts-extend-node-child-name-order.dts.txt
@@ -1,2 +1,2 @@
 # mode=strict
-bad/dts-extend-node-child-name-order.dts:20: [child-name-order] child node 'bar' out of name order
+bad/dts-extend-node-child-name-order.dts:22: [child-name-order] child node 'bar' out of name order
diff --git a/scripts/dtc/dt-style-selftest/expected/dts-extend-node-digit-node-order.dts.txt b/scripts/dtc/dt-style-selftest/expected/dts-extend-node-digit-node-order.dts.txt
index 525081867bf7..bf252e4d9815 100644
--- a/scripts/dtc/dt-style-selftest/expected/dts-extend-node-digit-node-order.dts.txt
+++ b/scripts/dtc/dt-style-selftest/expected/dts-extend-node-digit-node-order.dts.txt
@@ -1,2 +1,2 @@
 # mode=strict
-bad/dts-extend-node-digit-node-order.dts:21: [child-address-order] child node @10000 out of address order
+bad/dts-extend-node-digit-node-order.dts:23: [child-address-order] child node @10000 out of address order
diff --git a/scripts/dtc/dt-style-selftest/good/dts-child-name-order.dts b/scripts/dtc/dt-style-selftest/good/dts-child-name-order.dts
index d2a278763c3c..af0adf5abf70 100644
--- a/scripts/dtc/dt-style-selftest/good/dts-child-name-order.dts
+++ b/scripts/dtc/dt-style-selftest/good/dts-child-name-order.dts
@@ -1,4 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+/dts-v1/;
+
 / {
 	#address-cells = <1>;
 	#size-cells = <1>;
diff --git a/scripts/dtc/dt-style-selftest/good/dts-digit-node-order.dts b/scripts/dtc/dt-style-selftest/good/dts-digit-node-order.dts
index d2bf5861c3ee..cdf3f91ebe01 100644
--- a/scripts/dtc/dt-style-selftest/good/dts-digit-node-order.dts
+++ b/scripts/dtc/dt-style-selftest/good/dts-digit-node-order.dts
@@ -1,4 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+/dts-v1/;
+
 / {
 	#address-cells = <1>;
 	#size-cells = <1>;
diff --git a/scripts/dtc/dt-style-selftest/good/dts-extend-node-child-name-order.dts b/scripts/dtc/dt-style-selftest/good/dts-extend-node-child-name-order.dts
index 47fe5455edfa..97d468051f25 100644
--- a/scripts/dtc/dt-style-selftest/good/dts-extend-node-child-name-order.dts
+++ b/scripts/dtc/dt-style-selftest/good/dts-extend-node-child-name-order.dts
@@ -1,4 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+/dts-v1/;
+
 / {
 	#address-cells = <1>;
 	#size-cells = <1>;
diff --git a/scripts/dtc/dt-style-selftest/good/dts-extend-node-digit-node-order.dts b/scripts/dtc/dt-style-selftest/good/dts-extend-node-digit-node-order.dts
index 0c292fefa52a..faf49962faf2 100644
--- a/scripts/dtc/dt-style-selftest/good/dts-extend-node-digit-node-order.dts
+++ b/scripts/dtc/dt-style-selftest/good/dts-extend-node-digit-node-order.dts
@@ -1,4 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+/dts-v1/;
+
 / {
 	#address-cells = <1>;
 	#size-cells = <1>;
diff --git a/scripts/dtc/dt-style-selftest/good/soc.dtsi b/scripts/dtc/dt-style-selftest/good/soc.dtsi
index c60274469555..deec1a973c92 100644
--- a/scripts/dtc/dt-style-selftest/good/soc.dtsi
+++ b/scripts/dtc/dt-style-selftest/good/soc.dtsi
@@ -1,4 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+/dts-v1/;
+
 / {
 	#address-cells = <1>;
 	#size-cells = <1>;

-- 
2.53.0


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

* [PATCH 2/9] dtc: dt-check-style: Simplify setting depth of DtsLine
  2026-07-26 15:47 [PATCH 0/9] dtc: dt-check-style: Improvements for false positives Krzysztof Kozlowski
  2026-07-26 15:47 ` [PATCH 1/9] dtc: dt-check-style: Add missing /dts-v1/ to few test cases Krzysztof Kozlowski
@ 2026-07-26 15:47 ` Krzysztof Kozlowski
  2026-07-26 15:47 ` [PATCH 3/9] dtc: dt-check-style: Handle root node in overlays Krzysztof Kozlowski
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-26 15:47 UTC (permalink / raw)
  To: Rob Herring, Saravana Kannan, Test User, Krzysztof Kozlowski,
	Conor Dooley
  Cc: devicetree, linux-kernel, Krzysztof Kozlowski

When creating new DtsLine object, pass expected indentation depth as
constructor, instead of assigning it immediately after, so the code will
be easier to read and explicit (depth is not supposed to change during
DtsLine lifetime).

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
 scripts/dtc/dt-check-style | 31 +++++++++++--------------------
 1 file changed, 11 insertions(+), 20 deletions(-)

diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style
index 3985923622e8..96deffc0d8a7 100755
--- a/scripts/dtc/dt-check-style
+++ b/scripts/dtc/dt-check-style
@@ -82,11 +82,12 @@ class DtsLine:
                  'node_name', 'node_addr', 'label', 'ref_name', 'depth',
                  'closures')
 
-    def __init__(self, lineno, raw, linetype, indent_str, stripped):
+    def __init__(self, lineno, raw, linetype, depth, indent_str, stripped):
         self.lineno = lineno      # 1-based within the block
         self.raw = raw
         self.linetype = linetype
         self.indent_str = indent_str  # leading whitespace as-is
+        self.depth = depth
         self.stripped = stripped
         self.prop_name = None
         self.continuations = []
@@ -94,7 +95,6 @@ class DtsLine:
         self.node_addr = None
         self.label = None
         self.ref_name = None
-        self.depth = 0            # filled in by classify_lines
         self.closures = 1         # count of '}' on a NODE_CLOSE line
 
 
@@ -162,16 +162,14 @@ def classify_lines(text):
         # or a blank line).
         if in_cpp_macro:
             dl = DtsLine(i, raw, LineType.PREPROCESSOR,
-                         indent_str, stripped)
-            dl.depth = depth
+                         depth, indent_str, stripped)
             out.append(dl)
             in_cpp_macro = (bool(stripped) and
                             stripped.rstrip().endswith('\\'))
             continue
 
         if not stripped:
-            dl = DtsLine(i, raw, LineType.BLANK, '', '')
-            dl.depth = depth
+            dl = DtsLine(i, raw, LineType.BLANK, depth, '', '')
             out.append(dl)
             continue
 
@@ -180,15 +178,13 @@ def classify_lines(text):
                      else LineType.COMMENT_BODY)
             if ltype == LineType.COMMENT_END:
                 in_block_comment = False
-            dl = DtsLine(i, raw, ltype, indent_str, stripped)
-            dl.depth = depth
+            dl = DtsLine(i, raw, ltype, depth, indent_str, stripped)
             out.append(dl)
             continue
 
         if (stripped.startswith('#') or stripped.startswith('/')) and is_preprocessor(stripped):
-            dl = DtsLine(i, raw, LineType.PREPROCESSOR,
+            dl = DtsLine(i, raw, LineType.PREPROCESSOR, depth,
                          indent_str, stripped)
-            dl.depth = depth
             out.append(dl)
             prev_complete = True
             in_cpp_macro = stripped.rstrip().endswith('\\')
@@ -205,14 +201,12 @@ def classify_lines(text):
         # structural classification entirely.
         if not code:
             ltype = LineType.COMMENT_START if opens_block else LineType.COMMENT
-            dl = DtsLine(i, raw, ltype, indent_str, stripped)
-            dl.depth = depth
+            dl = DtsLine(i, raw, ltype, depth, indent_str, stripped)
             out.append(dl)
             continue
 
         if not prev_complete:
-            dl = DtsLine(i, raw, LineType.CONTINUATION, indent_str, code)
-            dl.depth = depth
+            dl = DtsLine(i, raw, LineType.CONTINUATION, depth, indent_str, code)
             out.append(dl)
             prev_complete = (code.endswith(';') or
                              code.endswith('{') or
@@ -227,26 +221,23 @@ def classify_lines(text):
         if re_only_closures.match(code):
             closures = code.count('}')
             depth = max(depth - closures, 0)
-            dl = DtsLine(i, raw, LineType.NODE_CLOSE, indent_str, code)
-            dl.depth = depth
+            dl = DtsLine(i, raw, LineType.NODE_CLOSE, depth, indent_str, code)
             dl.closures = closures
             out.append(dl)
             prev_complete = True
             continue
 
         if code.endswith('{'):
-            dl = DtsLine(i, raw, LineType.NODE_OPEN, indent_str, code)
+            dl = DtsLine(i, raw, LineType.NODE_OPEN, depth, indent_str, code)
             parse_node_header(dl)
-            dl.depth = depth
             out.append(dl)
             depth += 1
             prev_complete = True
             continue
 
         # Property (or first line of a multi-line property).
-        dl = DtsLine(i, raw, LineType.PROPERTY, indent_str, code)
+        dl = DtsLine(i, raw, LineType.PROPERTY, depth, indent_str, code)
         parse_property_name(dl)
-        dl.depth = depth
         out.append(dl)
         prev_complete = code.endswith(';')
 

-- 
2.53.0


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

* [PATCH 3/9] dtc: dt-check-style: Handle root node in overlays
  2026-07-26 15:47 [PATCH 0/9] dtc: dt-check-style: Improvements for false positives Krzysztof Kozlowski
  2026-07-26 15:47 ` [PATCH 1/9] dtc: dt-check-style: Add missing /dts-v1/ to few test cases Krzysztof Kozlowski
  2026-07-26 15:47 ` [PATCH 2/9] dtc: dt-check-style: Simplify setting depth of DtsLine Krzysztof Kozlowski
@ 2026-07-26 15:47 ` Krzysztof Kozlowski
  2026-07-26 16:00   ` sashiko-bot
  2026-07-26 15:47 ` [PATCH 4/9] dtc: dt-check-style: Handle sorting of top-level nodes and properties Krzysztof Kozlowski
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-26 15:47 UTC (permalink / raw)
  To: Rob Herring, Saravana Kannan, Test User, Krzysztof Kozlowski,
	Conor Dooley
  Cc: devicetree, linux-kernel, Krzysztof Kozlowski

Detection of overriding/extending a root node should be a bit more
complex than comparing node name from regex, because overlays use often
'&{/} {' notation.  Check for expected syntax before creating DtsLine
and store it as 'is_root' attribute for further logic.

This fixes false positives for property order for root nodes in overlays.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
 scripts/dtc/dt-check-style                         | 14 +++++--
 .../dt-style-selftest/bad/dts-property-order.dtso  | 49 ++++++++++++++++++++++
 .../expected/dts-property-order.dtso.txt           |  7 ++++
 3 files changed, 66 insertions(+), 4 deletions(-)

diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style
index 96deffc0d8a7..1937c6feb57e 100755
--- a/scripts/dtc/dt-check-style
+++ b/scripts/dtc/dt-check-style
@@ -77,18 +77,19 @@ def is_preprocessor(stripped):
 
 
 class DtsLine:
-    __slots__ = ('lineno', 'raw', 'linetype', 'indent_str', 'stripped',
+    __slots__ = ('lineno', 'raw', 'linetype', 'indent_str', 'stripped', 'is_root',
                  'prop_name', 'continuations',
                  'node_name', 'node_addr', 'label', 'ref_name', 'depth',
                  'closures')
 
-    def __init__(self, lineno, raw, linetype, depth, indent_str, stripped):
+    def __init__(self, lineno, raw, linetype, depth, indent_str, stripped, is_root = False):
         self.lineno = lineno      # 1-based within the block
         self.raw = raw
         self.linetype = linetype
         self.indent_str = indent_str  # leading whitespace as-is
         self.depth = depth
         self.stripped = stripped
+        self.is_root = is_root
         self.prop_name = None
         self.continuations = []
         self.node_name = None
@@ -228,7 +229,10 @@ def classify_lines(text):
             continue
 
         if code.endswith('{'):
-            dl = DtsLine(i, raw, LineType.NODE_OPEN, depth, indent_str, code)
+            is_root = False
+            if code == '&{/} {' or code == '/ {':
+                is_root = True
+            dl = DtsLine(i, raw, LineType.NODE_OPEN, depth, indent_str, code, is_root=is_root)
             parse_node_header(dl)
             out.append(dl)
             depth += 1
@@ -550,7 +554,9 @@ def check_child_name_order(ctx):
         for c in children:
             if c.node_addr is not None:
                 continue
-            if c.node_name in (None, '/'):
+            if c.node_name is None:
+                continue
+            if c.is_root:
                 continue
             if c.ref_name is not None:
                 continue
diff --git a/scripts/dtc/dt-style-selftest/bad/dts-property-order.dtso b/scripts/dtc/dt-style-selftest/bad/dts-property-order.dtso
new file mode 100644
index 000000000000..81ac2b092b96
--- /dev/null
+++ b/scripts/dtc/dt-style-selftest/bad/dts-property-order.dtso
@@ -0,0 +1,49 @@
+// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+/*
+ * Test fixture: Incorrect property order
+ */
+
+/dts-v1/;
+/plugin/;
+
+&{/} {
+	compatible = "example,test-board", "example,test-soc";
+	model = "DT style selftest";
+	qcom,board-id = <8 0>;
+	chassis-type = "handset";
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu@0 {
+			reg = <0x0 0x0>;
+			compatible = "arm,cortex-a57";
+			device_type = "cpu";
+			enable-method = "psci";
+		};
+	};
+
+	pmu {
+		compatible = "example,pmu";
+
+		status = "disabled";
+		dma-coherent;
+	};
+
+	soc@0 {
+		ranges = <0 0 0 0xc0000000>;
+		compatible = "simple-bus";
+
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		interrupt-controller@10000 {
+			reg = <0x10000 0x1000>;
+			interrupts = <1 2 3>,
+				     <4 5 6>,
+				     <7 8 9>;
+			compatible = "example,intc";
+		};
+	};
+};
diff --git a/scripts/dtc/dt-style-selftest/expected/dts-property-order.dtso.txt b/scripts/dtc/dt-style-selftest/expected/dts-property-order.dtso.txt
new file mode 100644
index 000000000000..a78b8c042aa5
--- /dev/null
+++ b/scripts/dtc/dt-style-selftest/expected/dts-property-order.dtso.txt
@@ -0,0 +1,7 @@
+# mode=strict
+bad/dts-property-order.dtso:13: [property-order] property 'chassis-type' out of canonical order (should sort before 'qcom,board-id')
+bad/dts-property-order.dtso:21: [property-order] property 'compatible' out of canonical order (should sort before 'reg')
+bad/dts-property-order.dtso:22: [property-order] property 'device_type' out of canonical order (should sort before 'compatible')
+bad/dts-property-order.dtso:31: [property-order] property 'dma-coherent' out of canonical order (should sort before 'status')
+bad/dts-property-order.dtso:36: [property-order] property 'compatible' out of canonical order (should sort before 'ranges')
+bad/dts-property-order.dtso:46: [property-order] property 'compatible' out of canonical order (should sort before 'interrupts')

-- 
2.53.0


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

* [PATCH 4/9] dtc: dt-check-style: Handle sorting of top-level nodes and properties
  2026-07-26 15:47 [PATCH 0/9] dtc: dt-check-style: Improvements for false positives Krzysztof Kozlowski
                   ` (2 preceding siblings ...)
  2026-07-26 15:47 ` [PATCH 3/9] dtc: dt-check-style: Handle root node in overlays Krzysztof Kozlowski
@ 2026-07-26 15:47 ` Krzysztof Kozlowski
  2026-07-26 15:57   ` sashiko-bot
  2026-07-26 15:47 ` [PATCH 5/9] dtc: dt-check-style: Drop stray backslash before quote for continuation-alignment Krzysztof Kozlowski
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-26 15:47 UTC (permalink / raw)
  To: Rob Herring, Saravana Kannan, Test User, Krzysztof Kozlowski,
	Conor Dooley
  Cc: devicetree, linux-kernel, Krzysztof Kozlowski

Top-level DTS (but not example in the bindings) has only two nodes with
unit-addresses: memory@ and soc@.  There are two special cases here, in
terms of coding style:

1. The unit-address of memory is often not known thus set to @0, because
   it is filled up by bootloader.

2. There is mixture of non-unit-address and unit-address nodes.

Therefore usually the DTS chooses sorting by the node name, not the unit
address, for the top-level part.

Also the properties have one exception: 'model' property is supposed to
be before 'compatible'.  This cannot be applied to entire DTS, because
sound cards have also 'model' where it is supposed to follow standard
rules (after 'compatible').  Root node is just special.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
 scripts/dtc/dt-check-style                         | 42 +++++++++++++++++++---
 .../dt-style-selftest/bad/dts-digit-node-order.dts | 40 +++++++++++++++++++++
 .../dt-style-selftest/bad/dts-property-order.dts   |  5 +++
 .../expected/dts-digit-node-order.dts.txt          |  2 ++
 .../expected/dts-property-order.dts.txt            | 12 ++++---
 .../expected/dts-property-order.dtso.txt           |  1 +
 .../good/dts-digit-node-order.dts                  |  3 --
 .../dt-style-selftest/good/dts-property-order.dts  |  5 +++
 8 files changed, 97 insertions(+), 13 deletions(-)

diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style
index 1937c6feb57e..db4451e30dfb 100755
--- a/scripts/dtc/dt-check-style
+++ b/scripts/dtc/dt-check-style
@@ -79,7 +79,7 @@ def is_preprocessor(stripped):
 class DtsLine:
     __slots__ = ('lineno', 'raw', 'linetype', 'indent_str', 'stripped', 'is_root',
                  'prop_name', 'continuations',
-                 'node_name', 'node_addr', 'label', 'ref_name', 'depth',
+                 'node_name', 'node_addr', 'label', 'ref_name', 'parent', 'depth',
                  'closures')
 
     def __init__(self, lineno, raw, linetype, depth, indent_str, stripped, is_root = False):
@@ -96,6 +96,7 @@ class DtsLine:
         self.node_addr = None
         self.label = None
         self.ref_name = None
+        self.parent = None        # DtsLine of parent node
         self.closures = 1         # count of '}' on a NODE_CLOSE line
 
 
@@ -496,15 +497,21 @@ def _walk_bodies(lines):
     in the input. Skips ref-nodes (&label) since those don't have an
     intrinsic ordering."""
     body_stack = [[]]
+    node_stack = [[]]
+    parent_dl = None
     for dl in lines:
         if dl.linetype == LineType.NODE_OPEN:
+            dl.parent = parent_dl
+            node_stack.append(dl)
             body_stack[-1].append(dl)
             body_stack.append([])
+            parent_dl = dl
             continue
         if dl.linetype == LineType.NODE_CLOSE:
             if len(body_stack) <= 1:
                 # Unbalanced; ignore to avoid crashing on malformed input
                 continue
+            parent_dl = node_stack.pop()
             yield body_stack.pop()
             continue
     while body_stack:
@@ -525,12 +532,18 @@ def _natural_sort_key(s):
 
 def check_child_address_order(ctx):
     """Addressed siblings (foo@N) must appear in ascending address
-    order within their parent node body."""
+    order within their parent node body.
+    Exception: Top-level in DTS follows name order, regardless of unit address
+    in memory@N and soc@N nodes
+    """
     for children in _walk_bodies(ctx.lines):
         addressed = []
         for c in children:
             if c.node_addr is None:
                 continue
+            if c.parent and c.parent.is_root:
+                # Top-level does not use unit address sorting usually
+                continue
             try:
                 parts = tuple(int(p, 16) for p in c.node_addr.split(','))
             except ValueError:
@@ -597,6 +610,22 @@ def _property_bucket(name):
     return (5 if ',' in stripped else 4, None)
 
 
+def _property_bucket_root(name):
+    """Return the canonical bucket index for a property:
+       0 model (for root nodes only)
+       1 compatible
+    Plus a sub-key inside the bucket for fixed slots (device_type, compatible,
+    reg, reg-names, ranges, status). 'standard' and 'vendor' return None for
+    the sub-key, signalling that the within-bucket key is computed by
+    the pairing rules."""
+    stripped = name.lstrip('#')
+    if name == 'model':
+        return (0, 0)
+    if name == 'compatible':
+        return (1, 0)
+    return (2, None)
+
+
 # Declarative pairing rules: each is a callable
 #   (name, all_names) -> anchor_name_or_None
 # If a rule returns an anchor, the property sorts immediately after the
@@ -633,13 +662,16 @@ def _pair_x_names(name, all_names):
 PAIRING_RULES = (_pair_pinctrl_names, _pair_x_names)
 
 
-def _property_sort_key(name, all_names):
+def _property_sort_key(dl, name, all_names):
     """Sort key for a property among its node-body siblings.
 
     Format: (bucket, within_key, tiebreak). 'within_key' for
     standard/vendor buckets follows pairing rules: a property paired
     with anchor X sorts as if it were X with a higher tiebreak."""
-    bucket, fixed_sub = _property_bucket(name)
+    if dl.is_root:
+        bucket, fixed_sub = _property_bucket_root(name)
+    else:
+        bucket, fixed_sub = _property_bucket(name)
     if fixed_sub is not None:
         return (bucket, (), fixed_sub)
 
@@ -674,7 +706,7 @@ def check_property_order(ctx):
         if len(props) < 2:
             continue
         all_names = [p.prop_name for p in props]
-        keyed = [(p, _property_sort_key(p.prop_name, all_names))
+        keyed = [(p, _property_sort_key(dl, p.prop_name, all_names))
                  for p in props]
         for k in range(1, len(keyed)):
             if keyed[k][1] < keyed[k - 1][1]:
diff --git a/scripts/dtc/dt-style-selftest/bad/dts-digit-node-order.dts b/scripts/dtc/dt-style-selftest/bad/dts-digit-node-order.dts
new file mode 100644
index 000000000000..74c956398324
--- /dev/null
+++ b/scripts/dtc/dt-style-selftest/bad/dts-digit-node-order.dts
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	memory@a0000000 {
+		device_type = "memory";
+		reg = <0x0 0xa0000000 0x0 0x0>;
+	};
+
+	pmu {
+		compatible = "example,pmu";
+	};
+
+	soc@0 {
+		compatible = "simple-bus";
+		ranges = <0 0 0 0xc0000000>;
+
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		serial@20000 {
+			compatible = "example,serial";
+			reg = <0x20000 0x1000>;
+		};
+
+		interrupt-controller@10000 {
+			compatible = "example,intc";
+			reg = <0x10000 0x1000>;
+			interrupts = <1 2 3>;
+		};
+
+		serial@30000 {
+			compatible = "example,serial";
+			reg = <0x30000 0x1000>;
+		};
+	};
+};
diff --git a/scripts/dtc/dt-style-selftest/bad/dts-property-order.dts b/scripts/dtc/dt-style-selftest/bad/dts-property-order.dts
index f31abb6ceae4..eb8b8b29fec5 100644
--- a/scripts/dtc/dt-style-selftest/bad/dts-property-order.dts
+++ b/scripts/dtc/dt-style-selftest/bad/dts-property-order.dts
@@ -6,6 +6,11 @@
 /dts-v1/;
 
 / {
+	compatible = "example,test-board", "example,test-soc";
+	model = "DT style selftest";
+	qcom,board-id = <8 0>;
+	chassis-type = "handset";
+
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
diff --git a/scripts/dtc/dt-style-selftest/expected/dts-digit-node-order.dts.txt b/scripts/dtc/dt-style-selftest/expected/dts-digit-node-order.dts.txt
new file mode 100644
index 000000000000..1f41acdea0b0
--- /dev/null
+++ b/scripts/dtc/dt-style-selftest/expected/dts-digit-node-order.dts.txt
@@ -0,0 +1,2 @@
+# mode=strict
+bad/dts-digit-node-order.dts:29: [child-address-order] child node @10000 out of address order
diff --git a/scripts/dtc/dt-style-selftest/expected/dts-property-order.dts.txt b/scripts/dtc/dt-style-selftest/expected/dts-property-order.dts.txt
index 4bc21328625f..65977f96331d 100644
--- a/scripts/dtc/dt-style-selftest/expected/dts-property-order.dts.txt
+++ b/scripts/dtc/dt-style-selftest/expected/dts-property-order.dts.txt
@@ -1,6 +1,8 @@
 # mode=strict
-bad/dts-property-order.dts:15: [property-order] property 'compatible' out of canonical order (should sort before 'reg')
-bad/dts-property-order.dts:16: [property-order] property 'device_type' out of canonical order (should sort before 'compatible')
-bad/dts-property-order.dts:25: [property-order] property 'dma-coherent' out of canonical order (should sort before 'status')
-bad/dts-property-order.dts:30: [property-order] property 'compatible' out of canonical order (should sort before 'ranges')
-bad/dts-property-order.dts:40: [property-order] property 'compatible' out of canonical order (should sort before 'interrupts')
+bad/dts-property-order.dts:10: [property-order] property 'model' out of canonical order (should sort before 'compatible')
+bad/dts-property-order.dts:12: [property-order] property 'chassis-type' out of canonical order (should sort before 'qcom,board-id')
+bad/dts-property-order.dts:20: [property-order] property 'compatible' out of canonical order (should sort before 'reg')
+bad/dts-property-order.dts:21: [property-order] property 'device_type' out of canonical order (should sort before 'compatible')
+bad/dts-property-order.dts:30: [property-order] property 'dma-coherent' out of canonical order (should sort before 'status')
+bad/dts-property-order.dts:35: [property-order] property 'compatible' out of canonical order (should sort before 'ranges')
+bad/dts-property-order.dts:45: [property-order] property 'compatible' out of canonical order (should sort before 'interrupts')
diff --git a/scripts/dtc/dt-style-selftest/expected/dts-property-order.dtso.txt b/scripts/dtc/dt-style-selftest/expected/dts-property-order.dtso.txt
index a78b8c042aa5..124183fab2ad 100644
--- a/scripts/dtc/dt-style-selftest/expected/dts-property-order.dtso.txt
+++ b/scripts/dtc/dt-style-selftest/expected/dts-property-order.dtso.txt
@@ -1,4 +1,5 @@
 # mode=strict
+bad/dts-property-order.dtso:11: [property-order] property 'model' out of canonical order (should sort before 'compatible')
 bad/dts-property-order.dtso:13: [property-order] property 'chassis-type' out of canonical order (should sort before 'qcom,board-id')
 bad/dts-property-order.dtso:21: [property-order] property 'compatible' out of canonical order (should sort before 'reg')
 bad/dts-property-order.dtso:22: [property-order] property 'device_type' out of canonical order (should sort before 'compatible')
diff --git a/scripts/dtc/dt-style-selftest/good/dts-digit-node-order.dts b/scripts/dtc/dt-style-selftest/good/dts-digit-node-order.dts
index cdf3f91ebe01..2b21dde7f3c8 100644
--- a/scripts/dtc/dt-style-selftest/good/dts-digit-node-order.dts
+++ b/scripts/dtc/dt-style-selftest/good/dts-digit-node-order.dts
@@ -5,13 +5,10 @@ / {
 	#address-cells = <1>;
 	#size-cells = <1>;
 
-	/* TODO: uncomment when child-address-order is fixed for top-level */
-	/*
 	memory@a0000000 {
 		device_type = "memory";
 		reg = <0x0 0xa0000000 0x0 0x0>;
 	};
-	*/
 
 	pmu {
 		compatible = "example,pmu";
diff --git a/scripts/dtc/dt-style-selftest/good/dts-property-order.dts b/scripts/dtc/dt-style-selftest/good/dts-property-order.dts
index 0e183e3459cd..3d847cc9fa3e 100644
--- a/scripts/dtc/dt-style-selftest/good/dts-property-order.dts
+++ b/scripts/dtc/dt-style-selftest/good/dts-property-order.dts
@@ -6,6 +6,11 @@
 /dts-v1/;
 
 / {
+	model = "DT style selftest";
+	compatible = "example,test-board", "example,test-soc";
+	chassis-type = "handset";
+	qcom,board-id = <8 0>;
+
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;

-- 
2.53.0


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

* [PATCH 5/9] dtc: dt-check-style: Drop stray backslash before quote for continuation-alignment
  2026-07-26 15:47 [PATCH 0/9] dtc: dt-check-style: Improvements for false positives Krzysztof Kozlowski
                   ` (3 preceding siblings ...)
  2026-07-26 15:47 ` [PATCH 4/9] dtc: dt-check-style: Handle sorting of top-level nodes and properties Krzysztof Kozlowski
@ 2026-07-26 15:47 ` Krzysztof Kozlowski
  2026-07-26 15:47 ` [PATCH 6/9] dtc: dt-check-style: Fix alignment of values in continued property lines Krzysztof Kozlowski
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-26 15:47 UTC (permalink / raw)
  To: Rob Herring, Saravana Kannan, Test User, Krzysztof Kozlowski,
	Conor Dooley
  Cc: devicetree, linux-kernel, Krzysztof Kozlowski

Drop stray backslash before the quote character in a warning for
continuation-alignment rule: (under "<" or \").  Since the '"' character
has no quotes, drop the quotes also from '<'.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
 scripts/dtc/dt-check-style                                      | 2 +-
 scripts/dtc/dt-style-selftest/expected/yaml-cont-align.yaml.txt | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style
index db4451e30dfb..4d90fbec0e39 100755
--- a/scripts/dtc/dt-check-style
+++ b/scripts/dtc/dt-check-style
@@ -936,7 +936,7 @@ def check_continuation_alignment(ctx):
             if _display_col(cont.indent_str) != target_col:
                 yield (cont.lineno,
                        'continuation should align to column %d '
-                       '(under "<" or \\")' % (target_col + 1))
+                       '(under < or ")' % (target_col + 1))
 
 
 def check_unclosed_block_comment(ctx):
diff --git a/scripts/dtc/dt-style-selftest/expected/yaml-cont-align.yaml.txt b/scripts/dtc/dt-style-selftest/expected/yaml-cont-align.yaml.txt
index b5576dd0f6b1..c0801c56d5db 100644
--- a/scripts/dtc/dt-style-selftest/expected/yaml-cont-align.yaml.txt
+++ b/scripts/dtc/dt-style-selftest/expected/yaml-cont-align.yaml.txt
@@ -1,2 +1,2 @@
 # mode=strict
-bad/yaml-cont-align.yaml:29: example 0 [continuation-alignment] continuation should align to column 11 (under "<" or \")
+bad/yaml-cont-align.yaml:29: example 0 [continuation-alignment] continuation should align to column 11 (under < or ")

-- 
2.53.0


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

* [PATCH 6/9] dtc: dt-check-style: Fix alignment of values in continued property lines
  2026-07-26 15:47 [PATCH 0/9] dtc: dt-check-style: Improvements for false positives Krzysztof Kozlowski
                   ` (4 preceding siblings ...)
  2026-07-26 15:47 ` [PATCH 5/9] dtc: dt-check-style: Drop stray backslash before quote for continuation-alignment Krzysztof Kozlowski
@ 2026-07-26 15:47 ` Krzysztof Kozlowski
  2026-07-26 15:56   ` sashiko-bot
  2026-07-26 15:47 ` [PATCH 7/9] dtc: dt-check-style: Consistently call 'kind' as 'file_type' Krzysztof Kozlowski
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-26 15:47 UTC (permalink / raw)
  To: Rob Herring, Saravana Kannan, Test User, Krzysztof Kozlowski,
	Conor Dooley
  Cc: devicetree, linux-kernel, Krzysztof Kozlowski

Continued lines in property assignments should be indented to opening
'<' or '"' if they also start with that character, e.g.:

  reg = <0x1000 0x100>,
        <0x2000 0x100>;

If the continued line is part of previous phandle, then alignment should
be to inner values to make it more readable, e.g.:

  reg = <0x1000 0x100
         0x2000 0x100>;

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
 scripts/dtc/dt-check-style                         | 20 ++++++++------
 .../dtc/dt-style-selftest/bad/dts-cont-align.dts   | 23 ++++++++++++++++
 .../dtc/dt-style-selftest/bad/yaml-cont-align.yaml |  4 ++-
 .../expected/dts-cont-align.dts.txt                |  8 ++++++
 .../expected/yaml-cont-align.yaml.txt              |  1 +
 .../expected/yaml-value-ws-multiline.yaml.txt      |  1 +
 .../dtc/dt-style-selftest/good/dts-cont-align.dts  | 11 +++++---
 .../dt-style-selftest/good/yaml-cont-align.yaml    | 32 ++++++++++++++++++++++
 8 files changed, 87 insertions(+), 13 deletions(-)

diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style
index 4d90fbec0e39..171a5e12fcbd 100755
--- a/scripts/dtc/dt-check-style
+++ b/scripts/dtc/dt-check-style
@@ -914,10 +914,11 @@ def check_line_length(ctx):
 
 def check_continuation_alignment(ctx):
     """A multi-line property's continuation lines must align their
-    first non-whitespace character to the display column of the first
-    '<' or '"' after the '=' in the leading line. Display columns are
-    used so tab-indented .dts files (where a continuation aligns with
-    tabs plus spaces) are compared correctly."""
+    first non-whitespace character to the display column of:
+    1. the first '<' or '"' after the '=' in the leading line, if continuation is with '<' or '"'
+    2. the first value, if the continuation is still the same phandle.
+    Display columns are used so tab-indented .dts files (where a continuation
+    aligns with tabs plus spaces) are compared correctly."""
     for dl in ctx.lines:
         if dl.linetype != LineType.PROPERTY:
             continue
@@ -928,15 +929,18 @@ def check_continuation_alignment(ctx):
             continue
         # First '<' or '"' after '='
         rest = dl.raw[eq + 1:]
-        m = re.search(r'[<"]', rest)
+        m = re.search(r'\s*([<"])', rest)
         if not m:
             continue
-        target_col = _display_col(dl.raw[:eq + 1 + m.start()])
+        target_col = _display_col(dl.raw[:eq + 1 + m.start(1)])
         for cont in dl.continuations:
-            if _display_col(cont.indent_str) != target_col:
+            target_offset = 0
+            if not re.match(r'[<"]', cont.stripped):
+                target_offset = 1
+            if _display_col(cont.indent_str) != target_col + target_offset:
                 yield (cont.lineno,
                        'continuation should align to column %d '
-                       '(under < or ")' % (target_col + 1))
+                       '(under < or ")' % (target_col + target_offset + 1))
 
 
 def check_unclosed_block_comment(ctx):
diff --git a/scripts/dtc/dt-style-selftest/bad/dts-cont-align.dts b/scripts/dtc/dt-style-selftest/bad/dts-cont-align.dts
new file mode 100644
index 000000000000..2087dac23d96
--- /dev/null
+++ b/scripts/dtc/dt-style-selftest/bad/dts-cont-align.dts
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+/dts-v1/;
+
+/ {
+	compatible = "example,test-board";
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	interrupt-controller@10000 {
+		compatible = "example,intc";
+		reg = <0x10000 0x1000>;
+		interrupts = <1 2 3>,
+				<4 5 6>,
+				<7 8 9>;
+		pinmux = <0x01
+			 0x02>,
+			<0x03
+			 0x04>;
+		power-domain-names = "foo",
+				"bar",
+					"baz";
+	};
+};
diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-cont-align.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-cont-align.yaml
index 92778540b056..d4662acc7b8f 100644
--- a/scripts/dtc/dt-style-selftest/bad/yaml-cont-align.yaml
+++ b/scripts/dtc/dt-style-selftest/bad/yaml-cont-align.yaml
@@ -26,5 +26,7 @@ examples:
     foo@1000 {
         compatible = "example,test-cont-align";
         reg = <0x1000 0x100>,
-            <0x2000 0x100>;
+            <0x2000 0x100>,
+              <0x3000
+              0x100>;
     };
diff --git a/scripts/dtc/dt-style-selftest/expected/dts-cont-align.dts.txt b/scripts/dtc/dt-style-selftest/expected/dts-cont-align.dts.txt
new file mode 100644
index 000000000000..4619d44ff98d
--- /dev/null
+++ b/scripts/dtc/dt-style-selftest/expected/dts-cont-align.dts.txt
@@ -0,0 +1,8 @@
+# mode=strict
+bad/dts-cont-align.dts:13: [continuation-alignment] continuation should align to column 30 (under < or ")
+bad/dts-cont-align.dts:14: [continuation-alignment] continuation should align to column 30 (under < or ")
+bad/dts-cont-align.dts:16: [continuation-alignment] continuation should align to column 27 (under < or ")
+bad/dts-cont-align.dts:17: [continuation-alignment] continuation should align to column 26 (under < or ")
+bad/dts-cont-align.dts:18: [continuation-alignment] continuation should align to column 27 (under < or ")
+bad/dts-cont-align.dts:20: [continuation-alignment] continuation should align to column 38 (under < or ")
+bad/dts-cont-align.dts:21: [continuation-alignment] continuation should align to column 38 (under < or ")
diff --git a/scripts/dtc/dt-style-selftest/expected/yaml-cont-align.yaml.txt b/scripts/dtc/dt-style-selftest/expected/yaml-cont-align.yaml.txt
index c0801c56d5db..0047276bd3df 100644
--- a/scripts/dtc/dt-style-selftest/expected/yaml-cont-align.yaml.txt
+++ b/scripts/dtc/dt-style-selftest/expected/yaml-cont-align.yaml.txt
@@ -1,2 +1,3 @@
 # mode=strict
 bad/yaml-cont-align.yaml:29: example 0 [continuation-alignment] continuation should align to column 11 (under < or ")
+bad/yaml-cont-align.yaml:31: example 0 [continuation-alignment] continuation should align to column 12 (under < or ")
diff --git a/scripts/dtc/dt-style-selftest/expected/yaml-value-ws-multiline.yaml.txt b/scripts/dtc/dt-style-selftest/expected/yaml-value-ws-multiline.yaml.txt
index 3df55b1762d0..dbf0c13ba862 100644
--- a/scripts/dtc/dt-style-selftest/expected/yaml-value-ws-multiline.yaml.txt
+++ b/scripts/dtc/dt-style-selftest/expected/yaml-value-ws-multiline.yaml.txt
@@ -1,2 +1,3 @@
 # mode=strict
 bad/yaml-value-ws-multiline.yaml:25: example 0 [value-whitespace] extra whitespace inside <...>
+bad/yaml-value-ws-multiline.yaml:26: example 0 [continuation-alignment] continuation should align to column 12 (under < or ")
diff --git a/scripts/dtc/dt-style-selftest/good/dts-cont-align.dts b/scripts/dtc/dt-style-selftest/good/dts-cont-align.dts
index 36fb4eefcd83..1a1c07c09a41 100644
--- a/scripts/dtc/dt-style-selftest/good/dts-cont-align.dts
+++ b/scripts/dtc/dt-style-selftest/good/dts-cont-align.dts
@@ -18,9 +18,12 @@ interrupt-controller@10000 {
 		interrupts = <1 2 3>,
 			     <4 5 6>,
 			     <7 8 9>;
-		pinmux = <
-			 0x01
-			 0x02
-			 >;
+		pinmux = <0x01
+			  0x02>,
+			 <0x03
+			  0x04>;
+		power-domain-names = "foo",
+				     "bar",
+				     "baz";
 	};
 };
diff --git a/scripts/dtc/dt-style-selftest/good/yaml-cont-align.yaml b/scripts/dtc/dt-style-selftest/good/yaml-cont-align.yaml
new file mode 100644
index 000000000000..2e7b8582bb7c
--- /dev/null
+++ b/scripts/dtc/dt-style-selftest/good/yaml-cont-align.yaml
@@ -0,0 +1,32 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/test-good-cont-align.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Test fixture with aligned multi-line property
+
+maintainers:
+  - Test User <test@example.com>
+
+properties:
+  compatible:
+    const: example,test-cont-align
+  reg:
+    maxItems: 2
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    foo@1000 {
+        compatible = "example,test-cont-align";
+        reg = <0x1000 0x100>,
+              <0x2000 0x100>,
+              <0x3000
+               0x100>;
+    };

-- 
2.53.0


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

* [PATCH 7/9] dtc: dt-check-style: Consistently call 'kind' as 'file_type'
  2026-07-26 15:47 [PATCH 0/9] dtc: dt-check-style: Improvements for false positives Krzysztof Kozlowski
                   ` (5 preceding siblings ...)
  2026-07-26 15:47 ` [PATCH 6/9] dtc: dt-check-style: Fix alignment of values in continued property lines Krzysztof Kozlowski
@ 2026-07-26 15:47 ` Krzysztof Kozlowski
  2026-07-26 15:53   ` sashiko-bot
  2026-07-26 15:47 ` [PATCH 8/9] dtc: dt-check-style: Introduce 'stricter' mode Krzysztof Kozlowski
  2026-07-26 15:47 ` [PATCH 9/9] MAINTAINERS: dt-bindings: Include dt-check-style in DT binding entry Krzysztof Kozlowski
  8 siblings, 1 reply; 15+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-26 15:47 UTC (permalink / raw)
  To: Rob Herring, Saravana Kannan, Test User, Krzysztof Kozlowski,
	Conor Dooley
  Cc: devicetree, linux-kernel, Krzysztof Kozlowski

Script was using different names for variables or attributes with the
same meaning: the type of file (YAML, DTS, DTSI, DTSO).  Unify 'kind',
'input_kind' and function input_kind() to consistent 'file_type'.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
 scripts/dtc/dt-check-style | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style
index 171a5e12fcbd..8c049c04b865 100755
--- a/scripts/dtc/dt-check-style
+++ b/scripts/dtc/dt-check-style
@@ -314,13 +314,13 @@ def collect_labels_and_refs(text):
 
 class Ctx:
     """Context passed to each rule check. Carries the parsed lines,
-    raw text, mode and kind."""
+    raw text, mode and file_type."""
 
-    def __init__(self, lines, text, mode, kind):
+    def __init__(self, lines, text, mode, file_type):
         self.lines = lines
         self.text = text
         self.mode = mode               # 'relaxed' or 'strict'
-        if kind in DTS_FAMILY:
+        if file_type in DTS_FAMILY:
             self.file_type = 'dts'
         else:
             self.file_type = 'yaml'
@@ -519,7 +519,7 @@ def _walk_bodies(lines):
 
 
 def _natural_sort_key(s):
-    """Split a string into a tuple of (kind, value) pairs that compares
+    """Split a string into a tuple of (file_type, value) pairs that compares
     numeric runs as ints, so 'foo10' sorts after 'foo2'."""
     parts = []
     for part in re.split(r'(\d+)', s):
@@ -1053,14 +1053,14 @@ RULES = [
 ]
 
 
-def select_rules(mode, input_kind):
+def select_rules(mode, file_type):
     """Return rules that apply to the given mode and input type."""
     rank = {'relaxed': 0, 'strict': 1}
     out = []
     for r in RULES:
         if rank[r.mode] > rank[mode]:
             continue
-        if input_kind not in r.applies_to:
+        if file_type not in r.applies_to:
             continue
         out.append(r)
     return out
@@ -1132,7 +1132,7 @@ def iter_dts_file(filepath):
 # Top-level processing
 # ---------------------------------------------------------------------------
 
-def input_kind(filepath):
+def get_file_type(filepath):
     p = filepath.lower()
     if p.endswith('.yaml') or p.endswith('.yml'):
         return 'yaml'
@@ -1152,17 +1152,17 @@ DTS_FAMILY = ('dts', 'dtsi', 'dtso')
 def collect_findings(filepath, mode):
     """Return a (lines, count) pair for filepath. lines is a list of
     formatted output strings; count is the number of findings."""
-    kind = input_kind(filepath)
-    if kind == 'yaml':
+    file_type = get_file_type(filepath)
+    if file_type == 'yaml':
         iterator = iter_yaml_examples(filepath)
-    elif kind in DTS_FAMILY:
+    elif file_type in DTS_FAMILY:
         iterator = iter_dts_file(filepath)
     else:
         return (['%s: unknown file type, skipping' % filepath], 0)
 
     out = []
     for text, base, idx in iterator:
-        for lineno, rule, msg in check_block(text, mode, kind):
+        for lineno, rule, msg in check_block(text, mode, file_type):
             abs_line = base + lineno - 1
             ex_tag = '' if idx is None else ' example %d' % idx
             out.append('%s:%d:%s [%s] %s' %

-- 
2.53.0


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

* [PATCH 8/9] dtc: dt-check-style: Introduce 'stricter' mode
  2026-07-26 15:47 [PATCH 0/9] dtc: dt-check-style: Improvements for false positives Krzysztof Kozlowski
                   ` (6 preceding siblings ...)
  2026-07-26 15:47 ` [PATCH 7/9] dtc: dt-check-style: Consistently call 'kind' as 'file_type' Krzysztof Kozlowski
@ 2026-07-26 15:47 ` Krzysztof Kozlowski
  2026-07-26 15:54   ` sashiko-bot
  2026-07-26 15:47 ` [PATCH 9/9] MAINTAINERS: dt-bindings: Include dt-check-style in DT binding entry Krzysztof Kozlowski
  8 siblings, 1 reply; 15+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-26 15:47 UTC (permalink / raw)
  To: Rob Herring, Saravana Kannan, Test User, Krzysztof Kozlowski,
	Conor Dooley
  Cc: devicetree, linux-kernel, Krzysztof Kozlowski

Two rules, which are enabled in 'strict' mode make little sense for DTS:

1. line-length, limiting length of line to 80 characters: DTS often has
   a bit longer lines, especially for interconnects or heavily nested
   opp-level.  Checkpatch already does not warn for exceeding 80
   characters.

2. unused-labels, discouraging unused labels in DTS or YAML (not DTSI or
   DTSO): while not harming this leads to many false positives, e.g.
   unused PMIC regulators in DTS.

Introduce another 'mode' of running beside existing relaxed and strict:
a 'stricter' one where these two rules are moved for DTS.  Intention is
to have in-tree DTS passing 'strict' mode.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
 scripts/dtc/dt-check-style                         | 26 +++++++++++++++-------
 .../dtc/dt-style-selftest/bad/dts-line-length.dts  | 21 +++++++++++++++++
 .../dtc/dt-style-selftest/bad/dts-unused-label.dts | 21 +++++++++++++++++
 .../expected/dts-line-length.dts.txt               |  2 ++
 .../expected/dts-unused-label.dts.txt              |  2 ++
 5 files changed, 64 insertions(+), 8 deletions(-)

diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style
index 8c049c04b865..7e1d80ceab78 100755
--- a/scripts/dtc/dt-check-style
+++ b/scripts/dtc/dt-check-style
@@ -5,12 +5,14 @@
 # .dts/.dtsi/.dtso source files. Enforces rules from
 # Documentation/devicetree/bindings/dts-coding-style.rst.
 #
-# Two modes:
+# Three modes:
 #   --mode=relaxed (default)
 #     Only rules that produce zero warnings on the current tree.
 #     Suitable for dt_binding_check.
 #   --mode=strict
-#     All rules. Required for new submissions.
+#     Most of the rules. Required for new submissions.
+#   --mode=stricter
+#     All rules, including ones having false positives.
 #
 # Two input types (auto-detected by file extension):
 #   *.yaml             -- DT binding; check each example block
@@ -319,7 +321,7 @@ class Ctx:
     def __init__(self, lines, text, mode, file_type):
         self.lines = lines
         self.text = text
-        self.mode = mode               # 'relaxed' or 'strict'
+        self.mode = mode               # 'relaxed', 'strict' or 'stricter'
         if file_type in DTS_FAMILY:
             self.file_type = 'dts'
         else:
@@ -332,7 +334,8 @@ class Rule:
     def __init__(self, name, mode, description, check,
                  applies_to=('yaml', 'dts', 'dtsi', 'dtso')):
         self.name = name
-        self.mode = mode               # 'relaxed' or 'strict'
+        # 'relaxed', 'strict', 'stricter' ordictionary mapping file_type to mode
+        self.mode = mode
         self.description = description
         self.check = check
         self.applies_to = applies_to   # input types this rule covers
@@ -1042,20 +1045,27 @@ RULES = [
          check_node_close_alone),
     Rule('line-length', 'strict',
          'lines must not exceed 80 columns',
-         check_line_length),
+         check_line_length, applies_to=('yaml')),
+    Rule('line-length-dts', 'stricter',
+         'lines must not exceed 80 columns',
+         check_line_length, applies_to=('dts', 'dtsi', 'dtso')),
     Rule('continuation-alignment', 'strict',
          'multi-line property continuations align under "<" or "\\""',
          check_continuation_alignment),
     Rule('unused-labels', 'strict',
          'every label must be &-referenced in the same example/file '
          '(skipped for .dtsi/.dtso since labels there are exported)',
-         check_unused_labels, applies_to=('yaml', 'dts')),
+         check_unused_labels, applies_to=('yaml')),
+    Rule('unused-labels-dts', 'stricter',
+         'every label must be &-referenced in the same example/file '
+         '(skipped for .dtsi/.dtso since labels there are exported)',
+         check_unused_labels, applies_to=('dts')),
 ]
 
 
 def select_rules(mode, file_type):
     """Return rules that apply to the given mode and input type."""
-    rank = {'relaxed': 0, 'strict': 1}
+    rank = {'relaxed': 0, 'strict': 1, 'stricter': 2}
     out = []
     for r in RULES:
         if rank[r.mode] > rank[mode]:
@@ -1183,7 +1193,7 @@ def main():
         description='Check DTS coding style on YAML examples and '
         '.dts/.dtsi/.dtso files.',
         fromfile_prefix_chars='@')
-    ap.add_argument('--mode', choices=('relaxed', 'strict'),
+    ap.add_argument('--mode', choices=('relaxed', 'strict', 'stricter'),
                     default='relaxed',
                     help='which rule set to apply (default: relaxed)')
     ap.add_argument('-j', '--jobs', type=int, default=0,
diff --git a/scripts/dtc/dt-style-selftest/bad/dts-line-length.dts b/scripts/dtc/dt-style-selftest/bad/dts-line-length.dts
new file mode 100644
index 000000000000..d1dacc5c76fb
--- /dev/null
+++ b/scripts/dtc/dt-style-selftest/bad/dts-line-length.dts
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+/*
+ * Test fixture: Unused label in DTS
+ */
+
+/dts-v1/;
+
+/ {
+	soc@0 {
+		compatible = "simple-bus";
+		ranges = <0 0 0 0xc0000000>;
+
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		foo@1000 {
+			compatible = "example,test-line-length-this-is-a-very-long-name-indeed-yeah";
+			reg = <0x1000 0x100>;
+		};
+	};
+};
diff --git a/scripts/dtc/dt-style-selftest/bad/dts-unused-label.dts b/scripts/dtc/dt-style-selftest/bad/dts-unused-label.dts
new file mode 100644
index 000000000000..90802ae107e1
--- /dev/null
+++ b/scripts/dtc/dt-style-selftest/bad/dts-unused-label.dts
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+/*
+ * Test fixture: Unused label in DTS
+ */
+
+/dts-v1/;
+
+/ {
+	soc@0 {
+		compatible = "simple-bus";
+		ranges = <0 0 0 0xc0000000>;
+
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		dev: device@1000 {
+			compatible = "example,test-unused-label";
+			reg = <0x1000 0x100>;
+		};
+	};
+};
diff --git a/scripts/dtc/dt-style-selftest/expected/dts-line-length.dts.txt b/scripts/dtc/dt-style-selftest/expected/dts-line-length.dts.txt
new file mode 100644
index 000000000000..8ed08c309632
--- /dev/null
+++ b/scripts/dtc/dt-style-selftest/expected/dts-line-length.dts.txt
@@ -0,0 +1,2 @@
+# mode=stricter
+bad/dts-line-length.dts:17: [line-length-dts] line exceeds 80 columns (101)
diff --git a/scripts/dtc/dt-style-selftest/expected/dts-unused-label.dts.txt b/scripts/dtc/dt-style-selftest/expected/dts-unused-label.dts.txt
new file mode 100644
index 000000000000..4cdcaba3ba2f
--- /dev/null
+++ b/scripts/dtc/dt-style-selftest/expected/dts-unused-label.dts.txt
@@ -0,0 +1,2 @@
+# mode=stricter
+bad/dts-unused-label.dts:16: [unused-labels-dts] label 'dev' defined but never &-referenced

-- 
2.53.0


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

* [PATCH 9/9] MAINTAINERS: dt-bindings: Include dt-check-style in DT binding entry
  2026-07-26 15:47 [PATCH 0/9] dtc: dt-check-style: Improvements for false positives Krzysztof Kozlowski
                   ` (7 preceding siblings ...)
  2026-07-26 15:47 ` [PATCH 8/9] dtc: dt-check-style: Introduce 'stricter' mode Krzysztof Kozlowski
@ 2026-07-26 15:47 ` Krzysztof Kozlowski
  8 siblings, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-26 15:47 UTC (permalink / raw)
  To: Rob Herring, Saravana Kannan, Test User, Krzysztof Kozlowski,
	Conor Dooley
  Cc: devicetree, linux-kernel, Krzysztof Kozlowski

The dt-check-style tool is in interest of Devicetree bindings
maintainers, not only the driver OF-core (where it is covered through
"F: scripts/dtc/"), because it covers the DTS and the bindings.  Add it
to the DT bindings maintainers entry.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
 MAINTAINERS | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index cc3c01eecfa2..2c8aadac544d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -20374,6 +20374,8 @@ T:	git git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git
 F:	Documentation/devicetree/
 F:	arch/*/boot/dts/
 F:	include/dt-bindings/
+F:	scripts/dtc/dt-check-style
+F:	scripts/dtc/dt-style-selftest
 
 OPENCOMPUTE PTP CLOCK DRIVER
 M:	Vadim Fedorenko <vadim.fedorenko@linux.dev>

-- 
2.53.0


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

* Re: [PATCH 7/9] dtc: dt-check-style: Consistently call 'kind' as 'file_type'
  2026-07-26 15:47 ` [PATCH 7/9] dtc: dt-check-style: Consistently call 'kind' as 'file_type' Krzysztof Kozlowski
@ 2026-07-26 15:53   ` sashiko-bot
  0 siblings, 0 replies; 15+ messages in thread
From: sashiko-bot @ 2026-07-26 15:53 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: devicetree, robh, conor+dt

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Blind search-and-replace corrupted the docstring for `_natural_sort_key`.
--

--- Patch [7]: [PATCH 7/9] dtc: dt-check-style: Consistently call 'kind' as 'file_type' ---
commit 8e2fd209c720e5544c185a9ec09b15945051b1cb
Author: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

dtc: dt-check-style: Consistently call 'kind' as 'file_type'

Script was using different names for variables or attributes with the
same meaning: the type of file (YAML, DTS, DTSI, DTSO).  Unify 'kind',
'input_kind' and function input_kind() to consistent 'file_type'.

> diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style
> index 171a5e12fcbd8..8c049c04b865c 100755
> --- a/scripts/dtc/dt-check-style
> +++ b/scripts/dtc/dt-check-style

[ ... ]

> @@ -519,7 +519,7 @@ def _walk_bodies(lines):
>  
>  
>  def _natural_sort_key(s):
> -    """Split a string into a tuple of (kind, value) pairs that compares
> +    """Split a string into a tuple of (file_type, value) pairs that compares
>      numeric runs as ints, so 'foo10' sorts after 'foo2'."""
>      parts = []
>      for part in re.split(r'(\d+)', s):

[Severity: Low]
Does the docstring still accurately describe the return value of
_natural_sort_key()?

It looks like the global rename changed 'kind' to 'file_type' here, but in
this context, 'kind' referred to the type of the split part (numeric or
string) for natural sorting, rather than the type of file.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260726-n-dts-style-checker-continued-v1-0-b05b8f897670@oss.qualcomm.com?part=7

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

* Re: [PATCH 8/9] dtc: dt-check-style: Introduce 'stricter' mode
  2026-07-26 15:47 ` [PATCH 8/9] dtc: dt-check-style: Introduce 'stricter' mode Krzysztof Kozlowski
@ 2026-07-26 15:54   ` sashiko-bot
  0 siblings, 0 replies; 15+ messages in thread
From: sashiko-bot @ 2026-07-26 15:54 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: devicetree, conor+dt, robh

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Medium] Missing trailing commas in `applies_to` arguments cause them to be evaluated as strings instead of tuples, breaking the `--list-rules` output formatting.
- [Low] Misleading documentation for `Rule.mode` claims dictionary support, which would crash the script.
- [Low] Copy-paste error in the header comment of the `dts-line-length.dts` test fixture.
--

--- Patch [8]: [PATCH 8/9] dtc: dt-check-style: Introduce 'stricter' mode ---
commit 2b6676a210ee00e188dac94bab5f81848b3977f1
Author: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

dtc: dt-check-style: Introduce 'stricter' mode
    
Two rules, which are enabled in 'strict' mode make little sense for DTS:

1. line-length, limiting length of line to 80 characters: DTS often has
   a bit longer lines, especially for interconnects or heavily nested
   opp-level.  Checkpatch already does not warn for exceeding 80
   characters.

2. unused-labels, discouraging unused labels in DTS or YAML (not DTSI or
   DTSO): while not harming this leads to many false positives, e.g.
   unused PMIC regulators in DTS.

Introduce another 'mode' of running beside existing relaxed and strict:
a 'stricter' one where these two rules are moved for DTS.  Intention is
to have in-tree DTS passing 'strict' mode.

> diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style
> index 8c049c04b865c..7e1d80ceab780 100755
> --- a/scripts/dtc/dt-check-style
> +++ b/scripts/dtc/dt-check-style

[ ... ]

> @@ -332,7 +334,8 @@ class Rule:
>      def __init__(self, name, mode, description, check,
>                   applies_to=('yaml', 'dts', 'dtsi', 'dtso')):
>          self.name = name
> -        self.mode = mode               # 'relaxed' or 'strict'
> +        # 'relaxed', 'strict', 'stricter' ordictionary mapping file_type to mode
> +        self.mode = mode

[Severity: Low]
This isn't a bug, but is there a typo ("ordictionary") in this comment? 

Also, if a dictionary were actually passed for mode based on this comment, 
wouldn't it cause a crash in select_rules() with a TypeError? The rank 
dictionary expects r.mode to be a hashable type rather than a dict.

[ ... ]

> @@ -1042,20 +1045,27 @@ RULES = [
>           check_node_close_alone),
>      Rule('line-length', 'strict',
>           'lines must not exceed 80 columns',
> -         check_line_length),
> +         check_line_length, applies_to=('yaml')),

[Severity: Medium]
Will python evaluate applies_to=('yaml') as a string rather than a 
single-element tuple because it lacks a trailing comma?

It looks like this causes the --list-rules output to iterate over the 
characters of the string instead, resulting in [y,a,m,l] when applies_to 
is consumed by ','.join(r.applies_to) in main(). 

Could a trailing comma be added like ('yaml',) to ensure it is treated 
as a tuple? This same issue seems to apply to the other single-element tuples 
added below for applies_to=('yaml') and applies_to=('dts').

> +    Rule('line-length-dts', 'stricter',
> +         'lines must not exceed 80 columns',
> +         check_line_length, applies_to=('dts', 'dtsi', 'dtso')),
>      Rule('continuation-alignment', 'strict',
>           'multi-line property continuations align under "<" or "\\""',
>           check_continuation_alignment),
>      Rule('unused-labels', 'strict',
>           'every label must be &-referenced in the same example/file '
>           '(skipped for .dtsi/.dtso since labels there are exported)',
> -         check_unused_labels, applies_to=('yaml', 'dts')),
> +         check_unused_labels, applies_to=('yaml')),
> +    Rule('unused-labels-dts', 'stricter',
> +         'every label must be &-referenced in the same example/file '
> +         '(skipped for .dtsi/.dtso since labels there are exported)',
> +         check_unused_labels, applies_to=('dts')),
>  ]

[ ... ]

> diff --git a/scripts/dtc/dt-style-selftest/bad/dts-line-length.dts b/scripts/dtc/dt-style-selftest/bad/dts-line-length.dts
> new file mode 100644
> index 0000000000000..d1dacc5c76fbf
> --- /dev/null
> +++ b/scripts/dtc/dt-style-selftest/bad/dts-line-length.dts
> @@ -0,0 +1,21 @@
> +// SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +/*
> + * Test fixture: Unused label in DTS
> + */

[Severity: Low]
This isn't a bug, but does this comment accurately describe the test fixture? 
It appears it might have been copy-pasted from the unused-label test, since 
this file is testing line lengths.

> +
> +/dts-v1/;
> +
> +/ {
> +	soc@0 {
> +		compatible = "simple-bus";

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260726-n-dts-style-checker-continued-v1-0-b05b8f897670@oss.qualcomm.com?part=8

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

* Re: [PATCH 6/9] dtc: dt-check-style: Fix alignment of values in continued property lines
  2026-07-26 15:47 ` [PATCH 6/9] dtc: dt-check-style: Fix alignment of values in continued property lines Krzysztof Kozlowski
@ 2026-07-26 15:56   ` sashiko-bot
  0 siblings, 0 replies; 15+ messages in thread
From: sashiko-bot @ 2026-07-26 15:56 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: devicetree, robh, conor+dt

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The new alignment rule incorrectly forces a standalone closing bracket (e.g., '>;') to align with inner values instead of the opening bracket.
- [Low] The hardcoded error message is misleading when target_offset == 1, as it claims the expected column is 'under < or "'.
--

--- Patch [6]: [PATCH 6/9] dtc: dt-check-style: Fix alignment of values in continued property lines ---
commit 3d17d86c35121d71a779318164c4a25fa384d8c1
Author: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

dtc: dt-check-style: Fix alignment of values in continued property lines

This commit updates the dt-check-style script to enforce that continued
property lines aligning to inner values are indented one space past the
opening '<' or '"'. It also includes tests to verify this behavior.

> diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style
> index 4d90fbec0e391..171a5e12fcbd8 100755
> --- a/scripts/dtc/dt-check-style
> +++ b/scripts/dtc/dt-check-style

[ ... ]

> @@ -928,15 +929,18 @@ def check_continuation_alignment(ctx):
>              continue
>          # First '<' or '"' after '='
>          rest = dl.raw[eq + 1:]
> -        m = re.search(r'[<"]', rest)
> +        m = re.search(r'\s*([<"])', rest)
>          if not m:
>              continue
> -        target_col = _display_col(dl.raw[:eq + 1 + m.start()])
> +        target_col = _display_col(dl.raw[:eq + 1 + m.start(1)])
>          for cont in dl.continuations:
> -            if _display_col(cont.indent_str) != target_col:
> +            target_offset = 0
> +            if not re.match(r'[<"]', cont.stripped):
> +                target_offset = 1

[Severity: Medium]
Will this new alignment rule incorrectly flag standalone closing brackets?

If a continuation line is just a closing bracket like ">;", the script
evaluates re.match(r'[<"]', cont.stripped) as false, which sets
target_offset = 1. This forces developers to indent the closing bracket
one space to the right of the opening bracket instead of aligning them.

> +            if _display_col(cont.indent_str) != target_col + target_offset:
>                  yield (cont.lineno,
>                         'continuation should align to column %d '
> -                       '(under < or ")' % (target_col + 1))
> +                       '(under < or ")' % (target_col + target_offset + 1))

[Severity: Low]
Is this error message accurate when target_offset is 1?

When the script expects alignment to the inner value (target_offset == 1),
the error message still tells developers to align "(under < or ")". This
could be confusing since the target column provided is actually one space
to the right of the bracket or quote.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260726-n-dts-style-checker-continued-v1-0-b05b8f897670@oss.qualcomm.com?part=6

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

* Re: [PATCH 4/9] dtc: dt-check-style: Handle sorting of top-level nodes and properties
  2026-07-26 15:47 ` [PATCH 4/9] dtc: dt-check-style: Handle sorting of top-level nodes and properties Krzysztof Kozlowski
@ 2026-07-26 15:57   ` sashiko-bot
  0 siblings, 0 replies; 15+ messages in thread
From: sashiko-bot @ 2026-07-26 15:57 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: devicetree, robh, conor+dt

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Medium] Tree hierarchy tracking in `_walk_bodies()` is broken, incorrectly assigning closed sibling nodes as parents to subsequent siblings.
- [Medium] `_property_bucket_root()` collapses standard and vendor properties into a single bucket, breaking canonical property ordering at the root node.
- [Medium] Top-level addressed nodes are exempted from address sorting but are never subjected to the node name sorting claimed in the commit message.
--

--- Patch [4]: [PATCH 4/9] dtc: dt-check-style: Handle sorting of top-level nodes and properties ---
commit d752014f34dc3d4a2a9f9617748ec741da0cb1c5
Author: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

dtc: dt-check-style: Handle sorting of top-level nodes and properties

This commit updates the DTS styling rules for top-level nodes and properties.
It skips unit-address sorting for root nodes since they mix unit and non-unit
addresses. It also adds a special case for the 'model' property to sort before
'compatible' at the root node.

> diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style
> index 1937c6feb57ec..db4451e30dfbc 100755
> --- a/scripts/dtc/dt-check-style
> +++ b/scripts/dtc/dt-check-style

[ ... ]

> @@ -496,15 +497,21 @@ def _walk_bodies(lines):
>      in the input. Skips ref-nodes (&label) since those don't have an
>      intrinsic ordering."""
>      body_stack = [[]]
> +    node_stack = [[]]
> +    parent_dl = None
>      for dl in lines:
>          if dl.linetype == LineType.NODE_OPEN:
> +            dl.parent = parent_dl
> +            node_stack.append(dl)
>              body_stack[-1].append(dl)
>              body_stack.append([])
> +            parent_dl = dl
>              continue
>          if dl.linetype == LineType.NODE_CLOSE:
>              if len(body_stack) <= 1:
>                  # Unbalanced; ignore to avoid crashing on malformed input
>                  continue
> +            parent_dl = node_stack.pop()

[Severity: Medium]
Does this pop the node that just closed instead of the actual parent?

When node_stack.pop() is called here, it returns the node that just closed
because that was the last one appended. Does this cause subsequent siblings
to incorrectly inherit their preceding closed sibling as their parent instead
of the actual parent, corrupting the tree state for checks?

[ ... ]

> @@ -525,12 +532,18 @@ def _natural_sort_key(s):
>  
>  def check_child_address_order(ctx):
>      """Addressed siblings (foo@N) must appear in ascending address
> -    order within their parent node body."""
> +    order within their parent node body.
> +    Exception: Top-level in DTS follows name order, regardless of unit address
> +    in memory@N and soc@N nodes
> +    """
>      for children in _walk_bodies(ctx.lines):
>          addressed = []
>          for c in children:
>              if c.node_addr is None:
>                  continue
> +            if c.parent and c.parent.is_root:
> +                # Top-level does not use unit address sorting usually
> +                continue

[Severity: Medium]
The commit message mentions that the top-level part usually chooses sorting
by node name, not the unit address. However, looking at
check_child_name_order() elsewhere in the file, it unconditionally skips
nodes with a unit address:

    if c.node_addr is not None:
        continue

By skipping addressed nodes here in check_child_address_order() and not
updating check_child_name_order() to handle them, are top-level addressed
nodes now completely excluded from any ordering enforcement?

[ ... ]

> @@ -597,6 +610,22 @@ def _property_bucket(name):
>      return (5 if ',' in stripped else 4, None)
>  
>  
> +def _property_bucket_root(name):
> +    """Return the canonical bucket index for a property:
> +       0 model (for root nodes only)
> +       1 compatible
> +    Plus a sub-key inside the bucket for fixed slots (device_type, compatible,
> +    reg, reg-names, ranges, status). 'standard' and 'vendor' return None for
> +    the sub-key, signalling that the within-bucket key is computed by
> +    the pairing rules."""
> +    stripped = name.lstrip('#')
> +    if name == 'model':
> +        return (0, 0)
> +    if name == 'compatible':
> +        return (1, 0)
> +    return (2, None)

[Severity: Medium]
Does returning (2, None) here for all unhandled properties override the
standard bucketing rules for the root node?

The original _property_bucket() sorts properties into buckets (like 4 for
standard and 5 for vendor). Because this hardcodes (2, None) for everything
else, standard and vendor properties at the root node might now be grouped
together and sorted alphabetically against each other, overriding the standard
before vendor rule.

Is this the intended behavior?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260726-n-dts-style-checker-continued-v1-0-b05b8f897670@oss.qualcomm.com?part=4

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

* Re: [PATCH 3/9] dtc: dt-check-style: Handle root node in overlays
  2026-07-26 15:47 ` [PATCH 3/9] dtc: dt-check-style: Handle root node in overlays Krzysztof Kozlowski
@ 2026-07-26 16:00   ` sashiko-bot
  0 siblings, 0 replies; 15+ messages in thread
From: sashiko-bot @ 2026-07-26 16:00 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: robh, conor+dt, devicetree

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The patch introduces a regression for valid root nodes (e.g., labeled or with extra spacing) and fails to change behavior for overlay root nodes, rendering the intended fix ineffective and actively harmful.
- [Medium] The patch claims to fix "property order" false positives but exclusively modifies "child name order" logic, leaving property order checking unchanged.
--

--- Patch [3]: [PATCH 3/9] dtc: dt-check-style: Handle root node in overlays ---
commit 3ffd10d90b05e9e479a121a83377b237c94b4b24
Author: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

dtc: dt-check-style: Handle root node in overlays

This patch modifies the device tree style checker to detect root nodes in
overlays by matching specific node open strings. It stores this state in an
is_root attribute and uses it when checking child name order.

> This fixes false positives for property order for root nodes in overlays.

[Severity: Medium]
The commit message states this patch fixes "property order" false
positives, but the code exclusively modifies the child name order logic in
check_child_name_order(). Is check_property_order() supposed to use the new
is_root flag as well?

> diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style
> --- a/scripts/dtc/dt-check-style
> +++ b/scripts/dtc/dt-check-style

[ ... ]

> @@ -228,7 +229,10 @@ def classify_lines(text):
>              continue
>  
>          if code.endswith('{'):
> -            dl = DtsLine(i, raw, LineType.NODE_OPEN, depth, indent_str, code)
> +            is_root = False
> +            if code == '&{/} {' or code == '/ {':

[Severity: Medium]
Will this exact string match handle valid alternative spacings or labels?
For example, if the code contains a label like "label: / {" or extra
whitespace like "/  {", it seems this would fail to set is_root to True.

> +                is_root = True
> +            dl = DtsLine(i, raw, LineType.NODE_OPEN, depth, indent_str, code, is_root=is_root)
>              parse_node_header(dl)
>              out.append(dl)
>              depth += 1

[ ... ]

> @@ -550,7 +554,9 @@ def check_child_name_order(ctx):
>          for c in children:
>              if c.node_addr is not None:
>                  continue
> -            if c.node_name in (None, '/'):
> +            if c.node_name is None:
> +                continue
> +            if c.is_root:

[Severity: Medium]
Since this replaces the previous check for c.node_name in (None, '/'), could
it cause valid root nodes that were missed by the exact string match in
classify_lines() to incorrectly bypass this skip logic and trigger false
positives?

>                  continue
>              if c.ref_name is not None:
>                  continue

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260726-n-dts-style-checker-continued-v1-0-b05b8f897670@oss.qualcomm.com?part=3

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

end of thread, other threads:[~2026-07-26 16:00 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-26 15:47 [PATCH 0/9] dtc: dt-check-style: Improvements for false positives Krzysztof Kozlowski
2026-07-26 15:47 ` [PATCH 1/9] dtc: dt-check-style: Add missing /dts-v1/ to few test cases Krzysztof Kozlowski
2026-07-26 15:47 ` [PATCH 2/9] dtc: dt-check-style: Simplify setting depth of DtsLine Krzysztof Kozlowski
2026-07-26 15:47 ` [PATCH 3/9] dtc: dt-check-style: Handle root node in overlays Krzysztof Kozlowski
2026-07-26 16:00   ` sashiko-bot
2026-07-26 15:47 ` [PATCH 4/9] dtc: dt-check-style: Handle sorting of top-level nodes and properties Krzysztof Kozlowski
2026-07-26 15:57   ` sashiko-bot
2026-07-26 15:47 ` [PATCH 5/9] dtc: dt-check-style: Drop stray backslash before quote for continuation-alignment Krzysztof Kozlowski
2026-07-26 15:47 ` [PATCH 6/9] dtc: dt-check-style: Fix alignment of values in continued property lines Krzysztof Kozlowski
2026-07-26 15:56   ` sashiko-bot
2026-07-26 15:47 ` [PATCH 7/9] dtc: dt-check-style: Consistently call 'kind' as 'file_type' Krzysztof Kozlowski
2026-07-26 15:53   ` sashiko-bot
2026-07-26 15:47 ` [PATCH 8/9] dtc: dt-check-style: Introduce 'stricter' mode Krzysztof Kozlowski
2026-07-26 15:54   ` sashiko-bot
2026-07-26 15:47 ` [PATCH 9/9] MAINTAINERS: dt-bindings: Include dt-check-style in DT binding entry Krzysztof Kozlowski

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.