History log of /linux-master/Documentation/devicetree/bindings/Makefile
Revision Date Author Comments
# 9f8bbb53 28-Nov-2023 Rob Herring <robh@kernel.org>

dt-bindings: Turn on undocumented compatible checks

The undocumented compatibles in the examples are down to just a few
left. Turn on the warning by default. The increased visibility should
get the remaining warnings fixed.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20231128221008.4050638-2-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>


# 93502421 15-Jan-2024 André Draszik <andre.draszik@linaro.org>

dt-bindings: don't anchor DT_SCHEMA_FILES to bindings directory

Commit 5e3ef4546819 ("dt-bindings: ignore paths outside kernel for
DT_SCHEMA_FILES") anchored all searches to the bindings directory
(since bindings only exist below that), but it turns out this is not
always desired.

Just anchor to the base kernel source directory and while at it, break
the overly long line for legibility.

Reported-by: Michal Simek <michal.simek@amd.com>
Fixes: 5e3ef4546819 ("dt-bindings: ignore paths outside kernel for DT_SCHEMA_FILES")
Closes: https://lore.kernel.org/all/827695c3-bb33-4a86-8586-2c7323530398@amd.com/
Cc: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: André Draszik <andre.draszik@linaro.org>
Tested-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20240116062731.2810067-1-git@andred.net
Signed-off-by: Rob Herring <robh@kernel.org>


# 5e3ef454 20-Dec-2023 André Draszik <andre.draszik@linaro.org>

dt-bindings: ignore paths outside kernel for DT_SCHEMA_FILES

If the location of the kernel sources contains the string that we're
filtering for using DT_SCHEMA_FILES, then all schemas will currently be
matched, returned and checked, not just the ones we actually expected.
As an example, if the kernel sources happen to be below a directory
'google', and DT_SCHEMA_FILES=google, everything is checked. More
common examples might be having the sources below people's home
directories that contain the string st or arm and then searching for
those. The list is endless.

Fix this by only matching for schemas below the kernel source's
bindings directory.

Note that I opted for the implementation here so as to not having to
deal with escaping DT_SCHEMA_FILES, which would have been the
alternative if the grep match itself had been updated.

Cc: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: André Draszik <andre.draszik@linaro.org>
Link: https://lore.kernel.org/r/20231220145537.2163811-1-andre.draszik@linaro.org
Signed-off-by: Rob Herring <robh@kernel.org>


# b32dcf23 13-Oct-2023 Rob Herring <robh@kernel.org>

dt-bindings: Drop kernel copy of common reserved-memory bindings

The common reserved-memory bindings have recently been copied from the
kernel tree into dtschema. The preference is to host common, stable
bindings in dtschema. As reserved-memory is documented in the DT Spec,
it meets the criteria.

The v2023.09 version of dtschema is what contains the reserved-memory
schemas we depend on, so bump the minimum version to that. Otherwise,
references to these schemas will generate errors.

Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Link: https://lore.kernel.org/r/20231013200851.347042-1-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>


# 25eba159 09-Feb-2023 Cristian Ciocaltea <cristian.ciocaltea@collabora.com>

dt-bindings: Fix multi pattern support in DT_SCHEMA_FILES

DT_SCHEMA_FILES used to allow specifying a space separated list of file
paths, but the introduction of partial matches support broke this
feature:

$ make dtbs_check DT_SCHEMA_FILES="path/to/schema1.yaml path/to/schema2.yaml"
[...]
LINT Documentation/devicetree/bindings
usage: yamllint [-h] [-] [-c CONFIG_FILE | -d CONFIG_DATA] [--list-files] [...]
[-v]
[FILE_OR_DIR ...]
yamllint: error: one of the arguments FILE_OR_DIR - is required
[...]

Restore the lost functionality by preparing a grep filter that is able
to handle multiple search patterns.

Additionally, as suggested by Rob, use ':' instead of ' ' as the
patterns separator char. Hence, the command above becomes:

$ make dtbs_check DT_SCHEMA_FILES="path/to/schema1.yaml:path/to/schema2.yaml"

Fixes: 309d955985ee ("dt-bindings: kbuild: Support partial matches with DT_SCHEMA_FILES")
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Link: https://lore.kernel.org/r/20230209193735.795288-1-cristian.ciocaltea@collabora.com
Signed-off-by: Rob Herring <robh@kernel.org>


# b6acf807 30-Jun-2022 Rob Herring <robh@kernel.org>

dt: Add a check for undocumented compatible strings in kernel

Add a make target, dt_compatible_check, to extract compatible strings
from kernel sources and check if they are documented by a schema.
At least version v2022.08 of dtschema with dt-check-compatible is
required.

This check can also be run manually on specific files or directories:

scripts/dtc/dt-extract-compatibles drivers/clk/ | \
xargs dt-check-compatible -v -s Documentation/devicetree/bindings/processed-schema.json

Currently, there are about 3800 undocumented compatible strings. Most of
these are cases where the binding is not yet converted (given there
are 1900 .txt binding files remaining).

Link: https://lore.kernel.org/all/20220916012510.2718170-1-robh@kernel.org/
Signed-off-by: Rob Herring <robh@kernel.org>


# dcc2ed39 27-Jul-2022 Rob Herring <robh@kernel.org>

dt-bindings: Drop DT_MK_SCHEMA_FLAGS conditional selecting schema files

Since commit ef8795f3f1ce ("dt-bindings: kbuild: Use DTB files for
validation"), dt-mk-schema always needs a complete list of schemas, so
the conditional using DT_MK_SCHEMA_FLAGS should be removed.

Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220727211100.3249417-1-robh@kernel.org


# 6b49f340 15-Mar-2022 Nathan Chancellor <nathan@kernel.org>

dt-bindings: kbuild: Make DT_SCHEMA_LINT a recursive variable

A recent change added a warning when yamllint is not installed, as it is
needed for 'make dt_binding_check'. However, it also changed
DT_SCHEMA_LINT to be a simple make variable, which is evaluated when a
Makefile is evaluated. This causes a warning when running 'make clean',
as Documentation/devicetree/bindings/Makefile has a "clean-files"
variable:

$ make -s clean
which: no yamllint in (...)
warning: python package 'yamllint' not installed, skipping

Make DT_SCHEMA_LINT a recursive variable so it is evaluated only when it
is used. The warning still triggers when 'make dt_binding_check' is run.

Fixes: b3e664a7f449 ("dt-bindings: kbuild: Print a warning if yamllint is not found")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220315202542.2071351-1-nathan@kernel.org


# ef8795f3 10-Mar-2022 Rob Herring <robh@kernel.org>

dt-bindings: kbuild: Use DTB files for validation

Switch the DT validation to use DTB files directly instead of a DTS to
YAML conversion.

The original motivation for supporting validation on DTB files was to
enable running validation on a running system (e.g. 'dt-validate
/sys/firmware/fdt') or other cases where the original source DTS is not
available.

The YAML format was not without issues. Using DTBs with the schema type
information solves some of those problems. The YAML format relies on the
DTS source level information including bracketing of properties, size
directives, and phandle tags all of which are lost in a DTB file. While
standardizing the bracketing is a good thing, it does cause a lot of
extra warnings and churn to fix them.

Another issue has been signed types are not validated correctly as sign
information is not propagated to YAML. Using the schema type information
allows for proper handling of signed types. YAML also can't represent
the full range of 64-bit integers as numbers are stored as floats by
most/all parsers.

The DTB validation works by decoding property values using the type
information in the schemas themselves. The main corner case this does
not work for is matrix types where neither dimension is fixed. For
now, checking the dimensions in these cases are skipped.

Signed-off-by: Rob Herring <robh@kernel.org>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20220310160513.1708182-3-robh@kernel.org


# 2783a7f5 10-Mar-2022 Rob Herring <robh@kernel.org>

dt-bindings: kbuild: Pass DT_SCHEMA_FILES to dt-validate

In preparation for supporting validation of DTB files, the full
processed schema will always be needed in order to extract type
information from it. Therefore, the processed schema containing only
what DT_SCHEMA_FILES specifies won't work. Instead, dt-validate has
gained an option, -l or --limit, to specify which schema(s) to use for
validation.

As the command line option is new, we the minimum dtschema version must be
updated.

Cc: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220310160513.1708182-2-robh@kernel.org


# b3e664a7 03-Mar-2022 Rob Herring <robh@kernel.org>

dt-bindings: kbuild: Print a warning if yamllint is not found

Running yamllint is effectively required for binding schemas, so print a
warning if not found rather than silently skipping running it.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Link: https://lore.kernel.org/r/20220303221417.2486268-1-robh@kernel.org


# 309d9559 28-Feb-2022 Rob Herring <robh@kernel.org>

dt-bindings: kbuild: Support partial matches with DT_SCHEMA_FILES

DT_SCHEMA_FILES is currently restricted to a list of exact files with
the full source tree path (i.e. Documentation/devicetree/bindings/...).
Loosen this requirement and let DT_SCHEMA_FILES be a partial match.

With this, checking all schema files in a directory is possible:

$ make DT_SCHEMA_FILES=/gpio/ dt_binding_check

Or all schema files with 'qcom' in the path or filename:

$ make DT_SCHEMA_FILES=qcom dt_binding_check

Cc: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Link: https://lore.kernel.org/r/20220228201006.1484903-1-robh@kernel.org


# 4b7c49f7 03-Dec-2021 Sam Protsenko <semen.protsenko@linaro.org>

dt-bindings: Only show unique unit address warning for enabled nodes

There are valid cases when two nodes can have the same address. For
example, in Exynos SoCs there is USI IP-core, which might be configured
to provide UART, SPI or I2C block, all of which having the same base
register address. But only one can be enabled at a time. That looks like
this:

usi@138200c0 {
serial@13820000 {
status = "okay";
};

i2c@13820000 {
status = "disabled";
};
};

When running "make dt_binding_check", it reports next warning:

Warning (unique_unit_address):
/example-0/usi@138200c0/serial@13820000:
duplicate unit-address (also used in node
/example-0/usi@138200c0/i2c@13820000)

Disable "unique_unit_address" in DTC_FLAGS to suppress warnings like
that, but enable "unique_unit_address_if_enabled" warning, so that dtc
still reports a warning when two enabled nodes are having the same
address.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reported-by: Rob Herring <robh@kernel.org>
Suggested-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20211203183517.11390-1-semen.protsenko@linaro.org
Signed-off-by: Rob Herring <robh@kernel.org>


# 28ead0a4 26-Oct-2021 Rob Herring <robh@kernel.org>

dt-bindings: Add a help message when dtschema tools are missing

The dtschema version check works, but is not that clear when dtschema is
either not installed or not in the PATH. Add a separate check and
message if dt-doc-validate is not found.

Cc: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Rob Herring <robh@kernel.org>


# 378be0cc 17-Oct-2021 Geert Uytterhoeven <geert+renesas@glider.be>

dt-bindings: Consider DT_SCHEMA_FILES when finding all json-schema

Setting DT_SCHEMA_FILES allows the user to restrict the
"dt_binding_check" make target to a specified set of DT binding files.
However, yamllint is still run on all available files, which not only
takes time, but also outputs warnings for other binding files the
developer is not interested in.

Fix this by renaming "find_cmd" to "find_all_cmd", introducing a new
"find_cmd" to only return the files specified by DT_SCHEMA_FILES (if
present), and using the latter for yamllint and dt-doc-validate.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/174ab1d791b7bc65f3b0f11b72be13af1748c731.1634551582.git.geert+renesas@glider.be
[robh: Also use only DT_SCHEMA_FILES for dt-doc-validate]
Signed-off-by: Rob Herring <robh@kernel.org>


# 3985aa6f 17-Oct-2021 Geert Uytterhoeven <geert+renesas@glider.be>

dt-bindings: Parallelize yamllint

Use xargs sharding like "chk_bindings" does, to parallelize the
execution of yamllint.

This reduces the yamllint execution time from ca. 21 to 5 seconds on
i7-8700K.

Suggested-by: Rob Herring <robh+dt@kernel.org>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/c68bdbdf3112c4658e0748c8fc51959e69fbae2e.1634551582.git.geert+renesas@glider.be
Signed-off-by: Rob Herring <robh@kernel.org>


# c4fdbf5e 19-Aug-2021 Rob Herring <robh@kernel.org>

dt-bindings: Output yamllint warnings to stderr

yamllint warnings go to stdout which means on a quiet build no warnings
are output. Fix this and redirect the yamllint output to stderr.

Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20210820000047.1667819-1-robh@kernel.org


# 6e0839fd 13-Mar-2021 Masahiro Yamada <masahiroy@kernel.org>

kbuild: replace sed with $(subst ) or $(patsubst )

For simple text replacement, it is better to use a built-in function
instead of sed if possible. You can save one process forking.

I do not mean to replace all sed invocations because GNU Make itself
does not support regular expression (unless you use guile).

I just replaced simple ones.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# c59773d2 11-Mar-2021 Rob Herring <robh@kernel.org>

kbuild: Enable DT undocumented compatible checks

dt-validate has an option to warn on any compatible strings which don't
match any schema. The option has recently been improved to fix false
positives, so let's enable the option. This is useful for tracking
compatibles which are undocumented or not yet converted to DT schema.
Previously, the only check of undocumented compatible strings has been
an imperfect checkpatch.pl check.

The option is enabled by default for 'dtbs_check'. This will add more
warnings, but some platforms are down to only a handful of these
warnings (good job!).

There's about 100 cases in the binding examples, so the option is
disabled until these are fixed. In the meantime, they can be checked
with:

make DT_CHECKER_FLAGS=-m dt_binding_check

Cc: Maxime Ripard <mripard@kernel.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Michal Marek <michal.lkml@markovi.net>
Cc: linux-kbuild@vger.kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20210311233640.1581526-2-robh@kernel.org


# e2b0d998 11-Mar-2021 Rob Herring <robh@kernel.org>

dt-bindings: Bump dtschema version required to v2021.2.1

There's several dependencies in dtschema since v2020.8.1 we need, so
let's bump the version required to v2021.2.1. Specifically, the
graph.yaml schema and improved undocumented compatible check are needed.

Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20210311233640.1581526-1-robh@kernel.org


# 2047ace9 19-Jan-2021 Masahiro Yamada <masahiroy@kernel.org>

kbuild: use always-y instead of extra-y

As commit d0e628cd817f ("kbuild: doc: clarify the difference between
extra-y and always-y") explained, extra-y should be used for listing
the prerequisites of vmlinux.

These targets are not related to vmlinux. always-y is a better fix.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Rob Herring <robh@kernel.org>


# a21ca2da 01-Feb-2021 Iskren Chernev <iskren.chernev@gmail.com>

dt-bindings: Use portable sort for version cmp

sort -C is like sort -c >/dev/null but less portable. It fails on
busybox sort (i.e alpine linux).

Signed-off-by: Iskren Chernev <iskren.chernev@gmail.com>
Fixes: ea5b8b5eb004 ("dt-bindings: Add a minimum version check for dtschema")
Link: https://lore.kernel.org/r/20210201165829.58656-1-iskren.chernev@gmail.com
Signed-off-by: Rob Herring <robh@kernel.org>


# 96993a59 18-Nov-2020 Cristian Ciocaltea <cristian.ciocaltea@gmail.com>

dt-bindings: Fix error in 'make dtbs_check' when using DT_SCHEMA_FILES

If DT_SCHEMA_FILES is specified and contains more than one file paths,
'make dtbs_check' fails with the following message:

$ make dtbs_check DT_SCHEMA_FILES="path/to/schema1.yaml path/to/schema2.yaml"
SCHEMA Documentation/devicetree/bindings/processed-schema.json
Documentation/devicetree/bindings/Makefile:77: recipe for target 'Documentation/devicetree/bindings/processed-schema.json' failed
make[1]: *** [Documentation/devicetree/bindings/processed-schema.json] Error 255
make[1]: *** Deleting file 'Documentation/devicetree/bindings/processed-schema.json'
Makefile:1364: recipe for target 'dt_binding_check' failed
make: *** [dt_binding_check] Error 2

The error code 255 is returned by 'dt-mk-schema' when invoked as
'dt-mk-schema -j -u @<tmp-file>', where '<tmp-file>' is a temporary
file that is generated to contain a list of SPACE delimited schema
file paths, as indicated via DT_SCHEMA_FILES.

However, it seems the file format has been recently changed in
'dt-mk-schema', which now expects each schema path to be provided on
a separate line:

$ dt-mk-schema --version
2020.12.dev4+g6de1c45

Therefore, let's change '<tmp-file>' content format from

path/to/schema1.yaml path/to/schema2.yaml ... path/to/schemaN.yaml

to

path/to/schema1.yaml
path/to/schema2.yaml
...
path/to/schemaN.yaml

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
Link: https://lore.kernel.org/r/2519b8bde507ca6ccea9765ea197adaaa69a66d5.1605712328.git.cristian.ciocaltea@gmail.com
Signed-off-by: Rob Herring <robh@kernel.org>


# 3e95dfb3 20-Nov-2020 Rob Herring <robh@kernel.org>

dt-bindings: Don't error out on yamllint and dt-doc-validate errors

A broken schema file now causes make to exit and 'make -k' no longer works
now that dt-doc-validate is called from a single make rule.

As yamllint is optional, we shouldn't stop on yamllint errors either. Also,
it seems some old versions of yamllint don't work.

Signed-off-by: Rob Herring <robh@kernel.org>


# 44ec8b20 08-Oct-2020 Rob Herring <robh@kernel.org>

dt-bindings: Add running yamllint to dt_binding_check

Add a yamllint config file and support for running yamllint on DT
binding schema files. This runs on the whole tree as yamllint is Python
and suffers from Python's slow startup times.

Users can run on individual files doing:

yamllint -c Documentation/devicetree/bindings/.yamllint <binding file>

Link: https://lore.kernel.org/r/20201009170557.168785-1-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>


# 7ba58fff 06-Aug-2020 Rob Herring <robh@kernel.org>

dt-bindings: Validate DT binding schema in a single call

As the number of binding schemas has grown, the time to run
dt_binding_check has gotten pretty slow. A large part of this is due to
the slow startup time of Python (a well documented problem). There's not
currently any benefit to running dt-doc-validate one file at a time, so
let's switch it to run a single rule. Doing this means we loose the make
parallelism, but we can use xargs instead. This speeds up the validation
time from several minutes to <10 sec.

Since the validation is a single step with no output, we move running it
as part of the processed-schema-examples.json target. We also need to
reorder the extra-y entries so the validation is run first rather than
after all the examples are extracted.

Signed-off-by: Rob Herring <robh@kernel.org>


# b8a49399 13-Aug-2020 Andrei Ziureaev <andrei.ziureaev@arm.com>

dt-bindings: Use json for processed-schema*

Change the format of processed-schema* from yaml to json to speed up
validation. With json output, using xargs and appending the output won't
work since json has explicit list begin and end characters. Instead,
we pass the schema files as a list in a temp file.

The parsing time for the processed schema goes down from ~2sec to 70ms.
Also, 'make dtbs_check' becomes 33% faster.

Some error messages are affected by this change. For example, "True was
expected" becomes "... is not of type 'boolean'". The order of messages
is also changed.

Signed-off-by: Andrei Ziureaev <andrei.ziureaev@arm.com>
Signed-off-by: Rob Herring <robh@kernel.org>


# 3e6ae243 13-Aug-2020 Rob Herring <robh@kernel.org>

dt-bindings: Bump minimum version of dtschema to 2020.8.1

dtschema release 2020.8.1 gained several additions to help performance.
dt-doc-validate can now take a list of files and directories, and
dt-mk-schema can store the processed schema in JSON which is much faster
to parse than YAML. Utilizing both of these changes results in a 3-4x
speed improvement in running dt_binding_check.

There's also additional meta-schema checks which binding schemas should
be checked against.

Signed-off-by: Rob Herring <robh@kernel.org>


# dee9c0b5 25-Jun-2020 Masahiro Yamada <masahiroy@kernel.org>

dt-bindings: copy process-schema-examples.yaml to process-schema.yaml

There are two processed schema files:

- processed-schema-examples.yaml

Used for 'make dt_binding_check'. This is always a full schema.

- processed-schema.yaml

Used for 'make dtbs_check'. This may be a full schema, or a smaller
subset if DT_SCHEMA_FILES is given by a user.

If DT_SCHEMA_FILES is not specified, they are the same. You can copy
the former to the latter instead of running dt-mk-schema twice. This
saves the cpu time a lot when you do 'make dt_binding_check dtbs_check'
because building the full schema takes a couple of seconds.

If DT_SCHEMA_FILES is specified, processed-schema.yaml is generated
based on the specified yaml files.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Link: https://lore.kernel.org/r/20200625170434.635114-4-masahiroy@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>


# ce810eeb 25-Jun-2020 Masahiro Yamada <masahiroy@kernel.org>

dt-bindings: do not build processed-schema.yaml for 'make dt_binding_check'

Currently, processed-schema.yaml is always built, but it is actually
used only for 'make dtbs_check'.

'make dt_binding_check' uses processed-schema-example.yaml instead.

Build processed-schema.yaml only for 'make dtbs_check'.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Link: https://lore.kernel.org/r/20200625170434.635114-3-masahiroy@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>


# fa714cf5 25-Jun-2020 Masahiro Yamada <masahiroy@kernel.org>

dt-bindings: fix error in 'make clean' after 'make dt_binding_check'

We are having more and more schema files.

Commit 8b6b80218b01 ("dt-bindings: Fix command line length limit
calling dt-mk-schema") fixed the 'Argument list too long' error of
the schema checks, but the same error happens while cleaning too.

'make clean' after 'make dt_binding_check' fails as follows:

$ make dt_binding_check
[ snip ]
$ make clean
make[2]: execvp: /bin/sh: Argument list too long
make[2]: *** [scripts/Makefile.clean:52: __clean] Error 127
make[1]: *** [scripts/Makefile.clean:66: Documentation/devicetree/bindings] Error 2
make: *** [Makefile:1763: _clean_Documentation] Error 2

'make dt_binding_check' generates so many .example.dts, .dt.yaml files,
which are passed to the 'rm' command when you run 'make clean'.

I added a small hack to use the 'find' command to clean up most of the
build artifacts before they are processed by scripts/Makefile.clean

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Link: https://lore.kernel.org/r/20200625170434.635114-2-masahiroy@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>


# 3eb619b2 29-Jun-2020 Rob Herring <robh@kernel.org>

scripts/dtc: Update to upstream version v1.6.0-11-g9d7888cbf19c

Sync with upstream dtc primarily to pickup the I2C bus check fixes. The
interrupt_provider check is noisy, so turn it off for now.

This adds the following commits from upstream:

9d7888cbf19c dtc: Consider one-character strings as strings
8259d59f59de checks: Improve i2c reg property checking
fdabcf2980a4 checks: Remove warning for I2C_OWN_SLAVE_ADDRESS
2478b1652c8d libfdt: add extern "C" for C++
f68bfc2668b2 libfdt: trivial typo fix
7be250b4d059 libfdt: Correct condition for reordering blocks
81e0919a3e21 checks: Add interrupt provider test
85e5d839847a Makefile: when building libfdt only, do not add unneeded deps
b28464a550c5 Fix some potential unaligned accesses in dtc

Signed-off-by: Rob Herring <robh@kernel.org>


# ea5b8b5e 05-Mar-2020 Rob Herring <robh@kernel.org>

dt-bindings: Add a minimum version check for dtschema

The dtschema package must be somewhat up to date as the tools and
meta-schema checks are still evolving. Implement a version check,
so this can be enforced. This will help ensure new schema submissions
get checked against the latest meta-schemas.

Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Rob Herring <robh@kernel.org>


# 8b6b8021 21-Apr-2020 Rob Herring <robh@kernel.org>

dt-bindings: Fix command line length limit calling dt-mk-schema

As the number of schemas has increased, we're starting to hit the error
"execvp: /bin/sh: Argument list too long". This is due to passing all the
schema files on the command line to dt-mk-schema. It currently is only
with out of tree builds and is intermittent depending on the file path
lengths.

Commit 2ba06cd8565b ("kbuild: Always validate DT binding examples") made
hitting this proplem more likely since the example validation now always
gets the full list of schemas.

Fix this by passing the schema file list in a pipe and using xargs. We end
up doing the find twice, but the time is insignificant compared to the
dt-mk-schema time.

Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Rob Herring <robh@kernel.org>


# e996c1fd 21-Apr-2020 Rob Herring <robh@kernel.org>

dt-bindings: Re-enable core schemas for dtbs_check

In commit 2ba06cd8565b ("kbuild: Always validate DT binding examples"),
the core schemas (from dtschema repo) were inadvertently disabled for
dtbs_checks. Re-enable them.

Fixes: 2ba06cd8565b ("kbuild: Always validate DT binding examples")
Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Rob Herring <robh@kernel.org>


# e10c4321 03-Mar-2020 Masahiro Yamada <masahiroy@kernel.org>

kbuild: allow to run dt_binding_check and dtbs_check in a single command

Since commit 93512dad334d ("dt-bindings: Improve validation build error
handling"), 'make dtbs_check' does not validate the schema fully.

If you want to check everything, you need to run two commands separately.

$ make ARCH=arm dt_binding_check
$ make ARCH=arm dtbs_check

They are exclusive each other, so you cannot do like this:

$ make ARCH=arm dt_binding_check dtbs_check

In this case, dt-doc-validate and dt-extract-example are skipped
because CHECK_DTBS is set.

Let's make it possible to run these two targets in a single command.
It will be useful for schema writers.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Rob Herring <robh@kernel.org>


# 65220630 28-Feb-2020 Rob Herring <robh@kernel.org>

kbuild: Build DT binding examples with dtc warnings enabled

Now that we have a separate rule for DT binding examples, we can customize
the dtc options. Let's adjust the dtc warnings to me more strict by
default so the examples get cleaned up as they get converted to schema.

Leaving 'avoid_unnecessary_addr_size' and 'graph_child_address' warnings
disabled as examples tend to be incomplete and they generates a lot of
warnings.

Co-developed-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 2ba06cd8 28-Feb-2020 Rob Herring <robh@kernel.org>

kbuild: Always validate DT binding examples

Most folks only run dt_binding_check on the single schema they care about
by setting DT_SCHEMA_FILES. That means example is only checked against
that one schema which is not always sufficient.

Let's address this by splitting processed-schema.yaml into 2 files: one
that's always all schemas for the examples and one that's just the schema
in DT_SCHEMA_FILES for dtbs.

Co-developed-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 93512dad 13-Nov-2019 Rob Herring <robh@kernel.org>

dt-bindings: Improve validation build error handling

Schema errors can cause make to exit before useful information is
printed. This leaves developers wondering what's wrong. It can be
overcome passing '-k' to make, but that's not an obvious solution.
There's 2 scenarios where this happens.

When using DT_SCHEMA_FILES to validate with a single schema, any error
in the schema results in processed-schema.yaml being empty causing a
make error. The result is the specific errors in the schema are never
shown because processed-schema.yaml is the first target built. Simply
making processed-schema.yaml last in extra-y ensures the full schema
validation with detailed error messages happen first.

The 2nd problem is while schema errors are ignored for
processed-schema.yaml, full validation of the schema still runs in
parallel and any schema validation errors will still stop the build when
running validation of dts files. The fix is to not add the schema
examples to extra-y in this case. This means 'dtbs_check' is no longer a
superset of 'dt_binding_check'. Update the documentation to make this
clear.

Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Tested-by: Jeffrey Hugo <jhugo@codeaurora.org>
Signed-off-by: Rob Herring <robh@kernel.org>


# 740ce365 30-Jul-2019 Rob Herring <robh@kernel.org>

dt-bindings: Fix generated example files getting added to schemas

Commit 837158b847a4 ("dt-bindings: Check the examples against the
schemas") started generating YAML encoded DT files to validate the
examples against the schema. When running 'make dt_binding_check' in
tree after the 1st time, the generated example .dt.yaml files are
mistakenly added to the list of schema files. Exclude *.example.dt.yaml
files from the search for schema files.

Fixes: 837158b847a4 ("dt-bindings: Check the examples against the schemas")
Reported-by: Guido Günther <agx@sigxcpu.org>
Tested-by: Guido Günther <agx@sigxcpu.org>
Signed-off-by: Rob Herring <robh@kernel.org>


# 837158b8 17-May-2019 Rob Herring <robh@kernel.org>

dt-bindings: Check the examples against the schemas

Currently, the binding examples are just built with dtc. dtc recently
gained the support necessary to output the examples in YAML format
(commit 87963ee20693 ("livetree: add missing type markers in generated
overlay properties"). Now just switch the output format and the examples
will be checked against the schema.

Reviewed-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Rob Herring <robh@kernel.org>


# 05aeca7c 09-May-2019 Rob Herring <robh@kernel.org>

dt-bindings: Pass binding directory to validation tools

In order to have $ref's to schema files within the kernel, we need to
pass the base path of bindings to the schema validation tools.

Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Michal Marek <michal.lkml@markovi.net>
Cc: devicetree@vger.kernel.org
Cc: linux-kbuild@vger.kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>


# afa974b7 17-Jan-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

kbuild: add real-prereqs shorthand for $(filter-out FORCE,$^)

In Kbuild, if_changed and friends must have FORCE as a prerequisite.

Hence, $(filter-out FORCE,$^) or $(filter-out $(PHONY),$^) is a common
idiom to get the names of all the prerequisites except phony targets.

Add real-prereqs as a shorthand.

Note:
We cannot replace $(filter %.o,$^) in cmd_link_multi-m because $^ may
include auto-generated dependencies from the .*.cmd file when a single
object module is changed into a multi object module. Refer to commit
69ea912fda74 ("kbuild: remove unneeded link_multi_deps"). I added some
comment to avoid accidental breakage.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Rob Herring <robh@kernel.org>


# 5fa98c2e 22-Jan-2019 Rob Herring <robh@kernel.org>

dt-bindings: Fix dt_binding_check target for in tree builds

On in tree builds, subsequent builds will incorrectly include
the intermediate file 'processed-schema.yaml' with the input schema
files resulting in a build error. Update the find command to ignore
processed-schema.yaml.

Signed-off-by: Rob Herring <robh@kernel.org>


# 4f0e3a57 06-Sep-2018 Rob Herring <robh@kernel.org>

kbuild: Add support for DT binding schema checks

This adds the build infrastructure for checking DT binding schema
documents and validating dts files using the binding schema.

Check DT binding schema documents:
make dt_binding_check

Build dts files and check using DT binding schema:
make dtbs_check

Optionally, DT_SCHEMA_FILES can be passed in with a schema file(s) to
use for validation. This makes it easier to find and fix errors
generated by a specific schema.

Currently, the validation targets are separate from a normal build to
avoid a hard dependency on the external DT schema project and because
there are lots of warnings generated.

Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Mark Rutland <mark.rutland@arm.com>
Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Michal Marek <michal.lkml@markovi.net>
Cc: linux-doc@vger.kernel.org
Cc: devicetree@vger.kernel.org
Cc: linux-kbuild@vger.kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>