Hi Rob,
On Wed, May 08, 2019 at 02:35:10PM -0500, Rob Herring wrote:
- if:
properties:
compatible:
contains:
const: allwinner,sun8i-h3-spdif
- then:
properties:
dmas:
maxItems: 1
In this and below, these should get added automatically by fixup_schema. If not present, we set minItems/maxItems to the size of the items list. It look like you added support for that, so left over from before you addressed that for if/then/else?
Sorry, I should have brought that up in the pull request.
It seems that it's still necessary when using allOf, otherwise the schema won't match
Maybe there's something more to fix when using allOf?
items:
- description: RX DMA Channel
s/RX/TX/
dma-names:
maxItems: 1
items:
- const: tx
- else:
properties:
dmas:
minItems: 2
maxItems: 2
items:
- description: RX DMA Channel
- description: TX DMA Channel
dma-names:
minItems: 2
maxItems: 2
items:
- const: rx
- const: tx
I'm really on the fence whether it's worth it to add all this just add the restrictions based on the compatible. I guess with copy-n-paste this would be a common error.
Converting most of the bindings to the schemas has shown that (at least in our case), we've been pretty bad at keeping the documentation up to date with that kind of information.
Adding that kind of construct at least has the benefit to actively enforce that the documentation is complete.
Maxime
-- Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com