devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dt-bindings: pwm: drop unneeded quotes
@ 2023-06-09 14:07 Krzysztof Kozlowski
  2023-06-12  8:21 ` Claudiu.Beznea
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-09 14:07 UTC (permalink / raw)
  To: Claudiu Beznea, Thierry Reding, Uwe Kleine-König,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Nicolas Ferre,
	Alexandre Belloni, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Anson Huang, linux-arm-kernel, linux-pwm, devicetree,
	linux-kernel
  Cc: Krzysztof Kozlowski

Cleanup bindings dropping unneeded quotes. Once all these are fixed,
checking for this can be enabled in yamllint.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 Documentation/devicetree/bindings/pwm/atmel,at91sam-pwm.yaml | 2 +-
 Documentation/devicetree/bindings/pwm/mxs-pwm.yaml           | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/pwm/atmel,at91sam-pwm.yaml b/Documentation/devicetree/bindings/pwm/atmel,at91sam-pwm.yaml
index ab45df80345d..d84268b59784 100644
--- a/Documentation/devicetree/bindings/pwm/atmel,at91sam-pwm.yaml
+++ b/Documentation/devicetree/bindings/pwm/atmel,at91sam-pwm.yaml
@@ -11,7 +11,7 @@ maintainers:
   - Claudiu Beznea <claudiu.beznea@microchip.com>
 
 allOf:
-  - $ref: "pwm.yaml#"
+  - $ref: pwm.yaml#
 
 properties:
   compatible:
diff --git a/Documentation/devicetree/bindings/pwm/mxs-pwm.yaml b/Documentation/devicetree/bindings/pwm/mxs-pwm.yaml
index a34cbc13f691..6ffbed204c25 100644
--- a/Documentation/devicetree/bindings/pwm/mxs-pwm.yaml
+++ b/Documentation/devicetree/bindings/pwm/mxs-pwm.yaml
@@ -25,7 +25,7 @@ properties:
     const: 3
 
   fsl,pwm-number:
-    $ref: '/schemas/types.yaml#/definitions/uint32'
+    $ref: /schemas/types.yaml#/definitions/uint32
     description: u32 value representing the number of PWM devices
 
 required:
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] dt-bindings: pwm: drop unneeded quotes
  2023-06-09 14:07 [PATCH] dt-bindings: pwm: drop unneeded quotes Krzysztof Kozlowski
@ 2023-06-12  8:21 ` Claudiu.Beznea
  2023-06-12  9:33 ` Uwe Kleine-König
  2023-06-23 20:25 ` Rob Herring
  2 siblings, 0 replies; 6+ messages in thread
From: Claudiu.Beznea @ 2023-06-12  8:21 UTC (permalink / raw)
  To: krzysztof.kozlowski, thierry.reding, u.kleine-koenig, robh+dt,
	krzysztof.kozlowski+dt, conor+dt, Nicolas.Ferre,
	alexandre.belloni, shawnguo, s.hauer, kernel, festevam, linux-imx,
	anson.huang, linux-arm-kernel, linux-pwm, devicetree,
	linux-kernel

On 09.06.2023 17:07, Krzysztof Kozlowski wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Cleanup bindings dropping unneeded quotes. Once all these are fixed,
> checking for this can be enabled in yamllint.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>

> ---
>  Documentation/devicetree/bindings/pwm/atmel,at91sam-pwm.yaml | 2 +-
>  Documentation/devicetree/bindings/pwm/mxs-pwm.yaml           | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/pwm/atmel,at91sam-pwm.yaml b/Documentation/devicetree/bindings/pwm/atmel,at91sam-pwm.yaml
> index ab45df80345d..d84268b59784 100644
> --- a/Documentation/devicetree/bindings/pwm/atmel,at91sam-pwm.yaml
> +++ b/Documentation/devicetree/bindings/pwm/atmel,at91sam-pwm.yaml
> @@ -11,7 +11,7 @@ maintainers:
>    - Claudiu Beznea <claudiu.beznea@microchip.com>
> 
>  allOf:
> -  - $ref: "pwm.yaml#"
> +  - $ref: pwm.yaml#
> 
>  properties:
>    compatible:
> diff --git a/Documentation/devicetree/bindings/pwm/mxs-pwm.yaml b/Documentation/devicetree/bindings/pwm/mxs-pwm.yaml
> index a34cbc13f691..6ffbed204c25 100644
> --- a/Documentation/devicetree/bindings/pwm/mxs-pwm.yaml
> +++ b/Documentation/devicetree/bindings/pwm/mxs-pwm.yaml
> @@ -25,7 +25,7 @@ properties:
>      const: 3
> 
>    fsl,pwm-number:
> -    $ref: '/schemas/types.yaml#/definitions/uint32'
> +    $ref: /schemas/types.yaml#/definitions/uint32
>      description: u32 value representing the number of PWM devices
> 
>  required:
> --
> 2.34.1
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] dt-bindings: pwm: drop unneeded quotes
  2023-06-09 14:07 [PATCH] dt-bindings: pwm: drop unneeded quotes Krzysztof Kozlowski
  2023-06-12  8:21 ` Claudiu.Beznea
@ 2023-06-12  9:33 ` Uwe Kleine-König
  2023-06-21 20:53   ` Rob Herring
  2023-06-23 20:25 ` Rob Herring
  2 siblings, 1 reply; 6+ messages in thread
From: Uwe Kleine-König @ 2023-06-12  9:33 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Claudiu Beznea, Thierry Reding, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Nicolas Ferre, Alexandre Belloni, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Anson Huang, linux-arm-kernel, linux-pwm,
	devicetree, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1444 bytes --]

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.

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). So at least in my bubble the general
hint is to *always* quote strings. Note that required: true is also the
default for yamllint's quoted-strings setting, proably for pitfalls like
these.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] dt-bindings: pwm: drop unneeded quotes
  2023-06-12  9:33 ` Uwe Kleine-König
@ 2023-06-21 20:53   ` Rob Herring
  2023-06-21 21:58     ` Rob Herring
  0 siblings, 1 reply; 6+ messages in thread
From: Rob Herring @ 2023-06-21 20:53 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Krzysztof Kozlowski, Claudiu Beznea, Thierry Reding,
	Krzysztof Kozlowski, Conor Dooley, Nicolas Ferre,
	Alexandre Belloni, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Anson Huang, linux-arm-kernel, linux-pwm, devicetree,
	linux-kernel

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.

> So at least in my bubble the general
> hint is to *always* quote strings. Note that required: true is also the
> default for yamllint's quoted-strings setting, proably for pitfalls like
> these.

We're so far gone the other direction from quoting everything, that's 
not going to happen. Plus, if I liked everything quoted, I would have 
used JSON.

My preference here is I don't want to care about this in reviews. I want 
yamllint to check it and not have to think about it again.

Rob

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] dt-bindings: pwm: drop unneeded quotes
  2023-06-21 20:53   ` Rob Herring
@ 2023-06-21 21:58     ` Rob Herring
  0 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2023-06-21 21:58 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Krzysztof Kozlowski, Claudiu Beznea, Thierry Reding,
	Krzysztof Kozlowski, Conor Dooley, Nicolas Ferre,
	Alexandre Belloni, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Anson Huang, linux-arm-kernel, linux-pwm, devicetree,
	linux-kernel

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#


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] dt-bindings: pwm: drop unneeded quotes
  2023-06-09 14:07 [PATCH] dt-bindings: pwm: drop unneeded quotes Krzysztof Kozlowski
  2023-06-12  8:21 ` Claudiu.Beznea
  2023-06-12  9:33 ` Uwe Kleine-König
@ 2023-06-23 20:25 ` Rob Herring
  2 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2023-06-23 20:25 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Thierry Reding, Shawn Guo, Pengutronix Kernel Team,
	Uwe Kleine-König, linux-arm-kernel, Claudiu Beznea,
	devicetree, linux-kernel, Krzysztof Kozlowski, Sascha Hauer,
	Nicolas Ferre, Anson Huang, Fabio Estevam, Conor Dooley,
	NXP Linux Team, Alexandre Belloni, linux-pwm, Rob Herring


On Fri, 09 Jun 2023 16:07:09 +0200, Krzysztof Kozlowski wrote:
> Cleanup bindings dropping unneeded quotes. Once all these are fixed,
> checking for this can be enabled in yamllint.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
>  Documentation/devicetree/bindings/pwm/atmel,at91sam-pwm.yaml | 2 +-
>  Documentation/devicetree/bindings/pwm/mxs-pwm.yaml           | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 

Applied, thanks!


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-06-23 20:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-09 14:07 [PATCH] dt-bindings: pwm: drop unneeded quotes Krzysztof Kozlowski
2023-06-12  8:21 ` Claudiu.Beznea
2023-06-12  9:33 ` Uwe Kleine-König
2023-06-21 20:53   ` Rob Herring
2023-06-21 21:58     ` Rob Herring
2023-06-23 20:25 ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).