Re: [PATCH] dt-bindings: pwm: drop unneeded quotes
From: Rob Herring
Date: Wed Jun 21 2023 - 17:58:34 EST
On Wed, Jun 21, 2023 at 02:53:17PM -0600, Rob Herring wrote:
> On Mon, Jun 12, 2023 at 11:33:15AM +0200, Uwe Kleine-König wrote:
> > Hello,
> >
> > On Fri, Jun 09, 2023 at 04:07:09PM +0200, Krzysztof Kozlowski wrote:
> > > Cleanup bindings dropping unneeded quotes. Once all these are fixed,
> > > checking for this can be enabled in yamllint.
> >
> > in my book quoting everything instead of dropping quotes is the better
> > option. While that policy adds more quotes, it prevents surprises like:
> >
> > $ yaml2json << EOF
> > > countrycodes:
> > > - de
> > > - fr
> > > - no
> > > - pl
> > > EOF
> > {
> > "countrycodes": [
> > "de",
> > "fr",
> > false,
> > "pl"
> > ]
> > }
> >
> > And if you use the "only-when-needed" rule of yamllint you have to write
> > the above list as:
> >
> > countrycodes:
> > - de
> > - fr
> > - "no"
> > - pl
> >
> > which is IMHO really ugly.
>
> Agreed, but "no" and "yes" are unlikely values in DT.
>
> >
> > Another culprit is "on" (which is used e.g. in github action workflows),
> > so yamllint tells for example for
> > https://github.com/pengutronix/microcom/blob/main/.github/workflows/build.yml:
> >
> > 3:1 warning truthy value should be one of [false, true] (truthy)
> >
> > and there are still more surprises (e.g. version numbers might be
> > subject to conversion to float).
>
> I'll add a meta-schema check for this. 'const' is already limited to
> string or integer. That's missing from 'enum'. I think we can also check
> that all items are the same type as well.
And of course, like every meta-schema addition, we find new errors in
schemas:
/home/rob/proj/linux-dt/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.yaml: allOf:0:if:properties:compatible:contains:enum: 'oneOf' conditional failed, one must be fixed:
{'const': 'brcm,bcm4908-usb-phy'} is not of type 'integer'
{'const': 'brcm,bcm4908-usb-phy'} is not of type 'string'
{'const': 'brcm,brcmstb-usb-phy'} is not of type 'integer'
{'const': 'brcm,brcmstb-usb-phy'} is not of type 'string'
hint: "enum" must be an array with the same type for all items
from schema $id: http://devicetree.org/meta-schemas/core.yaml#
/home/rob/proj/linux-dt/Documentation/devicetree/bindings/sound/microchip,sama7g5-pdmc.yaml: properties:microchip,mic-pos:items: 'oneOf' conditional failed, one must be fixed:
{'items': [{'description': 'value for DS line'}, {'description': 'value for sampling edge'}], 'anyOf': [{'enum': [[0, 0], [0, 1], [1, 0], [1, 1]]}]} is not of type 'array'
/home/rob/proj/linux-dt/Documentation/devicetree/bindings/sound/microchip,sama7g5-pdmc.yaml: properties:microchip,mic-pos:items:anyOf:0:enum: 'oneOf' conditional failed, one must be fixed:
[0, 0] is not of type 'integer'
[0, 0] is not of type 'string'
[0, 1] is not of type 'integer'
[0, 1] is not of type 'string'
[1, 0] is not of type 'integer'
[1, 0] is not of type 'string'
[1, 1] is not of type 'integer'
[1, 1] is not of type 'string'
hint: "enum" must be an array with the same type for all items
from schema $id: http://devicetree.org/meta-schemas/core.yaml#
from schema $id: http://devicetree.org/meta-schemas/core.yaml#
/home/rob/proj/linux-dt/Documentation/devicetree/bindings/net/altr,tse.yaml: allOf:1:if:properties:compatible:contains:enum: 'oneOf' conditional failed, one must be fixed:
{'const': 'altr,tse-1.0'} is not of type 'integer'
{'const': 'altr,tse-1.0'} is not of type 'string'
{'const': 'ALTR,tse-1.0'} is not of type 'integer'
{'const': 'ALTR,tse-1.0'} is not of type 'string'
hint: "enum" must be an array with the same type for all items
from schema $id: http://devicetree.org/meta-schemas/core.yaml#