Skip to contentSkip to conversation

dt-bindings: Fix array property constraints

PATCH Applied Rob Herring (Arm) 5 participants 7 messages Sep 25, 2024 – Oct 23, 2024

Subsystems (16)
lore
Share & tools
lore

Rob Herring (Arm)

author maintainer
#0 lore raw

PATCH 1/1 dt-bindings: Fix array property constraints

Schemas for array properties should only have 1 level of array constraints (e.g. items, maxItems, minItems). Sometimes the old encoding of all properties into a matrix leaked into the schema, and didn't matter for validation. Now the inner constraints are just silently ignored as json-schema array keywords are ignored on scalar values.

Generally, keep the inner constraints and drop the outer "items". With gicv3 "mbi-alias" property, it is more appropriately a uint32 or uint64 as it is an address and size depends on "#address-cells".

---
 Documentation/devicetree/bindings/cache/l2c2x0.yaml  |  5 ++---
 .../devicetree/bindings/dma/dma-common.yaml          |  7 +++----
 .../bindings/interrupt-controller/arm,gic-v3.yaml    | 12 +++++-------
 .../devicetree/bindings/media/i2c/thine,thp7312.yaml |  3 +--
 .../bindings/memory-controllers/exynos-srom.yaml     |  5 ++---
 .../devicetree/bindings/pci/brcm,stb-pcie.yaml       |  5 ++---
 .../devicetree/bindings/soc/qcom/qcom,smp2p.yaml     |  3 +--
 7 files changed, 16 insertions(+), 24 deletions(-)
Documentation/devicetree/bindings/cache/l2c2x0.yaml +2 -3
index d7840a5c4037..10c1a900202f 100644
@@ -100,9 +100,8 @@ properties:
       filter. Addresses in the filter window are directed to the M1 port. Other
       addresses will go to the M0 port.
     $ref: /schemas/types.yaml#/definitions/uint32-array
-    items:
-      minItems: 2
-      maxItems: 2
+    minItems: 2
+    maxItems: 2
 
   arm,io-coherent:
     description: indicates that the system is operating in an hardware
Documentation/devicetree/bindings/dma/dma-common.yaml +3 -4
index ea700f8ee6c6..fde5160b5d29 100644
@@ -32,10 +32,9 @@ properties:
       The first item in the array is for channels 0-31, the second is for
       channels 32-63, etc.
     $ref: /schemas/types.yaml#/definitions/uint32-array
-    items:
-      minItems: 1
-      # Should be enough
-      maxItems: 255
+    minItems: 1
+    # Should be enough
+    maxItems: 255
 
   dma-channels:
     $ref: /schemas/types.yaml#/definitions/uint32
Documentation/devicetree/bindings/interrupt-controller/arm,gic-v3.yaml +5 -7
index 5f051c666cbe..f3247a47f9ee 100644
@@ -132,10 +132,9 @@ properties:
       Address property. Base address of an alias of the GICD region containing
       only the {SET,CLR}SPI registers to be used if isolation is required,
       and if supported by the HW.
-    $ref: /schemas/types.yaml#/definitions/uint32-array
-    items:
-      minItems: 1
-      maxItems: 2
+    oneOf:
+      - $ref: /schemas/types.yaml#/definitions/uint32
+      - $ref: /schemas/types.yaml#/definitions/uint64
 
   ppi-partitions:
     type: object
@@ -223,9 +222,8 @@ patternProperties:
           (u32, u32) tuple describing the untranslated
           address and size of the pre-ITS window.
         $ref: /schemas/types.yaml#/definitions/uint32-array
-        items:
-          minItems: 2
-          maxItems: 2
+        minItems: 2
+        maxItems: 2
 
     required:
       - compatible
Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml +1 -2
index 535acf2b88a9..bc339a7374b2 100644
@@ -135,8 +135,7 @@ properties:
 
           data-lanes:
             $ref: /schemas/media/video-interfaces.yaml#/properties/data-lanes
-            items:
-              maxItems: 4
+            maxItems: 4
             description:
               This property is for lane reordering between the THP7312 and the imaging
               sensor that it is connected to.
Documentation/devicetree/bindings/memory-controllers/exynos-srom.yaml +2 -3
index 10a2d97e5f8b..a5598ade399f 100644
@@ -66,9 +66,8 @@ patternProperties:
 
       samsung,srom-timing:
         $ref: /schemas/types.yaml#/definitions/uint32-array
-        items:
-          minItems: 6
-          maxItems: 6
+        minItems: 6
+        maxItems: 6
         description: |
           Array of 6 integers, specifying bank timings in the following order:
           Tacp, Tcah, Tcoh, Tacc, Tcos, Tacs.
Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml +2 -3
index 0925c520195a..2ad1652c2584 100644
@@ -92,9 +92,8 @@ properties:
       may have two component regions -- base and extended -- so
       this information cannot be deduced from the dma-ranges.
     $ref: /schemas/types.yaml#/definitions/uint64-array
-    items:
-      minItems: 1
-      maxItems: 3
+    minItems: 1
+    maxItems: 3
 
   resets:
     minItems: 1
Documentation/devicetree/bindings/soc/qcom/qcom,smp2p.yaml +1 -2
index 141d666dc3f7..1ba1d419e83b 100644
@@ -55,8 +55,7 @@ properties:
 
   qcom,smem:
     $ref: /schemas/types.yaml#/definitions/uint32-array
-    items:
-      maxItems: 2
+    maxItems: 2
     description:
       Two identifiers of the inbound and outbound smem items used for this edge.
 
Signature · 1 line
2.45.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Rob Herring (Arm)

Schemas for array properties should only have 1 level of array constraints (e.g. items, maxItems, minItems). Sometimes the old encoding of all properties into a matrix leaked into the schema, and didn't matter for validation. Now the inner constraints are just silently ignored as json-schema array keywords are ignored on scalar values.

Quoted 6 lines

Generally, keep the inner constraints and drop the outer "items". With gicv3 "mbi-alias" property, it is more appropriately a uint32 or uint64 as it is an address and size depends on "#address-cells".

---

Best regards,
Krzysztof

maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Rob Herring (Arm)

Hi Rob,

Thank you for the patch.

Quoted 10 lines · Rob Herring (Arm)

Schemas for array properties should only have 1 level of array constraints (e.g. items, maxItems, minItems). Sometimes the old encoding of all properties into a matrix leaked into the schema, and didn't matter for validation. Now the inner constraints are just silently ignored as json-schema array keywords are ignored on scalar values.

Generally, keep the inner constraints and drop the outer "items". With gicv3 "mbi-alias" property, it is more appropriately a uint32 or uint64 as it is an address and size depends on "#address-cells".

I haven't followed what changed in the validation tools, but this is definitely less confusing. Thanks for improving the experience.

Quoted 135 lines
---
 Documentation/devicetree/bindings/cache/l2c2x0.yaml  |  5 ++---
 .../devicetree/bindings/dma/dma-common.yaml          |  7 +++----
 .../bindings/interrupt-controller/arm,gic-v3.yaml    | 12 +++++-------
 .../devicetree/bindings/media/i2c/thine,thp7312.yaml |  3 +--
 .../bindings/memory-controllers/exynos-srom.yaml     |  5 ++---
 .../devicetree/bindings/pci/brcm,stb-pcie.yaml       |  5 ++---
 .../devicetree/bindings/soc/qcom/qcom,smp2p.yaml     |  3 +--
 7 files changed, 16 insertions(+), 24 deletions(-)
Documentation/devicetree/bindings/cache/l2c2x0.yaml +2 -3
index d7840a5c4037..10c1a900202f 100644
@@ -100,9 +100,8 @@ properties:
       filter. Addresses in the filter window are directed to the M1 port. Other
       addresses will go to the M0 port.
     $ref: /schemas/types.yaml#/definitions/uint32-array
-    items:
-      minItems: 2
-      maxItems: 2
+    minItems: 2
+    maxItems: 2
 
   arm,io-coherent:
     description: indicates that the system is operating in an hardware
Documentation/devicetree/bindings/dma/dma-common.yaml +3 -4
index ea700f8ee6c6..fde5160b5d29 100644
@@ -32,10 +32,9 @@ properties:
       The first item in the array is for channels 0-31, the second is for
       channels 32-63, etc.
     $ref: /schemas/types.yaml#/definitions/uint32-array
-    items:
-      minItems: 1
-      # Should be enough
-      maxItems: 255
+    minItems: 1
+    # Should be enough
+    maxItems: 255
 
   dma-channels:
     $ref: /schemas/types.yaml#/definitions/uint32
Documentation/devicetree/bindings/interrupt-controller/arm,gic-v3.yaml +5 -7
index 5f051c666cbe..f3247a47f9ee 100644
@@ -132,10 +132,9 @@ properties:
       Address property. Base address of an alias of the GICD region containing
       only the {SET,CLR}SPI registers to be used if isolation is required,
       and if supported by the HW.
-    $ref: /schemas/types.yaml#/definitions/uint32-array
-    items:
-      minItems: 1
-      maxItems: 2
+    oneOf:
+      - $ref: /schemas/types.yaml#/definitions/uint32
+      - $ref: /schemas/types.yaml#/definitions/uint64
 
   ppi-partitions:
     type: object
@@ -223,9 +222,8 @@ patternProperties:
           (u32, u32) tuple describing the untranslated
           address and size of the pre-ITS window.
         $ref: /schemas/types.yaml#/definitions/uint32-array
-        items:
-          minItems: 2
-          maxItems: 2
+        minItems: 2
+        maxItems: 2
 
     required:
       - compatible
Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml +1 -2
index 535acf2b88a9..bc339a7374b2 100644
@@ -135,8 +135,7 @@ properties:
 
           data-lanes:
             $ref: /schemas/media/video-interfaces.yaml#/properties/data-lanes
-            items:
-              maxItems: 4
+            maxItems: 4
             description:
               This property is for lane reordering between the THP7312 and the imaging
               sensor that it is connected to.
Documentation/devicetree/bindings/memory-controllers/exynos-srom.yaml +2 -3
index 10a2d97e5f8b..a5598ade399f 100644
@@ -66,9 +66,8 @@ patternProperties:
 
       samsung,srom-timing:
         $ref: /schemas/types.yaml#/definitions/uint32-array
-        items:
-          minItems: 6
-          maxItems: 6
+        minItems: 6
+        maxItems: 6
         description: |
           Array of 6 integers, specifying bank timings in the following order:
           Tacp, Tcah, Tcoh, Tacc, Tcos, Tacs.
Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml +2 -3
index 0925c520195a..2ad1652c2584 100644
@@ -92,9 +92,8 @@ properties:
       may have two component regions -- base and extended -- so
       this information cannot be deduced from the dma-ranges.
     $ref: /schemas/types.yaml#/definitions/uint64-array
-    items:
-      minItems: 1
-      maxItems: 3
+    minItems: 1
+    maxItems: 3
 
   resets:
     minItems: 1
Documentation/devicetree/bindings/soc/qcom/qcom,smp2p.yaml +1 -2
index 141d666dc3f7..1ba1d419e83b 100644
@@ -55,8 +55,7 @@ properties:
 
   qcom,smem:
     $ref: /schemas/types.yaml#/definitions/uint32-array
-    items:
-      maxItems: 2
+    maxItems: 2
     description:
       Two identifiers of the inbound and outbound smem items used for this edge.
 
Signature · 3 lines
Regards,

Laurent Pinchart
maintainer Acked-by on v1 1/1
#3 lore raw
In reply to Rob Herring (Arm)
Quoted 7 lines · Rob Herring (Arm)

Schemas for array properties should only have 1 level of array constraints (e.g. items, maxItems, minItems). Sometimes the old encoding of all properties into a matrix leaked into the schema, and didn't matter for validation. Now the inner constraints are just silently ignored as json-schema array keywords are ignored on scalar values.

Quoted 5 lines

Generally, keep the inner constraints and drop the outer "items". With gicv3 "mbi-alias" property, it is more appropriately a uint32 or uint64 as it is an address and size depends on "#address-cells".

maintainer Applied
#4 lore raw
In reply to Rob Herring (Arm)
Quoted 8 lines · Rob Herring (Arm)

Schemas for array properties should only have 1 level of array constraints (e.g. items, maxItems, minItems). Sometimes the old encoding of all properties into a matrix leaked into the schema, and didn't matter for validation. Now the inner constraints are just silently ignored as json-schema array keywords are ignored on scalar values.

[...]

Applied, thanks!

[1/1] dt-bindings: Fix array property constraints

      commit: 72c65390c61fc96cebfb91c300ca774925565383

Best regards,

Signature · 1 line
~Vinod
author maintainer
#5 lore raw
Quoted 10 lines · Vinod Koul
Quoted 7 lines · Rob Herring (Arm)

Schemas for array properties should only have 1 level of array constraints (e.g. items, maxItems, minItems). Sometimes the old encoding of all properties into a matrix leaked into the schema, and didn't matter for validation. Now the inner constraints are just silently ignored as json-schema array keywords are ignored on scalar values.

Quoted 6 lines
Quoted 1 line

[...]

Applied, thanks!

[1/1] dt-bindings: Fix array property constraints

      commit: 72c65390c61fc96cebfb91c300ca774925565383

Why? It is already in my tree and not just dma bindings.

Rob

maintainer
#6 lore raw
Quoted 11 lines · Rob Herring
Quoted 10 lines · Vinod Koul
Quoted 7 lines · Rob Herring (Arm)

Schemas for array properties should only have 1 level of array constraints (e.g. items, maxItems, minItems). Sometimes the old encoding of all properties into a matrix leaked into the schema, and didn't matter for validation. Now the inner constraints are just silently ignored as json-schema array keywords are ignored on scalar values.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

[...]

Applied, thanks!

[1/1] dt-bindings: Fix array property constraints

      commit: 72c65390c61fc96cebfb91c300ca774925565383

Why? It is already in my tree and not just dma bindings.

Dropped now

Signature · 1 line
~Vinod