diff mbox series

[04/18] dt-bindings: mtd: spi-nand: Convert spi-nand description file to yaml

Message ID 20211020142809.349347-5-miquel.raynal@bootlin.com
State Changes Requested, archived
Headers show
Series External ECC engines & Macronix support | expand

Checks

Context Check Description
robh/checkpatch warning total: 0 errors, 2 warnings, 27 lines checked
robh/dt-meta-schema fail build log

Commit Message

Miquel Raynal Oct. 20, 2021, 2:27 p.m. UTC
Let's get rid of spi-nand.txt by converting it to yaml schema. While at
converting this file, let's actually pull all the generic properties
from nand-chip.yaml which might apply to a SPI-NAND chip.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 .../devicetree/bindings/mtd/spi-nand.txt      |  5 ----
 .../devicetree/bindings/mtd/spi-nand.yaml     | 27 +++++++++++++++++++
 2 files changed, 27 insertions(+), 5 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/mtd/spi-nand.txt
 create mode 100644 Documentation/devicetree/bindings/mtd/spi-nand.yaml

Comments

Rob Herring Oct. 20, 2021, 9:14 p.m. UTC | #1
On Wed, 20 Oct 2021 16:27:55 +0200, Miquel Raynal wrote:
> Let's get rid of spi-nand.txt by converting it to yaml schema. While at
> converting this file, let's actually pull all the generic properties
> from nand-chip.yaml which might apply to a SPI-NAND chip.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
>  .../devicetree/bindings/mtd/spi-nand.txt      |  5 ----
>  .../devicetree/bindings/mtd/spi-nand.yaml     | 27 +++++++++++++++++++
>  2 files changed, 27 insertions(+), 5 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/mtd/spi-nand.txt
>  create mode 100644 Documentation/devicetree/bindings/mtd/spi-nand.yaml
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Unknown file referenced: [Errno 2] No such file or directory: '/usr/local/lib/python3.8/dist-packages/dtschema/schemas/mtd/nand-chip.yaml'
xargs: dt-doc-validate: exited with status 255; aborting
make[1]: *** Deleting file 'Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.example.dt.yaml'
Unknown file referenced: [Errno 2] No such file or directory: '/usr/local/lib/python3.8/dist-packages/dtschema/schemas/mtd/nand-chip.yaml'
make[1]: *** [scripts/Makefile.lib:385: Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.example.dt.yaml] Error 255
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1441: dt_binding_check] Error 2

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/1543922

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.
Miquel Raynal Oct. 21, 2021, 2:09 p.m. UTC | #2
Hi Rob,

robh@kernel.org wrote on Wed, 20 Oct 2021 16:14:47 -0500:

> On Wed, 20 Oct 2021 16:27:55 +0200, Miquel Raynal wrote:
> > Let's get rid of spi-nand.txt by converting it to yaml schema. While at
> > converting this file, let's actually pull all the generic properties
> > from nand-chip.yaml which might apply to a SPI-NAND chip.
> > 
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > ---
> >  .../devicetree/bindings/mtd/spi-nand.txt      |  5 ----
> >  .../devicetree/bindings/mtd/spi-nand.yaml     | 27 +++++++++++++++++++
> >  2 files changed, 27 insertions(+), 5 deletions(-)
> >  delete mode 100644 Documentation/devicetree/bindings/mtd/spi-nand.txt
> >  create mode 100644 Documentation/devicetree/bindings/mtd/spi-nand.yaml
> >   
> 
> My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> on your patch (DT_CHECKER_FLAGS is new in v5.13):
> 
> yamllint warnings/errors:
> 
> dtschema/dtc warnings/errors:
> Unknown file referenced: [Errno 2] No such file or directory: '/usr/local/lib/python3.8/dist-packages/dtschema/schemas/mtd/nand-chip.yaml'
> xargs: dt-doc-validate: exited with status 255; aborting
> make[1]: *** Deleting file 'Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.example.dt.yaml'
> Unknown file referenced: [Errno 2] No such file or directory: '/usr/local/lib/python3.8/dist-packages/dtschema/schemas/mtd/nand-chip.yaml'
> make[1]: *** [scripts/Makefile.lib:385: Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.example.dt.yaml] Error 255
> make[1]: *** Waiting for unfinished jobs....
> make: *** [Makefile:1441: dt_binding_check] Error 2

I am not able to reproduce this error and in general I don't understand
it. There is no relationship between this change and
snps,dw-apb-ssi.yaml. Also the fact that nand-chip-yaml do not exist,
it was just created in the patch before so I wonder how much I should
trust this error.

