Re: [PATCH v3 net-next 03/10] dt-bindings: net: dsa: utilize base definitions for standard dsa switches

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 29, 2022 at 01:34:52AM -0800, Colin Foster wrote:
> Hi Rob,
> 
> On Mon, Nov 28, 2022 at 05:23:37PM -0600, Rob Herring wrote:
> > On Sun, Nov 27, 2022 at 02:47:27PM -0800, Colin Foster wrote:
> > > diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.yaml b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> > > index b9d48e357e77..bd1f0f7c14a8 100644
> > > --- a/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> > > +++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> > > @@ -19,9 +19,6 @@ description:
> > >  select: false
> > >  
> > >  properties:
> > > -  $nodename:
> > > -    pattern: "^(ethernet-)?switch(@.*)?$"
> > > -
> > >    dsa,member:
> > >      minItems: 2
> > >      maxItems: 2
> > > @@ -58,4 +55,20 @@ oneOf:
> > >  
> > >  additionalProperties: true
> > >  
> > > +$defs:
> > > +  base:
> > > +    description: A DSA switch without any extra port properties
> > > +    $ref: '#/'
> > > +
> > > +    patternProperties:
> > > +      "^(ethernet-)?ports$":
> > 
> > This node at the top level needs 'additionalProperties: false' assuming 
> > we don't allow extra properties in 'ports' nodes. If we do, then we'll 
> > need to be able to reference the 'ports' schema to extend it like is 
> > done with dsa-ports.yaml.
> 
> I'll double check if there's anything that adds any properties. If there
> is, would that be a separate file pair: "dsa-ports.yaml" and
> "ethernet-switch-ports.yaml"? Or do you think that could be contained in
> the existing dsa.yaml, ethernet-switch.yaml?

I came up with this change. It also fixes my accidental 's' affix to
^(ethernet-)port@[0-9]+.

diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.yaml b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
index 616753ba85a2..c1900363a6ab 100644
--- a/Documentation/devicetree/bindings/net/dsa/dsa.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
@@ -41,12 +41,18 @@ $defs:
     patternProperties:
       "^(ethernet-)?ports$":
         type: object
+        additionalProperties: false
+
+        properties:
+          '#address-cells':
+            const: 1
+          '#size-cells':
+            const: 0

         patternProperties:
-          "^(ethernet-)?ports@[0-9]+$":
+          "^(ethernet-)?port@[0-9]+$":
             description: Ethernet switch ports
             $ref: dsa-port.yaml#
             unevaluatedProperties: false

-
 ...




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux