linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dt-bindings: iio: Fix adi,ltc2983 uint64-matrix schema constraints
@ 2020-03-27 22:45 Rob Herring
  2020-03-28  9:46 ` Sa, Nuno
  0 siblings, 1 reply; 3+ messages in thread
From: Rob Herring @ 2020-03-27 22:45 UTC (permalink / raw)
  To: devicetree
  Cc: linux-kernel, Nuno Sá,
	Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio

'minItems' and 'maxItems' apply at the same level as 'items' schemas as
the keywords apply to arrays. What's currently defined is a 3
dimensional matrix with the outer size being undefined. To fix this,
minItems/maxItems needs to be moved up a level.

With this fixed, the example fails validation. For matrix types, the dts
syntax must use brackets (<>) matching the schema definition. In this
case, the inner array size is 2 elements, so let's add the correct
bracketing.

Fixes: 3986a14870cb ("dt-bindings: iio: Add ltc2983 documentation")
Cc: "Nuno Sá" <nuno.sa@analog.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: linux-iio@vger.kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
---
I'll take this via the DT tree as I have another change this will 
conflict.

Rob

 .../bindings/iio/temperature/adi,ltc2983.yaml | 38 +++++++++----------
 1 file changed, 18 insertions(+), 20 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/temperature/adi,ltc2983.yaml b/Documentation/devicetree/bindings/iio/temperature/adi,ltc2983.yaml
index acc030c1b20e..8fb46de6641d 100644
--- a/Documentation/devicetree/bindings/iio/temperature/adi,ltc2983.yaml
+++ b/Documentation/devicetree/bindings/iio/temperature/adi,ltc2983.yaml
@@ -123,12 +123,11 @@ patternProperties:
           sign.
         allOf:
           - $ref: /schemas/types.yaml#/definitions/uint64-matrix
+        minItems: 3
+        maxItems: 64
         items:
-          minItems: 3
-          maxItems: 64
-          items:
-            minItems: 2
-            maxItems: 2
+          minItems: 2
+          maxItems: 2
 
   "^diode@":
     type: object
@@ -328,12 +327,11 @@ patternProperties:
           78 and 79.
         allOf:
           - $ref: /schemas/types.yaml#/definitions/uint64-matrix
+        minItems: 3
+        maxItems: 64
         items:
-          minItems: 3
-          maxItems: 64
-          items:
-            minItems: 2
-            maxItems: 2
+          minItems: 2
+          maxItems: 2
 
       adi,custom-steinhart:
         description:
@@ -465,16 +463,16 @@ examples:
                         adi,sensor-type = <9>; //custom thermocouple
                         adi,single-ended;
                         adi,custom-thermocouple = /bits/ 64
-                                 <(-50220000) 0
-                                  (-30200000) 99100000
-                                  (-5300000) 135400000
-                                  0 273150000
-                                  40200000 361200000
-                                  55300000 522100000
-                                  88300000 720300000
-                                  132200000 811200000
-                                  188700000 922500000
-                                  460400000 1000000000>; //10 pairs
+                                 <(-50220000) 0>,
+                                 <(-30200000) 99100000>,
+                                 <(-5300000) 135400000>,
+                                 <0 273150000>,
+                                 <40200000 361200000>,
+                                 <55300000 522100000>,
+                                 <88300000 720300000>,
+                                 <132200000 811200000>,
+                                 <188700000 922500000>,
+                                 <460400000 1000000000>; //10 pairs
                };
 
         };
-- 
2.20.1


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

* RE: [PATCH] dt-bindings: iio: Fix adi,ltc2983 uint64-matrix schema constraints
  2020-03-27 22:45 [PATCH] dt-bindings: iio: Fix adi,ltc2983 uint64-matrix schema constraints Rob Herring
@ 2020-03-28  9:46 ` Sa, Nuno
  2020-03-28 17:47   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Sa, Nuno @ 2020-03-28  9:46 UTC (permalink / raw)
  To: Rob Herring, devicetree
  Cc: linux-kernel, Jonathan Cameron, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler, linux-iio



> -----Original Message-----
> From: Rob Herring <robh@kernel.org>
> Sent: Freitag, 27. März 2020 23:45
> To: devicetree@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org; Sa, Nuno <Nuno.Sa@analog.com>;
> Jonathan Cameron <jic23@kernel.org>; Hartmut Knaack <knaack.h@gmx.de>;
> Lars-Peter Clausen <lars@metafoo.de>; Peter Meerwald-Stadler
> <pmeerw@pmeerw.net>; linux-iio@vger.kernel.org
> Subject: [PATCH] dt-bindings: iio: Fix adi,ltc2983 uint64-matrix schema
> constraints
>
> 
> 'minItems' and 'maxItems' apply at the same level as 'items' schemas as
> the keywords apply to arrays. What's currently defined is a 3
> dimensional matrix with the outer size being undefined. To fix this,
> minItems/maxItems needs to be moved up a level.
> 
> With this fixed, the example fails validation. For matrix types, the dts
> syntax must use brackets (<>) matching the schema definition. In this
> case, the inner array size is 2 elements, so let's add the correct
> bracketing.
> 
> Fixes: 3986a14870cb ("dt-bindings: iio: Add ltc2983 documentation")
> Cc: "Nuno Sá" <nuno.sa@analog.com>
> Cc: Jonathan Cameron <jic23@kernel.org>
> Cc: Hartmut Knaack <knaack.h@gmx.de>
> Cc: Lars-Peter Clausen <lars@metafoo.de>
> Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
> Cc: linux-iio@vger.kernel.org
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
> I'll take this via the DT tree as I have another change this will
> conflict.
> 
> Rob
> 
>  .../bindings/iio/temperature/adi,ltc2983.yaml | 38 +++++++++----------
>  1 file changed, 18 insertions(+), 20 deletions(-)
> 
> diff --git
> a/Documentation/devicetree/bindings/iio/temperature/adi,ltc2983.yaml
> b/Documentation/devicetree/bindings/iio/temperature/adi,ltc2983.yaml
> index acc030c1b20e..8fb46de6641d 100644
> --- a/Documentation/devicetree/bindings/iio/temperature/adi,ltc2983.yaml
> +++ b/Documentation/devicetree/bindings/iio/temperature/adi,ltc2983.yaml
> @@ -123,12 +123,11 @@ patternProperties:
>            sign.
>          allOf:
>            - $ref: /schemas/types.yaml#/definitions/uint64-matrix
> +        minItems: 3
> +        maxItems: 64
>          items:
> -          minItems: 3
> -          maxItems: 64
> -          items:
> -            minItems: 2
> -            maxItems: 2
> +          minItems: 2
> +          maxItems: 2
> 
>    "^diode@":
>      type: object
> @@ -328,12 +327,11 @@ patternProperties:
>            78 and 79.
>          allOf:
>            - $ref: /schemas/types.yaml#/definitions/uint64-matrix
> +        minItems: 3
> +        maxItems: 64
>          items:
> -          minItems: 3
> -          maxItems: 64
> -          items:
> -            minItems: 2
> -            maxItems: 2
> +          minItems: 2
> +          maxItems: 2
> 
>        adi,custom-steinhart:
>          description:
> @@ -465,16 +463,16 @@ examples:
>                          adi,sensor-type = <9>; //custom thermocouple
>                          adi,single-ended;
>                          adi,custom-thermocouple = /bits/ 64
> -                                 <(-50220000) 0
> -                                  (-30200000) 99100000
> -                                  (-5300000) 135400000
> -                                  0 273150000
> -                                  40200000 361200000
> -                                  55300000 522100000
> -                                  88300000 720300000
> -                                  132200000 811200000
> -                                  188700000 922500000
> -                                  460400000 1000000000>; //10 pairs
> +                                 <(-50220000) 0>,
> +                                 <(-30200000) 99100000>,
> +                                 <(-5300000) 135400000>,
> +                                 <0 273150000>,
> +                                 <40200000 361200000>,
> +                                 <55300000 522100000>,
> +                                 <88300000 720300000>,
> +                                 <132200000 811200000>,
> +                                 <188700000 922500000>,
> +                                 <460400000 1000000000>; //10 pairs
>                 };
> 
>          };
> --

Acked-by: Nuno Sá <nuno.sa@analog.com>

Thanks,
- Nuno Sá


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

* Re: [PATCH] dt-bindings: iio: Fix adi,ltc2983 uint64-matrix schema constraints
  2020-03-28  9:46 ` Sa, Nuno
@ 2020-03-28 17:47   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2020-03-28 17:47 UTC (permalink / raw)
  To: Sa, Nuno
  Cc: Rob Herring, devicetree, linux-kernel, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler, linux-iio

> >
> > 
> > 'minItems' and 'maxItems' apply at the same level as 'items' schemas as
> > the keywords apply to arrays. What's currently defined is a 3
> > dimensional matrix with the outer size being undefined. To fix this,
> > minItems/maxItems needs to be moved up a level.
> > 
> > With this fixed, the example fails validation. For matrix types, the dts
> > syntax must use brackets (<>) matching the schema definition. In this
> > case, the inner array size is 2 elements, so let's add the correct
> > bracketing.
> > 
> > Fixes: 3986a14870cb ("dt-bindings: iio: Add ltc2983 documentation")
> > Cc: "Nuno Sá" <nuno.sa@analog.com>
> > Cc: Jonathan Cameron <jic23@kernel.org>
> > Cc: Hartmut Knaack <knaack.h@gmx.de>
> > Cc: Lars-Peter Clausen <lars@metafoo.de>
> > Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
> > Cc: linux-iio@vger.kernel.org
> > Signed-off-by: Rob Herring <robh@kernel.org>
> > ---
> > I'll take this via the DT tree as I have another change this will
> > conflict.
> > 
> > Rob
 
> Acked-by: Nuno Sá <nuno.sa@analog.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

thanks,

Jonathan
> 
> Thanks,
> - Nuno Sá
> 


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

end of thread, other threads:[~2020-03-28 17:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-27 22:45 [PATCH] dt-bindings: iio: Fix adi,ltc2983 uint64-matrix schema constraints Rob Herring
2020-03-28  9:46 ` Sa, Nuno
2020-03-28 17:47   ` Jonathan Cameron

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).