[PATCH net-next 1/8] dt-bindings: net: Add missing (unevaluated|additional)Properties on child node schemas
Rob Herring
robh at kernel.org
Thu Oct 19 11:05:04 PDT 2023
On Thu, Oct 19, 2023 at 8:18 AM Vladimir Oltean <olteanv at 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 at 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
More information about the Linux-mediatek
mailing list