Also, maybe I am not using the tools properly, but it is very hard to
send correct bindings at the first try. Running make dt_binding_check
takes ages, any change in one yaml file will recheck the entire data
base and filtering out on a single yaml file is generally too
restrictive and still prints unrelated errors of syntax on other files.
I don't know how much of this is actually expected and/or if someone is
working on it.

Thanks,
Miquèl
Rob Herring Oct. 22, 2021, 10:36 p.m. UTC | #3
On Thu, Oct 21, 2021 at 04:09:32PM +0200, Miquel Raynal wrote:
> Hi Rob,
> 
> robh@kernel.org wrote on Wed, 20 Oct 2021 16:14:47 -0500:
> 
> > On Wed, 20 Oct 2021 16:27:55 +0200, Miquel Raynal wrote:
> > > Let's get rid of spi-nand.txt by converting it to yaml schema. While at
> > > converting this file, let's actually pull all the generic properties
> > > from nand-chip.yaml which might apply to a SPI-NAND chip.
> > > 
> > > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > > ---
> > >  .../devicetree/bindings/mtd/spi-nand.txt      |  5 ----
> > >  .../devicetree/bindings/mtd/spi-nand.yaml     | 27 +++++++++++++++++++
> > >  2 files changed, 27 insertions(+), 5 deletions(-)
> > >  delete mode 100644 Documentation/devicetree/bindings/mtd/spi-nand.txt
> > >  create mode 100644 Documentation/devicetree/bindings/mtd/spi-nand.yaml
> > >   
> > 
> > My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> > on your patch (DT_CHECKER_FLAGS is new in v5.13):
> > 
> > yamllint warnings/errors:
> > 
> > dtschema/dtc warnings/errors:
> > Unknown file referenced: [Errno 2] No such file or directory: '/usr/local/lib/python3.8/dist-packages/dtschema/schemas/mtd/nand-chip.yaml'
> > xargs: dt-doc-validate: exited with status 255; aborting
> > make[1]: *** Deleting file 'Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.example.dt.yaml'
> > Unknown file referenced: [Errno 2] No such file or directory: '/usr/local/lib/python3.8/dist-packages/dtschema/schemas/mtd/nand-chip.yaml'
> > make[1]: *** [scripts/Makefile.lib:385: Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.example.dt.yaml] Error 255
> > make[1]: *** Waiting for unfinished jobs....
> > make: *** [Makefile:1441: dt_binding_check] Error 2
> 
> I am not able to reproduce this error and in general I don't understand
> it. There is no relationship between this change and
> snps,dw-apb-ssi.yaml. Also the fact that nand-chip-yaml do not exist,
> it was just created in the patch before so I wonder how much I should
> trust this error.

I think you can ignore this. The prior patch should have been applied, 
but looks like it wasn't. My script's patch applying logic is not what 
I'd call robust.

> Also, maybe I am not using the tools properly, but it is very hard to
> send correct bindings at the first try. Running make dt_binding_check
> takes ages, any change in one yaml file will recheck the entire data
> base and filtering out on a single yaml file is generally too
> restrictive and still prints unrelated errors of syntax on other files.

Do you set 'DT_SCHEMA_FILES'? That will check just the schema you set 
it to. You still need to not set it at the end because any schema could 
apply to any example, so we have to check everything.

Also using DT_SCHEMA_FILES should be a bit faster with what's queued for 
5.16.

> I don't know how much of this is actually expected and/or if someone is
> working on it.

Due to python startup times being slow, it turns out to generally be 
faster to not have make track changes and do things incrementally. 
That's why all the schema are checked at once (though sharded with 
xargs). So I'm not really sure there's much we can do. I've certainly 
investigated it.

Rob
Rob Herring Oct. 28, 2021, 9:28 p.m. UTC | #4
On Wed, Oct 20, 2021 at 04:27:55PM +0200, Miquel Raynal wrote:
> Let's get rid of spi-nand.txt by converting it to yaml schema. While at
> converting this file, let's actually pull all the generic properties
> from nand-chip.yaml which might apply to a SPI-NAND chip.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
>  .../devicetree/bindings/mtd/spi-nand.txt      |  5 ----
>  .../devicetree/bindings/mtd/spi-nand.yaml     | 27 +++++++++++++++++++
>  2 files changed, 27 insertions(+), 5 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/mtd/spi-nand.txt
>  create mode 100644 Documentation/devicetree/bindings/mtd/spi-nand.yaml

Reviewed-by: Rob Herring <robh@kernel.org>
Miquel Raynal Nov. 24, 2021, 1:54 p.m. UTC | #5
Hi Rob,

robh@kernel.org wrote on Fri, 22 Oct 2021 17:36:18 -0500:

> On Thu, Oct 21, 2021 at 04:09:32PM +0200, Miquel Raynal wrote:
> > Hi Rob,
> > 
> > robh@kernel.org wrote on Wed, 20 Oct 2021 16:14:47 -0500:
> >   
> > > On Wed, 20 Oct 2021 16:27:55 +0200, Miquel Raynal wrote:  
> > > > Let's get rid of spi-nand.txt by converting it to yaml schema. While at
> > > > converting this file, let's actually pull all the generic properties
> > > > from nand-chip.yaml which might apply to a SPI-NAND chip.
> > > > 
> > > > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > > > ---
> > > >  .../devicetree/bindings/mtd/spi-nand.txt      |  5 ----
> > > >  .../devicetree/bindings/mtd/spi-nand.yaml     | 27 +++++++++++++++++++
> > > >  2 files changed, 27 insertions(+), 5 deletions(-)
> > > >  delete mode 100644 Documentation/devicetree/bindings/mtd/spi-nand.txt
> > > >  create mode 100644 Documentation/devicetree/bindings/mtd/spi-nand.yaml
> > > >     
> > > 
> > > My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> > > on your patch (DT_CHECKER_FLAGS is new in v5.13):
> > > 
> > > yamllint warnings/errors:
> > > 
> > > dtschema/dtc warnings/errors:
> > > Unknown file referenced: [Errno 2] No such file or directory: '/usr/local/lib/python3.8/dist-packages/dtschema/schemas/mtd/nand-chip.yaml'
> > > xargs: dt-doc-validate: exited with status 255; aborting
> > > make[1]: *** Deleting file 'Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.example.dt.yaml'
> > > Unknown file referenced: [Errno 2] No such file or directory: '/usr/local/lib/python3.8/dist-packages/dtschema/schemas/mtd/nand-chip.yaml'
> > > make[1]: *** [scripts/Makefile.lib:385: Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.example.dt.yaml] Error 255
> > > make[1]: *** Waiting for unfinished jobs....
> > > make: *** [Makefile:1441: dt_binding_check] Error 2  
> > 
> > I am not able to reproduce this error and in general I don't understand
> > it. There is no relationship between this change and
> > snps,dw-apb-ssi.yaml. Also the fact that nand-chip-yaml do not exist,
> > it was just created in the patch before so I wonder how much I should
> > trust this error.  
> 
> I think you can ignore this. The prior patch should have been applied, 
> but looks like it wasn't. My script's patch applying logic is not what 
> I'd call robust.

Ok, I understand what's happening behind the scenes, no problem with
this.

> 
> > Also, maybe I am not using the tools properly, but it is very hard to
> > send correct bindings at the first try. Running make dt_binding_check
> > takes ages, any change in one yaml file will recheck the entire data
> > base and filtering out on a single yaml file is generally too
> > restrictive and still prints unrelated errors of syntax on other files.  
> 
> Do you set 'DT_SCHEMA_FILES'? That will check just the schema you set 
> it to. You still need to not set it at the end because any schema could 
> apply to any example, so we have to check everything.

Actually I think this is what could be enhanced: when I use
DT_SCHEMA_FILES the output is always polluted with errors with nothing
(at least from my user point of view) related to the files I am
working on. See [1] for an example of output that I found hard to parse
for errors related to my changes: I am looking for issues in
nand-chip.yaml and (50 seconds later) I get warnings for:
- ilitek,ili9341.yaml
- snps,dwcmshc-sdhci.yaml
- ti,sn65dsi83.yaml
- nxp,dwmac-imx.yaml
- fsl,imx6q-pcie.yaml

Do you think the reporting can be improved?

> Also using DT_SCHEMA_FILES should be a bit faster with what's queued for 
> 5.16.

Great!

> 
> > I don't know how much of this is actually expected and/or if someone is
> > working on it.  
> 
> Due to python startup times being slow, it turns out to generally be 
> faster to not have make track changes and do things incrementally. 
> That's why all the schema are checked at once (though sharded with 
> xargs). So I'm not really sure there's much we can do. I've certainly 
> investigated it.

I understand it's not that easy and takes a lot of time, thanks anyway
for all your work on this topic.

Thanks,
Miquèl

[1]
$ time make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/mtd/nand-chip.yaml
  LINT    Documentation/devicetree/bindings
./Documentation/devicetree/bindings/display/panel/ilitek,ili9341.yaml:25:9: [warning] wrong indentation: expected 10 but found 8 (indentation)
  CHKDT   Documentation/devicetree/bindings/processed-schema-examples.json
/home/mraynal/macronix/linux/Documentation/devicetree/bindings/pci/: properties:interrupt-names: 'oneOf' conditional failed, one must be fixed:
	[{'const': 'msi'}] is too short
	False schema does not allow 1
	hint: "minItems" is only needed if less than the "items" list length
	from schema $id: http://devicetree.org/meta-schemas/items.yaml#
