[PATCH v3 00/11] dtc: dt-check-style: Improvements for false positives

Krzysztof Kozlowski posted 11 patches 1 month, 4 weeks ago
There is a newer version of this series
MAINTAINERS                                        |   2 +
scripts/dtc/dt-check-style                         | 210 +++++++++++++++------
.../dt-style-selftest/bad/dts-child-name-order.dts |   2 +
.../dts-child-name-order.dtso}                     |  23 ++-
.../dtc/dt-style-selftest/bad/dts-cont-align.dts   |  23 +++
.../{good => bad}/dts-digit-node-order.dts         |  15 +-
.../dts-digit-node-order.dtso}                     |  18 +-
.../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   |   7 +-
...-property-order.dts => dts-property-order.dtso} |   8 +-
.../bad/dts-redundant-ws-strict.dts                |  27 +++
...e-digit-node-order.dts => dts-redundant-ws.dts} |  30 ++-
.../dtc/dt-style-selftest/bad/dts-trailing-ws.dts  |   8 +
.../dtc/dt-style-selftest/bad/dts-unused-label.dts |  21 +++
.../dtc/dt-style-selftest/bad/yaml-cont-align.yaml |   4 +-
.../bad/yaml-redundant-ws-strict.yaml              |  29 +++
.../dt-style-selftest/bad/yaml-redundant-ws.yaml   |  29 +++
.../expected/dts-child-name-order.dts.txt          |   3 +-
.../expected/dts-child-name-order.dtso.txt         |   3 +
.../expected/dts-cont-align.dts.txt                |   8 +
.../expected/dts-digit-node-order.dts.txt          |   2 +
.../expected/dts-digit-node-order.dtso.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            |  13 +-
.../expected/dts-property-order.dtso.txt           |   8 +
.../expected/dts-redundant-ws-strict.dts.txt       |  13 ++
.../expected/dts-redundant-ws.dts.txt              |   9 +
.../expected/dts-trailing-ws.dts.txt               |   2 +
.../expected/dts-unused-label.dts.txt              |   2 +
.../expected/yaml-cont-align.yaml.txt              |   3 +-
.../expected/yaml-redundant-ws-strict.yaml.txt     |   5 +
.../expected/yaml-redundant-ws.yaml.txt            |   3 +
.../expected/yaml-value-ws-multiline.yaml.txt      |   1 +
.../good/dts-child-name-order.dts                  |   2 +
...ld-name-order.dts => dts-child-name-order.dtso} |   5 +-
.../dtc/dt-style-selftest/good/dts-cont-align.dts  |  11 +-
.../good/dts-digit-node-order.dts                  |   5 +-
...it-node-order.dts => dts-digit-node-order.dtso} |   8 +-
.../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 +
...-property-order.dts => dts-property-order.dtso} |   8 +-
scripts/dtc/dt-style-selftest/good/soc.dtsi        |   2 +
.../{bad => good}/yaml-cont-align.yaml             |   8 +-
scripts/dtc/dt-style-selftest/run.sh               |   2 +-
49 files changed, 494 insertions(+), 130 deletions(-)
[PATCH v3 00/11] dtc: dt-check-style: Improvements for false positives
Posted by Krzysztof Kozlowski 1 month, 4 weeks ago
Changes in v3:
- Responded to Sashiko and implemented its comments
- Properly handle root node with more than one space "/  {"
- Add more unit tests for DTSO whether properties and nodes are properly
  detected as top-level
- Link to v2: https://patch.msgid.link/20260802-n-dts-style-checker-continued-v2-0-6c5dbd1ccfe4@oss.qualcomm.com

Changes in v2:
- Trailing slash to maintainers path
- New patches:
   - Patch #9: dtc: dt-check-style: Add test for trailing white-space in DTS
   - Patch #10: dtc: dt-check-style: Add warning for redundant white-spaces
