Re: [PATCH v5 3/4] dt-bindings: wire style checker into dt_binding_check
Nicolas Schier <[email protected]>
| Newsgroups | org.kernel.vger.linux-kbuild,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <ai0pqz9904tzrDGl@levanger> |
On Wed, May 27, 2026 at 08:32:26PM +0100, Daniel Golle wrote: > Run dt-check-style as part of dt_binding_check_one. The recipe wraps > the tool with scripts/jobserver-exec so worker count follows the GNU > make jobserver -- `make -j N dt_binding_check` constrains the checker > to N workers rather than spawning one per CPU. > > Default mode (relaxed) is zero-violation on the current tree, so this > does not introduce new warnings into make dt_binding_check. Stricter > rules are available via --mode=strict (eg. for use by checkpatch.pl in > a future series). > > Signed-off-by: Daniel Golle <[email protected]> > --- > v5: > - no change; depends on the new jobserver-exec fix in 2/4 so > style failures stay visible instead of being cached > > v4: > - build the @argfile with f=$(mktemp) and remove it with rm -f > (matching cmd_mk_schema), instead of Kbuild's $(tmp-target) > which leaves a stale .tmp_.dt-style.checked in the build tree > > v3: > - use Kbuild's $(tmp-target) instead of mktemp so build output > stays inside the build folder (Nathan) > - collapse the conditional cleanup tail into the familiar > "&& touch $@ || true" pattern, matching cmd_chk_bindings; > keeps future warnings non-fatal (Rob, Nathan) > - retained the explicit $(PYTHON3) prefix (Rob asked why it > differs from the rest of this Makefile): per > Documentation/kbuild/makefiles.rst "Script invocation", > in-tree scripts should be called through their interpreter so > the executable bit and shebang are not relied on and the > user's $(PYTHON3) override is respected. The neighbouring > recipes invoke their Python helpers directly because those > come from external packages (dtschema's dt-extract-*, > dt-check-compatible, dt-doc-validate), which is the case Rob > asked about and which sits outside that rule. > > v2: > - dropped xargs -n200 -P$(nproc) sharding; single Python invocation > with file list via @argfile > - dropped `|| true`: relaxed mode is zero-output today > - wrapped under scripts/jobserver-exec so worker count follows the > make jobserver > > Documentation/devicetree/bindings/Makefile | 19 +++++++++++++++++-- > 1 file changed, 17 insertions(+), 2 deletions(-) > > diff --git a/Documentation/devicetree/bindings/Makefile b/Documentation/devicetree/bindings/Makefile > index 7b668f7fd400..00149e824261 100644 > --- a/Documentation/devicetree/bindings/Makefile > +++ b/Documentation/devicetree/bindings/Makefile > @@ -46,6 +46,18 @@ quiet_cmd_chk_bindings = CHKDT $(src) > xargs -n200 -P$$(nproc) $(DT_DOC_CHECKER) -u $(src)) \ > && touch $@ || true > > +DT_CHK_STYLE = $(srctree)/scripts/dtc/dt-check-style > + > +# Feed the file list to the checker via @argfile in a single Python > +# process so the ruamel.yaml import is paid once. scripts/jobserver-exec > +# claims slots from the GNU make jobserver and exposes the count via > +# $PARALLELISM, which dt-check-style picks up to size its worker pool. > +quiet_cmd_chk_style = STYLE $(src) > + cmd_chk_style = f=$$(mktemp) && $(find_cmd) > $$f && \ > + $(PYTHON3) $(srctree)/scripts/jobserver-exec \ > + $(PYTHON3) $(DT_CHK_STYLE) @$$f \ > + && touch $@ || true; rm -f $$f As usage of $(mktemp) requires an unconditional 'rm -f $$f', too, I'd like to repeat Nathans suggestion to use Kbuild's $(tmp-target) instead. The rationale, as Nathan wrote, is to keep generated files within the build tree. -- Nicolas