dt-bindings: net: Add missing (unevaluated|additional)Properties on child node schemas
authorRob Herring <robh@kernel.org>
Mon, 16 Oct 2023 21:44:20 +0000 (16:44 -0500)
committerJakub Kicinski <kuba@kernel.org>
Thu, 19 Oct 2023 15:56:34 +0000 (08:56 -0700)
Just as unevaluatedProperties or additionalProperties are required at
the top level of schemas, they should (and will) also be required for
child node schemas. That ensures only documented properties are
present for any node.

Add unevaluatedProperties or additionalProperties as appropriate.

Signed-off-by: Rob Herring <robh@kernel.org>
Acked-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Reviewed-by: Gerhard Engleder <gerhard@engleder-embedded.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20231016-dt-net-cleanups-v1-1-a525a090b444@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml
Documentation/devicetree/bindings/net/dsa/brcm,sf2.yaml
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml
Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml
Documentation/devicetree/bindings/net/dsa/qca8k.yaml
Documentation/devicetree/bindings/net/dsa/realtek.yaml
Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
Documentation/devicetree/bindings/net/engleder,tsnep.yaml
Documentation/devicetree/bindings/net/nxp,tja11xx.yaml

index 4bfac91868863fb587e303ae32c08f83d6cbce72..7fe0352dff0f8d74a08f3f6aac5450ad685e6a08 100644 (file)
@@ -158,6 +158,8 @@ allOf:
               patternProperties:
                 "^ethernet-phy@[0-9a-f]$":
                   type: object
+                  $ref: ethernet-phy.yaml#
+                  unevaluatedProperties: false
                   description:
                     Integrated PHY node
 
index b06c416893ff6483b27a17a87a8203b65ee50576..f21bdd0f408d3324f879f5d703a2fa3e5254e780 100644 (file)
@@ -78,6 +78,7 @@ properties:
 
   ports:
     type: object
+    additionalProperties: true
 
     patternProperties:
       '^port@[0-9a-f]$':
index e532c6b795f4fc507979114006676675853d8b74..20f7ba4e220364cd6940dc086a2095312a66e84f 100644 (file)
@@ -154,10 +154,12 @@ properties:
 patternProperties:
   "^(ethernet-)?ports$":
     type: object
+    additionalProperties: true
 
     patternProperties:
       "^(ethernet-)?port@[0-9]+$":
         type: object
+        additionalProperties: true
 
         properties:
           reg:
index 8d7e878b84dcd81767529ad67c1cfd6955783b46..6a4d90d550b66e0b0c5b8d974149203b5924af70 100644 (file)
@@ -37,6 +37,7 @@ properties:
 
 patternProperties:
   "^(ethernet-)?ports$":
+    additionalProperties: true
     patternProperties:
       "^(ethernet-)?port@[0-9]+$":
         allOf:
index 4d5f5cc6d031e280d9c04831346acee6b574a638..d179c6971193a9e08a048846d10303015bc15745 100644 (file)
@@ -43,6 +43,7 @@ properties:
   # PHY 1.
   mdios:
     type: object
+    additionalProperties: false
 
     properties:
       '#address-cells':
@@ -74,6 +75,7 @@ properties:
 
 patternProperties:
   "^(ethernet-)?ports$":
+    additionalProperties: true
     patternProperties:
       "^(ethernet-)?port@[0-9]+$":
         allOf:
index df64eebebe185625877a12f3c570a93d4f8102db..167398ab253aaa1b4dc2311683afd7cfbb550d25 100644 (file)
@@ -73,6 +73,7 @@ $ref: dsa.yaml#
 patternProperties:
   "^(ethernet-)?ports$":
     type: object
+    additionalProperties: true
     patternProperties:
       "^(ethernet-)?port@[0-6]$":
         type: object
index cfd69c2604ea399c26f98e7d29896ff42311aef9..cce692f57b0800fcb9cb93c62f647a04b2301df9 100644 (file)
@@ -68,6 +68,8 @@ properties:
 
   interrupt-controller:
     type: object
+    additionalProperties: false
+
     description: |
       This defines an interrupt controller with an IRQ line (typically
       a GPIO) that will demultiplex and handle the interrupt from the single
index 833d2f68daa144b16453a38d31920ab29cfecc30..ea285ef3e64f9b8c8576906e486f62951c82d928 100644 (file)
@@ -61,17 +61,11 @@ properties:
 
   ethernet-ports:
     type: object
-    properties:
-      '#address-cells':
-        const: 1
-      '#size-cells':
-        const: 0
-
+    additionalProperties: true
     patternProperties:
       "^(ethernet-)?port@[0-4]$":
         type: object
-        description: Ethernet switch ports
-
+        additionalProperties: true
         properties:
           pcs-handle:
             maxItems: 1
index 82a5d7927ca479adbd00a4f5636e3afe569f1e6b..34fd24ff6a713bf6d4e1abc76d857d1921a5c3ca 100644 (file)
@@ -63,6 +63,7 @@ properties:
   mdio:
     type: object
     $ref: mdio.yaml#
+    unevaluatedProperties: false
     description: optional node for embedded MDIO controller
 
 required:
index ab8867e6939bf144e826f19d7829eb5ecf77b467..85bfa45f5122c57192ff7ba372d7cc6f075f4986 100644 (file)
@@ -20,6 +20,7 @@ allOf:
 patternProperties:
   "^ethernet-phy@[0-9a-f]+$":
     type: object
+    additionalProperties: false
     description: |
       Some packages have multiple PHYs. Secondary PHY should be defines as
       subnode of the first (parent) PHY.