Re: [PATCH v2 1/2] kbuild: Always validate DT binding examples

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Rob,

On Tue, Apr 21, 2020 at 10:47 PM Rob Herring <robh@xxxxxxxxxx> wrote:
>
> On Tue, Apr 21, 2020 at 8:16 AM Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote:
> >
> > Hi Laurent,
> >
> > On Tue, Apr 21, 2020 at 8:05 PM Laurent Pinchart
> > <laurent.pinchart@xxxxxxxxxxxxxxxx> wrote:
> > >
> > > Hi Yamada-san,
> > >
> > > On Tue, Apr 21, 2020 at 07:45:05PM +0900, Masahiro Yamada wrote:
> > > > On Tue, Apr 21, 2020 at 7:08 PM Laurent Pinchart wrote:
> > > > > On Fri, Feb 28, 2020 at 06:37:30PM -0600, Rob Herring wrote:
> > > > > > 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.
> > > > >
> > > > > This broke
> > > > >
> > > > > make DT_SCHEMA_FILES=Documentation/devicetree/.. dt_binding_check
> > > >
> > > > What is intended by
> > > > "DT_SCHEMA_FILES=Documentation/devicetree/.."  ?
> > >
> > > My bad, I forgot to write that ... is the continuation of the string.
> > > It's any yaml schema file that has an example.
> >
> > Ah, OK. I just input verbatim.
> >
> > Is it broken?
> >
> > You can specify any individual file(s) under Documentation/devicetree/bindings/.
> >
> > For example, the following worked for me.
>
> Me too.
>
> There is however a bug I just noticed. We're now always setting '-u'
> for dtbs_check which means the core schema are never used.
>
> Masahiro, Got a better suggestion than adding the ifeq:
>
> ifeq ("$(origin DT_SCHEMA_FILES)", "command line")
> $(obj)/processed-schema.yaml: DT_MK_SCHEMA_FLAGS := -u
> endif


Hmm, this does not work when DT_SCHEMA_FILES is
passed as the environment variable.


ifneq ("$(origin DT_SCHEMA_FILES)", "file")
$(obj)/processed-schema.yaml: DT_MK_SCHEMA_FLAGS := -u
endif

... should work, I think.


Maybe, the following also works. Please choose whatever you like.

diff --git a/Documentation/devicetree/bindings/Makefile
b/Documentation/devicetree/bindings/Makefile
index 1df680d07461..a939bb18f66b 100644
--- a/Documentation/devicetree/bindings/Makefile
+++ b/Documentation/devicetree/bindings/Makefile
@@ -2,6 +2,7 @@
 DT_DOC_CHECKER ?= dt-doc-validate
 DT_EXTRACT_EX ?= dt-extract-example
 DT_MK_SCHEMA ?= dt-mk-schema
+DT_MK_SCHEMA_USERONLY_FLAG := $(if $(DT_SCHEMA_FILES), -u)

 quiet_cmd_chk_binding = CHKDT   $(patsubst $(srctree)/%,%,$<)
       cmd_chk_binding = $(DT_DOC_CHECKER) -u $(srctree)/$(src) $< ; \
@@ -37,7 +38,7 @@ override DTC_FLAGS := \
 $(obj)/processed-schema-examples.yaml: $(DT_DOCS) FORCE
        $(call if_changed,mk_schema)

-$(obj)/processed-schema.yaml: DT_MK_SCHEMA_FLAGS := -u
+$(obj)/processed-schema.yaml: DT_MK_SCHEMA_FLAGS :=
$(DT_MK_SCHEMA_USERONLY_FLAG)
 $(obj)/processed-schema.yaml: $(DT_SCHEMA_FILES) FORCE
        $(call if_changed,mk_schema)



-- 
Best Regards
Masahiro Yamada



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux