Skip to content

Commit 2ba06cd

Browse files
robherringmasahir0y
authored andcommitted
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>
1 parent 88694cf commit 2ba06cd

3 files changed

Lines changed: 17 additions & 10 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
*.example.dts
2-
processed-schema.yaml
2+
processed-schema*.yaml

‎Documentation/devicetree/bindings/Makefile‎

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
DT_DOC_CHECKER ?= dt-doc-validate
33
DT_EXTRACT_EX ?= dt-extract-example
44
DT_MK_SCHEMA ?= dt-mk-schema
5-
DT_MK_SCHEMA_FLAGS := $(if $(DT_SCHEMA_FILES), -u)
65

76
quiet_cmd_chk_binding = CHKDT $(patsubst $(srctree)/%,%,$<)
87
cmd_chk_binding = $(DT_DOC_CHECKER) -u $(srctree)/$(src) $< ; \
@@ -11,26 +10,33 @@ quiet_cmd_chk_binding = CHKDT $(patsubst $(srctree)/%,%,$<)
1110
$(obj)/%.example.dts: $(src)/%.yaml FORCE
1211
$(call if_changed,chk_binding)
1312

14-
DT_TMP_SCHEMA := processed-schema.yaml
13+
# Use full schemas when checking %.example.dts
14+
DT_TMP_SCHEMA := $(obj)/processed-schema-examples.yaml
1515

1616
quiet_cmd_mk_schema = SCHEMA $@
1717
cmd_mk_schema = $(DT_MK_SCHEMA) $(DT_MK_SCHEMA_FLAGS) -o $@ $(real-prereqs)
1818

19-
DT_DOCS = $(shell \
19+
DT_DOCS = $(addprefix $(src)/, \
20+
$(shell \
2021
cd $(srctree)/$(src) && \
2122
find * \( -name '*.yaml' ! \
22-
-name $(DT_TMP_SCHEMA) ! \
23+
-name 'processed-schema*' ! \
2324
-name '*.example.dt.yaml' \) \
24-
)
25+
))
2526

26-
DT_SCHEMA_FILES ?= $(addprefix $(src)/,$(DT_DOCS))
27+
DT_SCHEMA_FILES ?= $(DT_DOCS)
2728

2829
ifeq ($(CHECK_DTBS),)
2930
extra-y += $(patsubst $(src)/%.yaml,%.example.dts, $(DT_SCHEMA_FILES))
3031
extra-y += $(patsubst $(src)/%.yaml,%.example.dt.yaml, $(DT_SCHEMA_FILES))
32+
extra-y += processed-schema-examples.yaml
33+
34+
$(obj)/processed-schema-examples.yaml: $(DT_DOCS) FORCE
35+
$(call if_changed,mk_schema)
3136
endif
3237

33-
$(obj)/$(DT_TMP_SCHEMA): $(DT_SCHEMA_FILES) FORCE
38+
$(obj)/processed-schema.yaml: DT_MK_SCHEMA_FLAGS := -u
39+
$(obj)/processed-schema.yaml: $(DT_SCHEMA_FILES) FORCE
3440
$(call if_changed,mk_schema)
3541

36-
extra-y += $(DT_TMP_SCHEMA)
42+
extra-y += processed-schema.yaml

‎scripts/Makefile.lib‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,8 @@ $(obj)/%.dtb: $(src)/%.dts $(DTC) FORCE
297297

298298
DT_CHECKER ?= dt-validate
299299
DT_BINDING_DIR := Documentation/devicetree/bindings
300-
DT_TMP_SCHEMA := $(objtree)/$(DT_BINDING_DIR)/processed-schema.yaml
300+
# DT_TMP_SCHEMA may be overridden from Documentation/devicetree/bindings/Makefile
301+
DT_TMP_SCHEMA ?= $(objtree)/$(DT_BINDING_DIR)/processed-schema.yaml
301302

302303
quiet_cmd_dtb_check = CHECK $@
303304
cmd_dtb_check = $(DT_CHECKER) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@

0 commit comments

Comments
 (0)