Re: [PATCH v5 1/4] dt-bindings: add DTS style checker

From: Krzysztof Kozlowski

Date: Tue Jun 09 2026 - 12:35:59 EST


On Wed, May 27, 2026 at 08:32:10PM +0100, Daniel Golle wrote:
> Add a Python tool that checks DTS coding style on examples in YAML
> binding files and on .dts/.dtsi/.dtso source files. Rules are kept in
> a small declarative registry, each tagged 'relaxed' (default; must be
> zero-violation on the current tree) or 'strict' (opt-in for new
> submissions). Promoting a rule from strict to relaxed is a one-line
> edit once the tree is clean.
>
> Relaxed mode covers trailing whitespace, tab characters in YAML
> examples, mixed tab+space indents, and missing tabs in .dts files.
> Strict adds indent unit and consistency checks, blank-line placement,
> sibling address ordering, "compatible" and "reg" ordering, and unused
> labels.
>
> The tool reads file paths from @argfile and parallelises across CPUs
> via -j N. With no -j given it picks up $PARALLELISM (set by
> scripts/jobserver-exec from the GNU make jobserver) and falls back to
> os.cpu_count() otherwise. Running as one Python invocation amortises
> the ruamel.yaml import across the whole tree -- ~2s on a 32-CPU host
> vs ~28s sequential.
>
> Signed-off-by: Daniel Golle <daniel@xxxxxxxxxxxxxx>
> ---

Probably by relying mostly on regex instead of proper token parsing we
will hit a wall at some point, but it's better than what I would write.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxxxxxxxx>

Best regards,
Krzysztof