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

Krzysztof Kozlowski <[email protected]>
Newsgroups org.kernel.vger.linux-kbuild,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel
Message-ID <20260609-rebel-hummingbird-of-maturity-2325b1@quoll>
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 <[email protected]>
> ---

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 <[email protected]>

Best regards,
Krzysztof
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.