* [PATCH 0/2] dtc: dt-check-style: Improvements for continued properties
@ 2026-09-11 11:42 Krzysztof Kozlowski
2026-09-11 11:42 ` [PATCH 1/2] dtc: dt-check-style: Re-work classifying property continuations Krzysztof Kozlowski
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2026-09-11 11:42 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Saravana Kannan,
Test User
Cc: devicetree, linux-kernel, Krzysztof Kozlowski
Merging
=======
On top of:
https://patch.msgid.link/20260909-b4-dts-style-checker-continued-lines-v3-0-474bb324ae53@oss.qualcomm.com
Best regards,
Krzysztof
---
Krzysztof Kozlowski (2):
dtc: dt-check-style: Re-work classifying property continuations
dtc: dt-check-style: Handle multiple blank lines in continued properties
scripts/dtc/dt-check-style | 42 +++++++++--------
.../dtc/dt-style-selftest/bad/dts-blank-lines.dts | 37 +++++++++++++++
.../dt-style-selftest/bad/yaml-blank-lines.yaml | 54 ++++++++++++++++++++++
.../expected/dts-blank-lines.dts.txt | 6 +++
.../expected/yaml-blank-lines.yaml.txt | 6 +++
5 files changed, 125 insertions(+), 20 deletions(-)
---
base-commit: 664f1ec11b4dc75f6de70a52e8219f812b6e57b3
change-id: 20260911-dts-style-checker-blank-lines-13149dbf830b
prerequisite-change-id: 20260909-b4-dts-style-checker-continued-lines-c6895bacb860:v3
prerequisite-patch-id: 14fa558b453aaf560eb17d163500a433e38890bf
prerequisite-patch-id: f8ccd89f399b61ec1dc867ec7955a009c8c7b694
prerequisite-patch-id: 833114edb0c81877ed1182563426ba9695b81081
prerequisite-patch-id: 2ee62b9fd3ca36941fa9191b55136afb2bd699ed
prerequisite-patch-id: 464e2f568391edd2c3a39ea0d8920756a19e3159
prerequisite-patch-id: 0ddb7cb6bf6ba3503500ba8735ef77169a403edf
prerequisite-patch-id: 1fe3a764be34bc423a0e6abe13112948d0d948f0
Best regards,
--
Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] dtc: dt-check-style: Re-work classifying property continuations
2026-09-11 11:42 [PATCH 0/2] dtc: dt-check-style: Improvements for continued properties Krzysztof Kozlowski
@ 2026-09-11 11:42 ` Krzysztof Kozlowski
2026-09-11 11:42 ` [PATCH 2/2] dtc: dt-check-style: Handle multiple blank lines in continued properties Krzysztof Kozlowski
2026-09-16 21:18 ` [PATCH 0/2] dtc: dt-check-style: Improvements for " Rob Herring
2 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2026-09-11 11:42 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Saravana Kannan,
Test User
Cc: devicetree, linux-kernel, Krzysztof Kozlowski
Script has an enumeration of DTS Line types (LineType) and one type is a
continuation of multi-line property. This has limitations, because it
basically hides true type of a continued line which makes certain checks
difficult. For example detecting consecutive blank lines
(LineType.BLANK) will fail if the type is continuation.
clock-names = "foo",
/* Comment */
"bar";
Above code not only fails check_blank_lines() rule, but also messes up
how DtsLine array is constructed - the two middle continued lines are
not put under the DtsLine.continuations array.
The concepts of type of line (blank, preprocessor, property etc) and
actual continuation are orthogonal to most of the checks - the checks
need to know what sort of continued line it is. Fixing this solves
false positives of continued properties with blank lines and comments:
arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi:135: [blank-lines] consecutive blank lines
arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi:135: [blank-lines] blank line at end of node body
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
scripts/dtc/dt-check-style | 36 ++++++++++++++++--------------------
1 file changed, 16 insertions(+), 20 deletions(-)
diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style
index 99b22364d866..0dca31a0dddb 100755
--- a/scripts/dtc/dt-check-style
+++ b/scripts/dtc/dt-check-style
@@ -44,7 +44,6 @@ class LineType(Enum):
NODE_OPEN = auto() # something { (with optional label/name/addr)
NODE_CLOSE = auto() # };
PROPERTY = auto() # name = value; or name;
- CONTINUATION = auto() # continuation of a multi-line property
re_cpp_directive = re.compile(
@@ -80,11 +79,12 @@ def is_preprocessor(stripped):
class DtsLine:
__slots__ = ('lineno', 'raw', 'code', 'linetype', 'indent_str', 'stripped', 'is_root',
- 'prop_name', 'continuations',
+ 'prop_name', 'continuation', 'continuations',
'node_name', 'node_addr', 'label', 'ref_name', 'parent', 'depth',
'closures')
- def __init__(self, lineno, raw, linetype, depth, indent_str, stripped, is_root = False):
+ def __init__(self, lineno, raw, linetype, depth, indent_str, stripped,
+ continuation = False, is_root = False):
self.lineno = lineno # 1-based within the block
self.raw = raw # Entire raw line
self.linetype = linetype
@@ -95,6 +95,7 @@ class DtsLine:
self.code = _strip_strings_and_comments(stripped).rstrip()
self.is_root = is_root
self.prop_name = None
+ self.continuation = continuation # Continuation of a multi-line property
self.continuations = []
self.node_name = None
self.node_addr = None
@@ -175,7 +176,7 @@ def classify_lines(text):
continue
if not stripped:
- dl = DtsLine(i, raw, LineType.BLANK, depth, '', '')
+ dl = DtsLine(i, raw, LineType.BLANK, depth, '', '', continuation=not prev_complete)
out.append(dl)
continue
@@ -184,7 +185,7 @@ def classify_lines(text):
else LineType.COMMENT_BODY)
if ltype == LineType.COMMENT_END:
in_block_comment = False
- dl = DtsLine(i, raw, ltype, depth, indent_str, stripped)
+ dl = DtsLine(i, raw, ltype, depth, indent_str, stripped, continuation=not prev_complete)
out.append(dl)
continue
@@ -202,20 +203,12 @@ def classify_lines(text):
if opens_block:
in_block_comment = True
- if not prev_complete:
- dl = DtsLine(i, raw, LineType.CONTINUATION, depth, indent_str, code)
- out.append(dl)
- prev_complete = (code.endswith(';') or
- code.endswith('{') or
- code.endswith('};'))
- continue
-
# Pure-comment line: nothing left after stripping. Classify as
# COMMENT_START (carries to next line) or COMMENT, and skip the
# structural classification entirely.
if not code:
ltype = LineType.COMMENT_START if opens_block else LineType.COMMENT
- dl = DtsLine(i, raw, ltype, depth, indent_str, stripped)
+ dl = DtsLine(i, raw, ltype, depth, indent_str, stripped, continuation=not prev_complete)
out.append(dl)
continue
@@ -245,7 +238,8 @@ def classify_lines(text):
continue
# Property (or first line of a multi-line property).
- dl = DtsLine(i, raw, LineType.PROPERTY, depth, indent_str, code)
+ dl = DtsLine(i, raw, LineType.PROPERTY, depth, indent_str, code,
+ continuation=not prev_complete)
parse_property_name(dl)
out.append(dl)
prev_complete = code.endswith(';')
@@ -254,7 +248,7 @@ def classify_lines(text):
last_prop = None
grouped = []
for dl in out:
- if dl.linetype == LineType.CONTINUATION and last_prop is not None:
+ if dl.continuation and last_prop is not None:
last_prop.continuations.append(dl)
continue
if dl.linetype == LineType.PROPERTY:
@@ -535,6 +529,8 @@ def check_continuation_alignment(ctx):
dl_value_complete = rest.endswith('",') or rest.endswith('>,')
target_col = _display_col(_strip_strings_and_comments(dl.raw[:eq + 1 + m.start(1)]))
for cont in dl.continuations:
+ if cont.linetype == LineType.BLANK:
+ continue
target_offset = 0
err_msg_explanation = 'to < or "'
if not dl_value_complete:
@@ -582,10 +578,10 @@ def check_indent_consistent(ctx):
return
for dl in ctx.lines:
+ if dl.continuation:
+ continue # continuations align to <, not to indent unit
if dl.linetype in (LineType.BLANK, LineType.PREPROCESSOR):
continue
- if dl.linetype == LineType.CONTINUATION:
- continue # continuations align to <, not to indent unit
if dl.linetype in (LineType.COMMENT_BODY, LineType.COMMENT_END):
continue
if not dl.indent_str:
@@ -899,6 +895,8 @@ def check_required_blank_lines(ctx):
if d.linetype == LineType.NODE_CLOSE and \
d.depth == body_depth - 1 and depth_inside == 0:
break
+ if d.continuation:
+ continue
# Track depth inside nested children so we only look at
# immediate-body items.
if d.linetype == LineType.NODE_OPEN and \
@@ -918,8 +916,6 @@ def check_required_blank_lines(ctx):
LineType.COMMENT_BODY, LineType.COMMENT_END,
LineType.PREPROCESSOR):
continue
- if d.linetype == LineType.CONTINUATION:
- continue
needs_blank = False
if d.linetype == LineType.NODE_OPEN:
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] dtc: dt-check-style: Handle multiple blank lines in continued properties
2026-09-11 11:42 [PATCH 0/2] dtc: dt-check-style: Improvements for continued properties Krzysztof Kozlowski
2026-09-11 11:42 ` [PATCH 1/2] dtc: dt-check-style: Re-work classifying property continuations Krzysztof Kozlowski
@ 2026-09-11 11:42 ` Krzysztof Kozlowski
2026-09-16 21:18 ` [PATCH 0/2] dtc: dt-check-style: Improvements for " Rob Herring
2 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2026-09-11 11:42 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Saravana Kannan,
Test User
Cc: devicetree, linux-kernel, Krzysztof Kozlowski
Properly ignore comments and report duplicated blank lines in multi-line
properties.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
scripts/dtc/dt-check-style | 6 +++
.../dtc/dt-style-selftest/bad/dts-blank-lines.dts | 37 +++++++++++++++
.../dt-style-selftest/bad/yaml-blank-lines.yaml | 54 ++++++++++++++++++++++
.../expected/dts-blank-lines.dts.txt | 6 +++
.../expected/yaml-blank-lines.yaml.txt | 6 +++
5 files changed, 109 insertions(+)
diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style
index 0dca31a0dddb..52597c266904 100755
--- a/scripts/dtc/dt-check-style
+++ b/scripts/dtc/dt-check-style
@@ -440,6 +440,12 @@ def check_blank_lines(ctx):
if lines[i].linetype == LineType.BLANK and \
lines[i - 1].linetype == LineType.BLANK:
yield (lines[i].lineno, 'consecutive blank lines')
+ prev_is_blank = lines[i].linetype == LineType.BLANK
+ for cont in lines[i].continuations:
+ if cont.linetype == LineType.BLANK and prev_is_blank:
+ yield (cont.lineno, 'consecutive blank lines')
+ prev_is_blank = cont.linetype == LineType.BLANK
+
# Blank right after { or right before }
for i, dl in enumerate(lines):
if dl.linetype != LineType.BLANK:
diff --git a/scripts/dtc/dt-style-selftest/bad/dts-blank-lines.dts b/scripts/dtc/dt-style-selftest/bad/dts-blank-lines.dts
new file mode 100644
index 000000000000..f2e99fb7bb29
--- /dev/null
+++ b/scripts/dtc/dt-style-selftest/bad/dts-blank-lines.dts
@@ -0,0 +1,37 @@
+// 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>;
+
+ clocks = <1 2 3>,
+
+
+ /* Comment is not a blank line */
+ <4 5 6>,
+
+ /* Comment is not a blank line */
+ <7 8 9>;
+
+
+ interrupts = <1>;
+
+ /* Comment is not a blank line */
+ qcom,calibration-variant = "foo";
+ };
+
+
+ interrupt-controller@20000 {
+
+ compatible = "example,intc";
+ reg = <0x20000 0x1000>;
+
+ };
+};
diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-blank-lines.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-blank-lines.yaml
new file mode 100644
index 000000000000..a58cd534a003
--- /dev/null
+++ b/scripts/dtc/dt-style-selftest/bad/yaml-blank-lines.yaml
@@ -0,0 +1,54 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/test-bad-blank-lines.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Test fixture with too many blank lines
+
+maintainers:
+ - Test User <test@example.com>
+
+properties:
+ compatible:
+ const: example,test-blank-lines
+ reg:
+ maxItems: 1
+
+required:
+ - compatible
+ - reg
+
+additionalProperties: false
+
+examples:
+ - |
+ foo@1000 {
+ compatible = "example,test-blank-lines";
+
+ reg = <0x1000 0x100>;
+
+ clocks = <1 2 3>,
+
+
+ /* Comment is not a blank line */
+ <4 5 6>,
+
+ /* Comment is not a blank line */
+ <7 8 9>;
+
+
+ interrupts = <1>;
+
+ /* Comment is not a blank line */
+ qcom,calibration-variant = "foo";
+ };
+
+
+ foo@2000 {
+
+ compatible = "example,test-blank-lines";
+
+ reg = <0x2000 0x100>;
+
+ };
diff --git a/scripts/dtc/dt-style-selftest/expected/dts-blank-lines.dts.txt b/scripts/dtc/dt-style-selftest/expected/dts-blank-lines.dts.txt
new file mode 100644
index 000000000000..97617bc42a17
--- /dev/null
+++ b/scripts/dtc/dt-style-selftest/expected/dts-blank-lines.dts.txt
@@ -0,0 +1,6 @@
+# mode=strict
+bad/dts-blank-lines.dts:16: [blank-lines] consecutive blank lines
+bad/dts-blank-lines.dts:23: [blank-lines] consecutive blank lines
+bad/dts-blank-lines.dts:30: [blank-lines] consecutive blank lines
+bad/dts-blank-lines.dts:32: [blank-lines] blank line at start of node body
+bad/dts-blank-lines.dts:35: [blank-lines] blank line at end of node body
diff --git a/scripts/dtc/dt-style-selftest/expected/yaml-blank-lines.yaml.txt b/scripts/dtc/dt-style-selftest/expected/yaml-blank-lines.yaml.txt
new file mode 100644
index 000000000000..8a8db8d35b1e
--- /dev/null
+++ b/scripts/dtc/dt-style-selftest/expected/yaml-blank-lines.yaml.txt
@@ -0,0 +1,6 @@
+# mode=strict
+bad/yaml-blank-lines.yaml:33: example 0 [blank-lines] consecutive blank lines
+bad/yaml-blank-lines.yaml:40: example 0 [blank-lines] consecutive blank lines
+bad/yaml-blank-lines.yaml:47: example 0 [blank-lines] consecutive blank lines
+bad/yaml-blank-lines.yaml:49: example 0 [blank-lines] blank line at start of node body
+bad/yaml-blank-lines.yaml:53: example 0 [blank-lines] blank line at end of node body
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] dtc: dt-check-style: Improvements for continued properties
2026-09-11 11:42 [PATCH 0/2] dtc: dt-check-style: Improvements for continued properties Krzysztof Kozlowski
2026-09-11 11:42 ` [PATCH 1/2] dtc: dt-check-style: Re-work classifying property continuations Krzysztof Kozlowski
2026-09-11 11:42 ` [PATCH 2/2] dtc: dt-check-style: Handle multiple blank lines in continued properties Krzysztof Kozlowski
@ 2026-09-16 21:18 ` Rob Herring
2 siblings, 0 replies; 4+ messages in thread
From: Rob Herring @ 2026-09-16 21:18 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Krzysztof Kozlowski, Conor Dooley, Saravana Kannan, Test User,
devicetree, linux-kernel
On Fri, Sep 11, 2026 at 01:42:03PM +0200, Krzysztof Kozlowski wrote:
> Merging
> =======
> On top of:
> https://patch.msgid.link/20260909-b4-dts-style-checker-continued-lines-v3-0-474bb324ae53@oss.qualcomm.com
>
> Best regards,
> Krzysztof
>
> ---
> Krzysztof Kozlowski (2):
> dtc: dt-check-style: Re-work classifying property continuations
> dtc: dt-check-style: Handle multiple blank lines in continued properties
Applied, thanks!
Rob
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-09-16 21:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-11 11:42 [PATCH 0/2] dtc: dt-check-style: Improvements for continued properties Krzysztof Kozlowski
2026-09-11 11:42 ` [PATCH 1/2] dtc: dt-check-style: Re-work classifying property continuations Krzysztof Kozlowski
2026-09-11 11:42 ` [PATCH 2/2] dtc: dt-check-style: Handle multiple blank lines in continued properties Krzysztof Kozlowski
2026-09-16 21:18 ` [PATCH 0/2] dtc: dt-check-style: Improvements for " Rob Herring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®