diff mbox series

[1/3] dt-bindings: arm: coresight: restrict single port subnodes

Message ID 20231206115332.22712-1-krzysztof.kozlowski@linaro.org
State Changes Requested
Headers show
Series [1/3] dt-bindings: arm: coresight: restrict single port subnodes | expand

Checks

Context Check Description
robh/checkpatch success
robh/patch-applied success
robh/dtbs-check warning build log
robh/dt-meta-schema success

Commit Message

Krzysztof Kozlowski Dec. 6, 2023, 11:53 a.m. UTC
"in-ports" and "out-ports" with single "port" subnode should use
"additionalProperties: false" to disallow any other properties mentioned
by graph schema which are not applicable for this case, e.g.
"address-cells".

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 .../devicetree/bindings/arm/arm,coresight-dummy-sink.yaml        | 1 +
 .../devicetree/bindings/arm/arm,coresight-dummy-source.yaml      | 1 +
 Documentation/devicetree/bindings/arm/qcom,coresight-tpda.yaml   | 1 +
 Documentation/devicetree/bindings/arm/qcom,coresight-tpdm.yaml   | 1 +
 4 files changed, 4 insertions(+)

Comments

Rob Herring (Arm) Dec. 8, 2023, 8:24 p.m. UTC | #1
On Wed, Dec 06, 2023 at 12:53:30PM +0100, Krzysztof Kozlowski wrote:
> "in-ports" and "out-ports" with single "port" subnode should use
> "additionalProperties: false" to disallow any other properties mentioned
> by graph schema which are not applicable for this case, e.g.
> "address-cells".

The graph schema should already check this case with this subschema:

    oneOf:
      - required:
          - port
      - required:
          - "#address-cells"
          - "#size-cells"

However, I now see this would allow port and #address-cells if 
#size-cells is omitted. (#address-cells is a dependency for 
##size-cells, but not vice-versa because interrupt-controllers can have 
##just #address-cells). Perhaps this should instead be:

    oneOf:
      - required:
          - port
      - anyOf:
	  - required:
              - "#address-cells"
	  - required:
              - "#size-cells"

We're missing a similar check on endpoint. Or I'm forgetting why I 
didn't add it.

I suspect there are a lot more cases if we fixed these in the users.

Rob
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-dummy-sink.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-dummy-sink.yaml
index c960c8e0a9a5..61143907bcde 100644
--- a/Documentation/devicetree/bindings/arm/arm,coresight-dummy-sink.yaml
+++ b/Documentation/devicetree/bindings/arm/arm,coresight-dummy-sink.yaml
@@ -41,6 +41,7 @@  properties:
 
   in-ports:
     $ref: /schemas/graph.yaml#/properties/ports
+    additionalProperties: false
 
     properties:
       port:
diff --git a/Documentation/devicetree/bindings/arm/arm,coresight-dummy-source.yaml b/Documentation/devicetree/bindings/arm/arm,coresight-dummy-source.yaml
index 6745b4cc8f1c..a71a05c58cc6 100644
--- a/Documentation/devicetree/bindings/arm/arm,coresight-dummy-source.yaml
+++ b/Documentation/devicetree/bindings/arm/arm,coresight-dummy-source.yaml
@@ -40,6 +40,7 @@  properties:
 
   out-ports:
     $ref: /schemas/graph.yaml#/properties/ports
+    additionalProperties: false
 
     properties:
       port:
diff --git a/Documentation/devicetree/bindings/arm/qcom,coresight-tpda.yaml b/Documentation/devicetree/bindings/arm/qcom,coresight-tpda.yaml
index ea3c5db6b52d..e55f69c2ff38 100644
--- a/Documentation/devicetree/bindings/arm/qcom,coresight-tpda.yaml
+++ b/Documentation/devicetree/bindings/arm/qcom,coresight-tpda.yaml
@@ -76,6 +76,7 @@  properties:
     description: |
       Output connections from the TPDA to legacy CoreSight trace bus.
     $ref: /schemas/graph.yaml#/properties/ports
+    additionalProperties: false
 
     properties:
       port:
diff --git a/Documentation/devicetree/bindings/arm/qcom,coresight-tpdm.yaml b/Documentation/devicetree/bindings/arm/qcom,coresight-tpdm.yaml
index 61ddc3b5b247..6984003485e8 100644
--- a/Documentation/devicetree/bindings/arm/qcom,coresight-tpdm.yaml
+++ b/Documentation/devicetree/bindings/arm/qcom,coresight-tpdm.yaml
@@ -72,6 +72,7 @@  properties:
     description: |
       Output connections from the TPDM to coresight funnel/TPDA.
     $ref: /schemas/graph.yaml#/properties/ports
+    additionalProperties: false
 
     properties:
       port: