linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dt-bindings: uniphier-thermal: add minItems to socionext,tmod-calibration
@ 2020-07-07 10:23 Masahiro Yamada
  2020-07-16 23:04 ` Rob Herring
  0 siblings, 1 reply; 4+ messages in thread
From: Masahiro Yamada @ 2020-07-07 10:23 UTC (permalink / raw)
  To: Rob Herring, Frank Rowand, devicetree
  Cc: Masahiro Yamada, Amit Kucheria, Daniel Lezcano, Kunihiko Hayashi,
	Zhang Rui, linux-arm-kernel, linux-kernel, linux-pm

As the description says, this property contains a pair of calibration
values. The number of items must be exactly 2.

Add minItems to check a too short property.

While I was here, I also added this property to the example because
this is the case in the real DT file,
arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi

Also, fix the interrupt type (edge -> level) to align with the
real DT.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 .../bindings/thermal/socionext,uniphier-thermal.yaml          | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/thermal/socionext,uniphier-thermal.yaml b/Documentation/devicetree/bindings/thermal/socionext,uniphier-thermal.yaml
index 553c9dcdaeeb..57ffd0c4c474 100644
--- a/Documentation/devicetree/bindings/thermal/socionext,uniphier-thermal.yaml
+++ b/Documentation/devicetree/bindings/thermal/socionext,uniphier-thermal.yaml
@@ -29,6 +29,7 @@ properties:
 
   socionext,tmod-calibration:
     $ref: /schemas/types.yaml#/definitions/uint32-array
+    minItems: 2
     maxItems: 2
     description:
       A pair of calibrated values referred from PVT, in case that the values
@@ -52,7 +53,8 @@ examples:
 
         pvtctl: thermal {
             compatible = "socionext,uniphier-ld20-thermal";
-            interrupts = <0 3 1>;
+            interrupts = <0 3 4>;
             #thermal-sensor-cells = <0>;
+            socionext,tmod-calibration = <0x0f22 0x68ee>;
         };
     };
-- 
2.25.1


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

* Re: [PATCH] dt-bindings: uniphier-thermal: add minItems to socionext,tmod-calibration
  2020-07-07 10:23 [PATCH] dt-bindings: uniphier-thermal: add minItems to socionext,tmod-calibration Masahiro Yamada
@ 2020-07-16 23:04 ` Rob Herring
  2020-07-17  4:53   ` Masahiro Yamada
  0 siblings, 1 reply; 4+ messages in thread
From: Rob Herring @ 2020-07-16 23:04 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Frank Rowand, devicetree, Amit Kucheria, Daniel Lezcano,
	Kunihiko Hayashi, Zhang Rui, linux-arm-kernel, linux-kernel,
	linux-pm

On Tue, Jul 07, 2020 at 07:23:38PM +0900, Masahiro Yamada wrote:
> As the description says, this property contains a pair of calibration
> values. The number of items must be exactly 2.
> 
> Add minItems to check a too short property.
> 
> While I was here, I also added this property to the example because
> this is the case in the real DT file,
> arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi
> 
> Also, fix the interrupt type (edge -> level) to align with the
> real DT.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
> 
>  .../bindings/thermal/socionext,uniphier-thermal.yaml          | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/thermal/socionext,uniphier-thermal.yaml b/Documentation/devicetree/bindings/thermal/socionext,uniphier-thermal.yaml
> index 553c9dcdaeeb..57ffd0c4c474 100644
> --- a/Documentation/devicetree/bindings/thermal/socionext,uniphier-thermal.yaml
> +++ b/Documentation/devicetree/bindings/thermal/socionext,uniphier-thermal.yaml
> @@ -29,6 +29,7 @@ properties:
>  
>    socionext,tmod-calibration:
>      $ref: /schemas/types.yaml#/definitions/uint32-array
> +    minItems: 2

The intent was if minItems is not defined, then the default is the same 
as maxItems. This is not the default for json-schema, so the tooling is 
supposed to add it. But looking at processed-schema.yaml, it doesn't 
seem to be happening for one case here. I'm working on a fix in the 
tools.

Rob

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

* Re: [PATCH] dt-bindings: uniphier-thermal: add minItems to socionext,tmod-calibration
  2020-07-16 23:04 ` Rob Herring
@ 2020-07-17  4:53   ` Masahiro Yamada
  2020-07-17 18:36     ` Rob Herring
  0 siblings, 1 reply; 4+ messages in thread
From: Masahiro Yamada @ 2020-07-17  4:53 UTC (permalink / raw)
  To: Rob Herring
  Cc: Frank Rowand, DTML, Amit Kucheria, Daniel Lezcano,
	Kunihiko Hayashi, Zhang Rui, linux-arm-kernel,
	Linux Kernel Mailing List, Linux PM mailing list

On Fri, Jul 17, 2020 at 8:09 AM Rob Herring <robh@kernel.org> wrote:
>
> On Tue, Jul 07, 2020 at 07:23:38PM +0900, Masahiro Yamada wrote:
> > As the description says, this property contains a pair of calibration
> > values. The number of items must be exactly 2.
> >
> > Add minItems to check a too short property.
> >
> > While I was here, I also added this property to the example because
> > this is the case in the real DT file,
> > arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi
> >
> > Also, fix the interrupt type (edge -> level) to align with the
> > real DT.
> >
> > Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> > ---
> >
> >  .../bindings/thermal/socionext,uniphier-thermal.yaml          | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/Documentation/devicetree/bindings/thermal/socionext,uniphier-thermal.yaml b/Documentation/devicetree/bindings/thermal/socionext,uniphier-thermal.yaml
> > index 553c9dcdaeeb..57ffd0c4c474 100644
> > --- a/Documentation/devicetree/bindings/thermal/socionext,uniphier-thermal.yaml
> > +++ b/Documentation/devicetree/bindings/thermal/socionext,uniphier-thermal.yaml
> > @@ -29,6 +29,7 @@ properties:
> >
> >    socionext,tmod-calibration:
> >      $ref: /schemas/types.yaml#/definitions/uint32-array
> > +    minItems: 2
>
> The intent was if minItems is not defined, then the default is the same
> as maxItems. This is not the default for json-schema, so the tooling is
> supposed to add it.


This implication is unclear.

maxItems should literally only define the max, and
we should stick to json-schema as much as possible, IMHO.




It would be nice if json-schema had something like:

numItems: 2

as a shorthand for

minItems: 2
maxItems: 2


Masahiro Yamada




> But looking at processed-schema.yaml, it doesn't
> seem to be happening for one case here. I'm working on a fix in the
> tools.
>
> Rob



--
Best Regards
Masahiro Yamada

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

* Re: [PATCH] dt-bindings: uniphier-thermal: add minItems to socionext,tmod-calibration
  2020-07-17  4:53   ` Masahiro Yamada
@ 2020-07-17 18:36     ` Rob Herring
  0 siblings, 0 replies; 4+ messages in thread
From: Rob Herring @ 2020-07-17 18:36 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Frank Rowand, DTML, Amit Kucheria, Daniel Lezcano,
	Kunihiko Hayashi, Zhang Rui, linux-arm-kernel,
	Linux Kernel Mailing List, Linux PM mailing list

On Thu, Jul 16, 2020 at 10:54 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Fri, Jul 17, 2020 at 8:09 AM Rob Herring <robh@kernel.org> wrote:
> >
> > On Tue, Jul 07, 2020 at 07:23:38PM +0900, Masahiro Yamada wrote:
> > > As the description says, this property contains a pair of calibration
> > > values. The number of items must be exactly 2.
> > >
> > > Add minItems to check a too short property.
> > >
> > > While I was here, I also added this property to the example because
> > > this is the case in the real DT file,
> > > arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi
> > >
> > > Also, fix the interrupt type (edge -> level) to align with the
> > > real DT.
> > >
> > > Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> > > ---
> > >
> > >  .../bindings/thermal/socionext,uniphier-thermal.yaml          | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/Documentation/devicetree/bindings/thermal/socionext,uniphier-thermal.yaml b/Documentation/devicetree/bindings/thermal/socionext,uniphier-thermal.yaml
> > > index 553c9dcdaeeb..57ffd0c4c474 100644
> > > --- a/Documentation/devicetree/bindings/thermal/socionext,uniphier-thermal.yaml
> > > +++ b/Documentation/devicetree/bindings/thermal/socionext,uniphier-thermal.yaml
> > > @@ -29,6 +29,7 @@ properties:
> > >
> > >    socionext,tmod-calibration:
> > >      $ref: /schemas/types.yaml#/definitions/uint32-array
> > > +    minItems: 2
> >
> > The intent was if minItems is not defined, then the default is the same
> > as maxItems. This is not the default for json-schema, so the tooling is
> > supposed to add it.
>
>
> This implication is unclear.
>
> maxItems should literally only define the max, and
> we should stick to json-schema as much as possible, IMHO.

Yes, but we already deviate a bit as the default json-schema behavior
is a bit different than DT defaults. For example, with just:

items:
  - const: a
  - const: b
  - const: c

All of these pass validation:

[]
[ a ]
[ a, b, c, 1, 2, true ]

when we really only want [ a, b, c ] to pass (by default). So we add
minItems, maxItems, and additionalItems if not specified.

> It would be nice if json-schema had something like:
>
> numItems: 2
>
> as a shorthand for
>
> minItems: 2
> maxItems: 2

Yes, I've been thinking the same thing. It wouldn't be unprecedented
as they added 'const' to shorten 'enum: [ one_entry ]'. We can add our
own keywords too, but I try to avoid that so far. The only ones we
have are internal to dtschema (typeSize and phandle).

Rob

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

end of thread, other threads:[~2020-07-17 18:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-07 10:23 [PATCH] dt-bindings: uniphier-thermal: add minItems to socionext,tmod-calibration Masahiro Yamada
2020-07-16 23:04 ` Rob Herring
2020-07-17  4:53   ` Masahiro Yamada
2020-07-17 18:36     ` 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).