diff options
| author | Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> | 2026-09-15 19:03:46 +0200 |
|---|---|---|
| committer | Rob Herring (Arm) <robh@kernel.org> | 2026-09-16 15:17:07 -0500 |
| commit | 27e3cf7b9125af41acdb935ffb413e6a4f03e94d (patch) | |
| tree | 9e226a9ce17087eb6789e1db03fcf8d27e31f91d /scripts | |
| parent | 95041262511eeec15aa14c53b7e7daf1355259c5 (diff) | |
dtc: dt-check-style: Handle continued lines in check_line_length()
Continued lines are not separate DtsLine items in ctx.lines, so they
need own iteration. Rule for length of line is applicable to continued
values as well.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Link: https://patch.msgid.link/20260915-b4-dts-style-checker-continued-lines-v4-2-5b8e09b11ef2@oss.qualcomm.com
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Diffstat (limited to 'scripts')
5 files changed, 18 insertions, 8 deletions
diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style index 2d0463c626e5..525d9df6c11b 100755 --- a/scripts/dtc/dt-check-style +++ b/scripts/dtc/dt-check-style @@ -627,16 +627,22 @@ def check_indent_unit_strict(ctx): 'got %r' % unit) +def _check_line_length(dl): + if dl.linetype == LineType.BLANK: + return + cols = _display_col(dl.raw) + if cols > 80: + yield (dl.lineno, + 'line exceeds 80 columns (%d)' % cols) + + def check_line_length(ctx): """Lines must not exceed 80 columns; tabs count as 8 (see _display_col).""" for dl in ctx.lines: - if dl.linetype == LineType.BLANK: - continue - cols = _display_col(dl.raw) - if cols > 80: - yield (dl.lineno, - 'line exceeds 80 columns (%d)' % cols) + yield from _check_line_length(dl) + for cont in dl.continuations: + yield from _check_line_length(cont) def check_mixed_indent_chars(ctx): diff --git a/scripts/dtc/dt-style-selftest/bad/dts-line-length.dts b/scripts/dtc/dt-style-selftest/bad/dts-line-length.dts index bde91a922477..adf40e3c95f7 100644 --- a/scripts/dtc/dt-style-selftest/bad/dts-line-length.dts +++ b/scripts/dtc/dt-style-selftest/bad/dts-line-length.dts @@ -14,7 +14,8 @@ #size-cells = <1>; foo@1000 { - compatible = "example,test-line-length-this-is-a-very-long-name-indeed-yeah"; + compatible = "example,test-line-length-this-is-a-very-long-name-indeed-yeah", + "example,test-line-length-this-is-a-very-long-name-indeed-yeah-second"; reg = <0x1000 0x100>; }; }; diff --git a/scripts/dtc/dt-style-selftest/bad/yaml-line-length.yaml b/scripts/dtc/dt-style-selftest/bad/yaml-line-length.yaml index 6e4140e500b5..6b1209ee4f26 100644 --- a/scripts/dtc/dt-style-selftest/bad/yaml-line-length.yaml +++ b/scripts/dtc/dt-style-selftest/bad/yaml-line-length.yaml @@ -24,6 +24,7 @@ additionalProperties: false examples: - | foo@1000 { - compatible = "example,test-line-length-this-is-a-very-long-name-indeed-yeah"; + compatible = "example,test-line-length-this-is-a-very-long-name-indeed-yeah", + "example,test-line-length-this-is-a-very-long-name-indeed-yeah-second"; 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 index 8ed08c309632..9cdb7550b56c 100644 --- a/scripts/dtc/dt-style-selftest/expected/dts-line-length.dts.txt +++ b/scripts/dtc/dt-style-selftest/expected/dts-line-length.dts.txt @@ -1,2 +1,3 @@ # mode=stricter bad/dts-line-length.dts:17: [line-length-dts] line exceeds 80 columns (101) +bad/dts-line-length.dts:18: [line-length-dts] line exceeds 80 columns (108) diff --git a/scripts/dtc/dt-style-selftest/expected/yaml-line-length.yaml.txt b/scripts/dtc/dt-style-selftest/expected/yaml-line-length.yaml.txt index 89b36360caa4..f21b823c6136 100644 --- a/scripts/dtc/dt-style-selftest/expected/yaml-line-length.yaml.txt +++ b/scripts/dtc/dt-style-selftest/expected/yaml-line-length.yaml.txt @@ -1,2 +1,3 @@ # mode=strict bad/yaml-line-length.yaml:27: example 0 [line-length] line exceeds 80 columns (81) +bad/yaml-line-length.yaml:28: example 0 [line-length] line exceeds 80 columns (88) |