/home/mraynal/macronix/linux/Documentation/devicetree/bindings/mmc/snps,dwcmshc-sdhci.yaml: properties:reg: 'oneOf' conditional failed, one must be fixed:
	[{'description': 'Offset and length of the register set for the device'}] is too short
	False schema does not allow 1
	hint: "minItems" is only needed if less than the "items" list length
	from schema $id: http://devicetree.org/meta-schemas/items.yaml#
/home/mraynal/macronix/linux/Documentation/devicetree/bindings/display/bridge/: properties:ports:properties:port@0:properties:endpoint:properties:data-lanes: {'required': ['maxItems']} is not allowed for {'description': 'array of physical DSI data lane indexes.', 'minItems': 1, 'maxItems': 4, 'items': [{'const': 1}, {'const': 2}, {'const': 3}, {'const': 4}]}
	hint: "maxItems" is not needed with an "items" list
	from schema $id: http://devicetree.org/meta-schemas/items.yaml#
/home/mraynal/macronix/linux/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml: properties:ports:properties:port@1:properties:endpoint:properties:data-lanes: {'required': ['maxItems']} is not allowed for {'description': 'array of physical DSI data lane indexes.', 'minItems': 1, 'maxItems': 4, 'items': [{'const': 1}, {'const': 2}, {'const': 3}, {'const': 4}]}
	hint: "maxItems" is not needed with an "items" list
	from schema $id: http://devicetree.org/meta-schemas/items.yaml#
/home/mraynal/macronix/linux/Documentation/devicetree/bindings/net/nxp,dwmac-imx.yaml: properties:clocks: {'required': ['maxItems']} is not allowed for {'minItems': 3, 'maxItems': 5, 'items': [{'description': 'MAC host clock'}, {'description': 'MAC apb clock'}, {'description': 'MAC timer clock'}, {'description': 'MAC RGMII TX clock'}, {'description': 'EQOS MEM clock'}]}
	hint: "maxItems" is not needed with an "items" list
	from schema $id: http://devicetree.org/meta-schemas/items.yaml#
  SCHEMA  Documentation/devicetree/bindings/processed-schema-examples.json
/home/mraynal/macronix/linux/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml: ignoring, error in schema: properties: interrupt-names
warning: no schema found in file: ./Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml
/home/mraynal/macronix/linux/Documentation/devicetree/bindings/mmc/snps,dwcmshc-sdhci.yaml: ignoring, error in schema: properties: reg
warning: no schema found in file: ./Documentation/devicetree/bindings/mmc/snps,dwcmshc-sdhci.yaml
/home/mraynal/macronix/linux/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml: ignoring, error in schema: properties: ports: properties: port@0: properties: endpoint: properties: data-lanes
warning: no schema found in file: ./Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml
/home/mraynal/macronix/linux/Documentation/devicetree/bindings/net/nxp,dwmac-imx.yaml: ignoring, error in schema: properties: clocks
warning: no schema found in file: ./Documentation/devicetree/bindings/net/nxp,dwmac-imx.yaml
  DTEX    Documentation/devicetree/bindings/mtd/nand-chip.example.dts
  DTC     Documentation/devicetree/bindings/mtd/nand-chip.example.dt.yaml
  CHECK   Documentation/devicetree/bindings/mtd/nand-chip.example.dt.yaml

real	0m38,958s
user	0m51,604s
sys	0m0,632s
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/mtd/spi-nand.txt b/Documentation/devicetree/bindings/mtd/spi-nand.txt
deleted file mode 100644
index 8b51f3b6d55c..000000000000
--- a/Documentation/devicetree/bindings/mtd/spi-nand.txt
+++ /dev/null
@@ -1,5 +0,0 @@ 
-SPI NAND flash
-
-Required properties:
-- compatible: should be "spi-nand"
-- reg: should encode the chip-select line used to access the NAND chip
diff --git a/Documentation/devicetree/bindings/mtd/spi-nand.yaml b/Documentation/devicetree/bindings/mtd/spi-nand.yaml
new file mode 100644
index 000000000000..19ac57dcffc3
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/spi-nand.yaml
@@ -0,0 +1,27 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mtd/spi-nand.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: SPI-NAND flash device tree bindings
+
+maintainers:
+  - Miquel Raynal <miquel.raynal@bootlin.com>
+
+allOf:
+  - $ref: "nand-chip.yaml#"
+
+properties:
+  compatible:
+    const: spi-nand
+
+  reg:
+    maxItems: 1
+    description: Encode the chip-select line on the SPI bus
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false