Re: [PATCH v5 net-next 04/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 10.12.2022 21:02, Colin Foster wrote:
Hi Arınç,
On Sat, Dec 10, 2022 at 07:24:42PM +0300, Arınç ÜNAL wrote:
On 10.12.2022 06:30, Colin Foster wrote:
DSA a/Documentation/devicetree/bindings/net/dsa/dsa.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
@@ -58,4 +58,26 @@ oneOf:
   additionalProperties: true
+$defs:
+  ethernet-ports:
+    description: A DSA switch without any extra port properties
+    $ref: '#/'
+
+    patternProperties:
+      "^(ethernet-)?ports$":
+        type: object
+        additionalProperties: false
+
+        properties:
+          '#address-cells':
+            const: 1
+          '#size-cells':
+            const: 0
+
+        patternProperties:
+          "^(ethernet-)?port@[0-9]+$":
+            description: Ethernet switch ports
+            $ref: dsa-port.yaml#
+            unevaluatedProperties: false

I've got moderate experience in json-schema but shouldn't you put 'type:
object' here like you did for "^(ethernet-)?ports$"?

I can't say for sure, but adding "type: object" here and removing it
from mediatek,mt7530.yaml still causes the same issue I mention below.

Rob's initial suggestion for this patch set (which was basically the
entire implementation... many thanks again Rob) can be found here:
https://lore.kernel.org/netdev/20221104200212.GA2315642-robh@xxxxxxxxxx/

 From what I can tell, the omission of "type: object" here was
intentional. At the very least, it doesn't seem to have any effect on
warnings.


+
   ...
diff --git a/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml b/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml
index 73b774eadd0b..748ef9983ce2 100644
--- a/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
   title: Hirschmann Hellcreek TSN Switch Device Tree Bindings
   allOf:
-  - $ref: dsa.yaml#
+  - $ref: dsa.yaml#/$defs/ethernet-ports
   maintainers:
     - Andrew Lunn <andrew@xxxxxxx>
diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
index f2e9ff3f580b..20312f5d1944 100644
--- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
@@ -157,9 +157,6 @@ patternProperties:
       patternProperties:
         "^(ethernet-)?port@[0-9]+$":
           type: object

This line was being removed on the previous version. Must be related to
above.

Without the 'object' type here, I get the following warning:

Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml: patternProperties:^(ethernet-)?ports$:patternProperties:^(ethernet-)?port@[0-9]+$: 'anyOf' conditional failed, one must be fixed:
         'type' is a required property
         '$ref' is a required property
         hint: node schemas must have a type or $ref
         from schema $id: http://devicetree.org/meta-schemas/core.yaml#
./Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml: Error in referenced schema matching $id: http://devicetree.org/schemas/net/dsa/mediatek,mt7530.yaml
   SCHEMA  Documentation/devicetree/bindings/processed-schema.json
/home/colin/src/work/linux_vsc/linux-imx/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml: ignoring, error in schema: patternProperties: ^(ethernet-)?ports$: patternProperties: ^(ethernet-)?port@[0-9]+$


I'm testing this now and I'm noticing something is going on with the
"ref: dsa-port.yaml"


Everything seems to work fine (in that I don't see any warnings) when I
have this diff:


diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
index 20312f5d1944..db0122020f98 100644
--- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yam
@@ -156,8 +156,7 @@ patternProperties:

      patternProperties:
        "^(ethernet-)?port@[0-9]+$":
-        type: object
-
+        $ref: dsa-port.yaml#
          properties:
            reg:
              description:
@@ -165,7 +164,6 @@ patternProperties:
                for user ports.

          allOf:
-          - $ref: dsa-port.yaml#
            - if:
                required: [ ethernet ]
              then:



This one has me [still] scratching my head...

Right there with you. In addition to this, having or deleting type object on/from "^(ethernet-)?ports$" and "^(ethernet-)?port@[0-9]+$" on dsa.yaml doesn't cause any warnings (checked with make dt_binding_check DT_SCHEMA_FILES=net/dsa) which makes me question why it's there in the first place.

Arınç



[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux