[PATCH net-next 1/8] dt-bindings: net: Add missing (unevaluated|additional)Properties on child node schemas

Rob Herring posted 8 patches 1 year ago
[PATCH net-next 1/8] dt-bindings: net: Add missing (unevaluated|additional)Properties on child node schemas
Posted by Rob Herring 1 year ago
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>
---
 .../devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml     |  2 ++
 Documentation/devicetree/bindings/net/dsa/brcm,sf2.yaml        |  1 +
 Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml |  2 ++
 .../devicetree/bindings/net/dsa/microchip,lan937x.yaml         |  1 +
 Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml     |  2 ++
 Documentation/devicetree/bindings/net/dsa/qca8k.yaml           |  1 +
 Documentation/devicetree/bindings/net/dsa/realtek.yaml         |  2 ++
 .../devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml        | 10 ++--------
 Documentation/devicetree/bindings/net/engleder,tsnep.yaml      |  1 +
 Documentation/devicetree/bindings/net/nxp,tja11xx.yaml         |  1 +
 10 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml b/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml
index 4bfac9186886..7fe0352dff0f 100644
--- a/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml
+++ b/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml
@@ -158,6 +158,8 @@ allOf:
               patternProperties:
                 "^ethernet-phy@[0-9a-f]$":
                   type: object
+                  $ref: ethernet-phy.yaml#
+                  unevaluatedProperties: false
                   description:
                     Integrated PHY node
 
diff --git a/Documentation/devicetree/bindings/net/dsa/brcm,sf2.yaml b/Documentation/devicetree/bindings/net/dsa/brcm,sf2.yaml
index b06c416893ff..f21bdd0f408d 100644
--- a/Documentation/devicetree/bindings/net/dsa/brcm,sf2.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/brcm,sf2.yaml
@@ -78,6 +78,7 @@ properties:
 
   ports:
     type: object
+    additionalProperties: true
 
     patternProperties:
       '^port@[0-9a-f]$':
diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
index e532c6b795f4..20f7ba4e2203 100644
--- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
@@ -154,10 +154,12 @@ properties:
 patternProperties:
   "^(ethernet-)?ports$":
     type: object
+    additionalProperties: true
 
     patternProperties:
       "^(ethernet-)?port@[0-9]+$":
         type: object
+        additionalProperties: true
 
         properties:
           reg:
diff --git a/Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml b/Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml
index 8d7e878b84dc..6a4d90d550b6 100644
--- a/Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml
@@ -37,6 +37,7 @@ properties:
 
 patternProperties:
   "^(ethernet-)?ports$":
+    additionalProperties: true
     patternProperties:
       "^(ethernet-)?port@[0-9]+$":
         allOf:
diff --git a/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml b/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml
index 4d5f5cc6d031..d179c6971193 100644
--- a/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml
@@ -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:
diff --git a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
index df64eebebe18..167398ab253a 100644
--- a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
@@ -73,6 +73,7 @@ $ref: dsa.yaml#
 patternProperties:
   "^(ethernet-)?ports$":
     type: object
+    additionalProperties: true
     patternProperties:
       "^(ethernet-)?port@[0-6]$":
         type: object
diff --git a/Documentation/devicetree/bindings/net/dsa/realtek.yaml b/Documentation/devicetree/bindings/net/dsa/realtek.yaml
index cfd69c2604ea..cce692f57b08 100644
--- a/Documentation/devicetree/bindings/net/dsa/realtek.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/realtek.yaml
@@ -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
diff --git a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
index 833d2f68daa1..ea285ef3e64f 100644
--- a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
@@ -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
diff --git a/Documentation/devicetree/bindings/net/engleder,tsnep.yaml b/Documentation/devicetree/bindings/net/engleder,tsnep.yaml
index 82a5d7927ca4..34fd24ff6a71 100644
--- a/Documentation/devicetree/bindings/net/engleder,tsnep.yaml
+++ b/Documentation/devicetree/bindings/net/engleder,tsnep.yaml
@@ -63,6 +63,7 @@ properties:
   mdio:
     type: object
     $ref: mdio.yaml#
+    unevaluatedProperties: false
     description: optional node for embedded MDIO controller
 
 required:
diff --git a/Documentation/devicetree/bindings/net/nxp,tja11xx.yaml b/Documentation/devicetree/bindings/net/nxp,tja11xx.yaml
index ab8867e6939b..85bfa45f5122 100644
--- a/Documentation/devicetree/bindings/net/nxp,tja11xx.yaml
+++ b/Documentation/devicetree/bindings/net/nxp,tja11xx.yaml
@@ -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.

-- 
2.42.0
Re: [PATCH net-next 1/8] dt-bindings: net: Add missing (unevaluated|additional)Properties on child node schemas
Posted by Vladimir Oltean 1 year ago
Hi Rob,

On Mon, Oct 16, 2023 at 04:44:20PM -0500, Rob Herring wrote:
> 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>
> ---
> diff --git a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
> index 833d2f68daa1..ea285ef3e64f 100644
> --- a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
> @@ -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

For my edification, this patch removes #address-cells and #size-cells
at the same time, because "additionalProperties: true" (which was also
implied before) doesn't care if they aren't defined in this sub-schema,
and they are defined through $ref: dsa.yaml#/$defs/ethernet-ports,
right?
Re: [PATCH net-next 1/8] dt-bindings: net: Add missing (unevaluated|additional)Properties on child node schemas
Posted by Rob Herring 1 year ago
On Thu, Oct 19, 2023 at 8:18 AM Vladimir Oltean <olteanv@gmail.com> wrote:
>
> Hi Rob,
>
> On Mon, Oct 16, 2023 at 04:44:20PM -0500, Rob Herring wrote:
> > 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>
> > ---
> > diff --git a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
> > index 833d2f68daa1..ea285ef3e64f 100644
> > --- a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
> > +++ b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
> > @@ -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
>
> For my edification, this patch removes #address-cells and #size-cells
> at the same time, because "additionalProperties: true" (which was also
> implied before) doesn't care if they aren't defined in this sub-schema,
> and they are defined through $ref: dsa.yaml#/$defs/ethernet-ports,
> right?

Yes, they are ultimately checked via ethernet-switch.yaml which
dsa.yaml references.

Rob
Re: [PATCH net-next 1/8] dt-bindings: net: Add missing (unevaluated|additional)Properties on child node schemas
Posted by Gerhard Engleder 1 year ago
On 16.10.23 23:44, Rob Herring wrote:
> 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>
> ---
>   .../devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml     |  2 ++
>   Documentation/devicetree/bindings/net/dsa/brcm,sf2.yaml        |  1 +
>   Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml |  2 ++
>   .../devicetree/bindings/net/dsa/microchip,lan937x.yaml         |  1 +
>   Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml     |  2 ++
>   Documentation/devicetree/bindings/net/dsa/qca8k.yaml           |  1 +
>   Documentation/devicetree/bindings/net/dsa/realtek.yaml         |  2 ++
>   .../devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml        | 10 ++--------
>   Documentation/devicetree/bindings/net/engleder,tsnep.yaml      |  1 +

Looks good for tsnep.

Reviewed-by: Gerhard Engleder <gerhard@engleder-embedded.com>

Thank you!

>   Documentation/devicetree/bindings/net/nxp,tja11xx.yaml         |  1 +
>   10 files changed, 15 insertions(+), 8 deletions(-)
Re: [PATCH net-next 1/8] dt-bindings: net: Add missing (unevaluated|additional)Properties on child node schemas
Posted by Jernej Škrabec 1 year ago
Dne ponedeljek, 16. oktober 2023 ob 23:44:20 CEST je Rob Herring napisal(a):
> 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>
> ---
>  .../devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml     |  2 ++

For Allwinner:
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>

Best regards,
Jernej

>  Documentation/devicetree/bindings/net/dsa/brcm,sf2.yaml        |  1 +
>  Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml |  2 ++
>  .../devicetree/bindings/net/dsa/microchip,lan937x.yaml         |  1 +
>  Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml     |  2 ++
>  Documentation/devicetree/bindings/net/dsa/qca8k.yaml           |  1 +
>  Documentation/devicetree/bindings/net/dsa/realtek.yaml         |  2 ++
>  .../devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml        | 10 ++--------
>  Documentation/devicetree/bindings/net/engleder,tsnep.yaml      |  1 +
>  Documentation/devicetree/bindings/net/nxp,tja11xx.yaml         |  1 +
>  10 files changed, 15 insertions(+), 8 deletions(-)
Re: [PATCH net-next 1/8] dt-bindings: net: Add missing (unevaluated|additional)Properties on child node schemas
Posted by Arınç ÜNAL 1 year ago
On 17.10.2023 00:44, Rob Herring wrote:
> 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>

Arınç