[net-next,1/8] dt-bindings: net: Add missing (unevaluated|additional)Properties on child node schemas
Commit Message
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(-)
Comments
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ç
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(-)
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(-)
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?
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
@@ -158,6 +158,8 @@ allOf:
patternProperties:
"^ethernet-phy@[0-9a-f]$":
type: object
+ $ref: ethernet-phy.yaml#
+ unevaluatedProperties: false
description:
Integrated PHY node
@@ -78,6 +78,7 @@ properties:
ports:
type: object
+ additionalProperties: true
patternProperties:
'^port@[0-9a-f]$':
@@ -154,10 +154,12 @@ properties:
patternProperties:
"^(ethernet-)?ports$":
type: object
+ additionalProperties: true
patternProperties:
"^(ethernet-)?port@[0-9]+$":
type: object
+ additionalProperties: true
properties:
reg:
@@ -37,6 +37,7 @@ properties:
patternProperties:
"^(ethernet-)?ports$":
+ additionalProperties: true
patternProperties:
"^(ethernet-)?port@[0-9]+$":
allOf:
@@ -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:
@@ -73,6 +73,7 @@ $ref: dsa.yaml#
patternProperties:
"^(ethernet-)?ports$":
type: object
+ additionalProperties: true
patternProperties:
"^(ethernet-)?port@[0-6]$":
type: object
@@ -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
@@ -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
@@ -63,6 +63,7 @@ properties:
mdio:
type: object
$ref: mdio.yaml#
+ unevaluatedProperties: false
description: optional node for embedded MDIO controller
required:
@@ -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.