- Several fixes based on Sashiko's report (I responded to these on the
  lists)
   - _walk_bodies(): Fix setting up proper parent to each node after
     exiting node parsing. This wasn't working correctly.
   - check_child_name_order(): Properly sort top-level nodes by names,
     even if it comes with unit address like memory@1000
   - Add rest of property_bucket sorting for top-level properties,
     even though no properties are expected there, except few vendor
     ones
   - check_continuation_alignment(): Improve error msg for
     continuned-lines alignment warnings

- Link to v1: https://patch.msgid.link/20260726-n-dts-style-checker-continued-v1-0-b05b8f897670@oss.qualcomm.com

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 (11):
      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
      dtc: dt-check-style: Add test for trailing white-space in DTS
      dtc: dt-check-style: Add warning for redundant white-spaces
      MAINTAINERS: dt-bindings: Include dt-check-style in DT binding entry

 MAINTAINERS                                        |   2 +
 scripts/dtc/dt-check-style                         | 210 +++++++++++++++------
 .../dt-style-selftest/bad/dts-child-name-order.dts |   2 +
 .../dts-child-name-order.dtso}                     |  23 ++-
 .../dtc/dt-style-selftest/bad/dts-cont-align.dts   |  23 +++
 .../{good => bad}/dts-digit-node-order.dts         |  15 +-
 .../dts-digit-node-order.dtso}                     |  18 +-
 .../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   |   7 +-
 ...-property-order.dts => dts-property-order.dtso} |   8 +-
 .../bad/dts-redundant-ws-strict.dts                |  27 +++
 ...e-digit-node-order.dts => dts-redundant-ws.dts} |  30 ++-
 .../dtc/dt-style-selftest/bad/dts-trailing-ws.dts  |   8 +
 .../dtc/dt-style-selftest/bad/dts-unused-label.dts |  21 +++
 .../dtc/dt-style-selftest/bad/yaml-cont-align.yaml |   4 +-
 .../bad/yaml-redundant-ws-strict.yaml              |  29 +++
 .../dt-style-selftest/bad/yaml-redundant-ws.yaml   |  29 +++
 .../expected/dts-child-name-order.dts.txt          |   3 +-
 .../expected/dts-child-name-order.dtso.txt         |   3 +
 .../expected/dts-cont-align.dts.txt                |   8 +
 .../expected/dts-digit-node-order.dts.txt          |   2 +
 .../expected/dts-digit-node-order.dtso.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            |  13 +-
 .../expected/dts-property-order.dtso.txt           |   8 +
 .../expected/dts-redundant-ws-strict.dts.txt       |  13 ++
 .../expected/dts-redundant-ws.dts.txt              |   9 +
 .../expected/dts-trailing-ws.dts.txt               |   2 +
 .../expected/dts-unused-label.dts.txt              |   2 +
 .../expected/yaml-cont-align.yaml.txt              |   3 +-
 .../expected/yaml-redundant-ws-strict.yaml.txt     |   5 +
 .../expected/yaml-redundant-ws.yaml.txt            |   3 +
 .../expected/yaml-value-ws-multiline.yaml.txt      |   1 +
 .../good/dts-child-name-order.dts                  |   2 +
 ...ld-name-order.dts => dts-child-name-order.dtso} |   5 +-
 .../dtc/dt-style-selftest/good/dts-cont-align.dts  |  11 +-
 .../good/dts-digit-node-order.dts                  |   5 +-
 ...it-node-order.dts => dts-digit-node-order.dtso} |   8 +-
 .../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 +
 ...-property-order.dts => dts-property-order.dtso} |   8 +-
 scripts/dtc/dt-style-selftest/good/soc.dtsi        |   2 +
 .../{bad => good}/yaml-cont-align.yaml             |   8 +-
 scripts/dtc/dt-style-selftest/run.sh               |   2 +-
 49 files changed, 494 insertions(+), 130 deletions(-)
---
base-commit: 1c8869cfe9534aa9c3179ff0ad36f2b17e1347f5
change-id: 20260726-n-dts-style-checker-continued-b6a05e278891

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