Skip to contentSkip to conversation

dt-bindings: Fix incomplete if/then/else schemas

PATCH Applied Rob Herring 4 participants 5 messages Mar 30, 2022 – Mar 31, 2022

Subsystems (14)
lore
Share & tools
lore

Rob Herring

author maintainer
#0 lore raw

PATCH 1/1 dt-bindings: Fix incomplete if/then/else schemas

A recent review highlighted that the json-schema meta-schema allows any combination of if/then/else schema keywords even though if, then or else by themselves makes little sense. With an added meta-schema to only allow valid combinations, there's a handful of schemas found which need fixing in a variety of ways. Incorrect indentation is the most common issue.

Cc Lars-Peter Clausen <[email protected]>
Cc Michael Hennerich <[email protected]>
Cc Jonathan Cameron <[email protected]>
Cc Krzysztof Kozlowski <[email protected]>
Cc Olivier Moysan <[email protected]>
Cc Arnaud Pouliquen <[email protected]>
Cc Bjorn Andersson <[email protected]>
Cc Georgi Djakov <[email protected]>
Cc Ulf Hansson <[email protected]>
Cc Thierry Reding <[email protected]>
Cc Jonathan Hunter <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Paolo Abeni <[email protected]>
Cc Kishon Vijay Abraham I <[email protected]>
Cc Vinod Koul <[email protected]>
Cc Mark Brown <[email protected]>
Cc Fabrice Gasnier <[email protected]>
Cc Grygorii Strashko <[email protected]>
Cc Dmitry Osipenko <[email protected]>
---
 .../bindings/iio/adc/adi,ad7476.yaml          |  1 +
 .../bindings/iio/adc/st,stm32-dfsdm-adc.yaml  |  8 +-
 .../bindings/iio/dac/adi,ad5360.yaml          |  6 +-
 .../bindings/interconnect/qcom,rpm.yaml       | 84 +++++++++----------
 .../bindings/mmc/nvidia,tegra20-sdhci.yaml    |  2 +
 .../bindings/net/ti,davinci-mdio.yaml         |  1 +
 .../bindings/phy/nvidia,tegra20-usb-phy.yaml  | 20 ++---
 .../bindings/phy/qcom,usb-hs-phy.yaml         | 36 ++++----
 .../bindings/regulator/fixed-regulator.yaml   | 34 ++++----
 .../bindings/sound/st,stm32-sai.yaml          |  6 +-
 .../devicetree/bindings/sram/sram.yaml        | 16 ++--
 11 files changed, 108 insertions(+), 106 deletions(-)
Documentation/devicetree/bindings/iio/adc/adi,ad7476.yaml +1 -0
index cf711082ad7d..666414a9c0de 100644
@@ -98,6 +98,7 @@ allOf:
               - ti,adc121s
               - ti,ads7866
               - ti,ads7868
+    then:
       required:
         - vcc-supply
   # Devices with a vref
Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.yaml +4 -4
index 7c260f209687..912372706280 100644
@@ -174,7 +174,7 @@ patternProperties:
               contains:
                 const: st,stm32-dfsdm-adc
 
-      - then:
+        then:
           properties:
             st,adc-channels:
               minItems: 1
@@ -206,7 +206,7 @@ patternProperties:
               contains:
                 const: st,stm32-dfsdm-dmic
 
-      - then:
+        then:
           properties:
             st,adc-channels:
               maxItems: 1
@@ -254,7 +254,7 @@ allOf:
           contains:
             const: st,stm32h7-dfsdm
 
-  - then:
+    then:
       patternProperties:
         "^filter@[0-9]+$":
           properties:
@@ -269,7 +269,7 @@ allOf:
           contains:
             const: st,stm32mp1-dfsdm
 
-  - then:
+    then:
       patternProperties:
         "^filter@[0-9]+$":
           properties:
Documentation/devicetree/bindings/iio/dac/adi,ad5360.yaml +3 -3
index 0d8fb56f4b09..65f86f26947c 100644
@@ -59,9 +59,9 @@ allOf:
           contains:
             enum:
               - adi,ad5371
-      then:
-        required:
-          - vref2-supply
+    then:
+      required:
+        - vref2-supply
 
 examples:
   - |
Documentation/devicetree/bindings/interconnect/qcom,rpm.yaml +42 -42

90 lines not on this page · raw message

Documentation/devicetree/bindings/mmc/nvidia,tegra20-sdhci.yaml +2 -0
index ce64b3498378..f3f4d5b02744 100644
@@ -197,6 +197,8 @@ allOf:
               - nvidia,tegra30-sdhci
               - nvidia,tegra114-sdhci
               - nvidia,tegra124-sdhci
+    then:
+      properties:
         clocks:
           items:
             - description: module clock
Documentation/devicetree/bindings/net/ti,davinci-mdio.yaml +1 -0
index dbfca5ee9139..6f44f9516c36 100644
@@ -56,6 +56,7 @@ if:
     compatible:
       contains:
         const: ti,davinci_mdio
+then:
   required:
     - bus_freq
 
Documentation/devicetree/bindings/phy/nvidia,tegra20-usb-phy.yaml +10 -10
index dfde0eaf66e1..d61585c96e31 100644
@@ -275,17 +275,17 @@ allOf:
           - nvidia,hssquelch-level
           - nvidia,hsdiscon-level
 
-        else:
-          properties:
-            clocks:
-              maxItems: 4
+      else:
+        properties:
+          clocks:
+            maxItems: 4
 
-            clock-names:
-              items:
-                - const: reg
-                - const: pll_u
-                - const: timer
-                - const: utmi-pads
+          clock-names:
+            items:
+              - const: reg
+              - const: pll_u
+              - const: timer
+              - const: utmi-pads
 
   - if:
       properties:
Documentation/devicetree/bindings/phy/qcom,usb-hs-phy.yaml +18 -18
index e23e5590eaa3..49f4aff93d62 100644
@@ -14,24 +14,24 @@ if:
     compatible:
       contains:
         const: qcom,usb-hs-phy-apq8064
-  then:
-    properties:
-      resets:
-        maxItems: 1
-
-      reset-names:
-        const: por
-
-  else:
-    properties:
-      resets:
-        minItems: 2
-        maxItems: 2
-
-      reset-names:
-        items:
-          - const: phy
-          - const: por
+then:
+  properties:
+    resets:
+      maxItems: 1
+
+    reset-names:
+      const: por
+
+else:
+  properties:
+    resets:
+      minItems: 2
+      maxItems: 2
+
+    reset-names:
+      items:
+        - const: phy
+        - const: por
 
 properties:
   compatible:
Documentation/devicetree/bindings/regulator/fixed-regulator.yaml +17 -17
index 9b131c6facbc..84eeaef179a5 100644
@@ -18,23 +18,23 @@ description:
 
 allOf:
   - $ref: "regulator.yaml#"
-
-if:
-  properties:
-    compatible:
-      contains:
-        const: regulator-fixed-clock
-  required:
-    - clocks
-else:
-  if:
-    properties:
-      compatible:
-        contains:
-          const: regulator-fixed-domain
-    required:
-      - power-domains
-      - required-opps
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: regulator-fixed-clock
+    then:
+      required:
+        - clocks
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: regulator-fixed-domain
+    then:
+      required:
+        - power-domains
+        - required-opps
 
 properties:
   compatible:
Documentation/devicetree/bindings/sound/st,stm32-sai.yaml +2 -4
index b3dbcba33e41..fe2e15504ebc 100644
@@ -136,8 +136,7 @@ allOf:
         compatible:
           contains:
             const: st,stm32f4-sai
-
-  - then:
+    then:
       properties:
         clocks:
           items:
@@ -148,8 +147,7 @@ allOf:
           items:
             - const: x8k
             - const: x11k
-
-  - else:
+    else:
       properties:
         clocks:
           items:
Documentation/devicetree/bindings/sram/sram.yaml +8 -8
index 668a9a41a775..993430be355b 100644
@@ -136,14 +136,14 @@ required:
   - reg
 
 if:
-  properties:
-    compatible:
-      contains:
-        enum:
-          - qcom,rpm-msg-ram
-          - rockchip,rk3288-pmu-sram
-
-else:
+  not:
+    properties:
+      compatible:
+        contains:
+          enum:
+            - qcom,rpm-msg-ram
+            - rockchip,rk3288-pmu-sram
+then:
   required:
     - "#address-cells"
     - "#size-cells"
Signature · 1 line
2.32.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Rob Herring

A recent review highlighted that the json-schema meta-schema allows any combination of if/then/else schema keywords even though if, then or else by themselves makes little sense. With an added meta-schema to only allow valid combinations, there's a handful of schemas found which need fixing in a variety of ways. Incorrect indentation is the most common issue.

maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Rob Herring
Quoted 7 lines · On Wed, 30 Mar 2022 09:57:41 -0500 Rob Herring wrote:

A recent review highlighted that the json-schema meta-schema allows any combination of if/then/else schema keywords even though if, then or else by themselves makes little sense. With an added meta-schema to only allow valid combinations, there's a handful of schemas found which need fixing in a variety of ways. Incorrect indentation is the most common issue.

Quoted 13 lines
Cc Lars-Peter Clausen <[email protected]>
Cc Michael Hennerich <[email protected]>
Cc Jonathan Cameron <[email protected]>
Cc Krzysztof Kozlowski <[email protected]>
Cc Olivier Moysan <[email protected]>
Cc Arnaud Pouliquen <[email protected]>
Cc Bjorn Andersson <[email protected]>
Cc Georgi Djakov <[email protected]>
Cc Ulf Hansson <[email protected]>
Cc Thierry Reding <[email protected]>
Cc Jonathan Hunter <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Jakub Kicinski <[email protected]>
Reviewed-by on v1 1/1
#3 lore raw
In reply to Rob Herring
Quoted 34 lines · Rob Herring

A recent review highlighted that the json-schema meta-schema allows any combination of if/then/else schema keywords even though if, then or else by themselves makes little sense. With an added meta-schema to only allow valid combinations, there's a handful of schemas found which need fixing in a variety of ways. Incorrect indentation is the most common issue.

Cc Lars-Peter Clausen <[email protected]>
Cc Michael Hennerich <[email protected]>
Cc Jonathan Cameron <[email protected]>
Cc Krzysztof Kozlowski <[email protected]>
Cc Olivier Moysan <[email protected]>
Cc Arnaud Pouliquen <[email protected]>
Cc Bjorn Andersson <[email protected]>
Cc Georgi Djakov <[email protected]>
Cc Ulf Hansson <[email protected]>
Cc Thierry Reding <[email protected]>
Cc Jonathan Hunter <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Paolo Abeni <[email protected]>
Cc Kishon Vijay Abraham I <[email protected]>
Cc Vinod Koul <[email protected]>
Cc Mark Brown <[email protected]>
Cc Fabrice Gasnier <[email protected]>
Cc Grygorii Strashko <[email protected]>
Cc Dmitry Osipenko <[email protected]>
Quoted 13 lines
---
 .../bindings/iio/adc/adi,ad7476.yaml          |  1 +
 .../bindings/iio/adc/st,stm32-dfsdm-adc.yaml  |  8 +-
 .../bindings/iio/dac/adi,ad5360.yaml          |  6 +-
 .../bindings/interconnect/qcom,rpm.yaml       | 84 +++++++++----------
 .../bindings/mmc/nvidia,tegra20-sdhci.yaml    |  2 +
 .../bindings/net/ti,davinci-mdio.yaml         |  1 +
 .../bindings/phy/nvidia,tegra20-usb-phy.yaml  | 20 ++---
 .../bindings/phy/qcom,usb-hs-phy.yaml         | 36 ++++----
 .../bindings/regulator/fixed-regulator.yaml   | 34 ++++----
 .../bindings/sound/st,stm32-sai.yaml          |  6 +-
 .../devicetree/bindings/sram/sram.yaml        | 16 ++--
 11 files changed, 108 insertions(+), 106 deletions(-)

Looks good:

Best regards,
Krzysztof

author maintainer Applied
#4 lore raw
In reply to Rob Herring
Quoted 34 lines · Rob Herring

A recent review highlighted that the json-schema meta-schema allows any combination of if/then/else schema keywords even though if, then or else by themselves makes little sense. With an added meta-schema to only allow valid combinations, there's a handful of schemas found which need fixing in a variety of ways. Incorrect indentation is the most common issue.

Cc Lars-Peter Clausen <[email protected]>
Cc Michael Hennerich <[email protected]>
Cc Jonathan Cameron <[email protected]>
Cc Krzysztof Kozlowski <[email protected]>
Cc Olivier Moysan <[email protected]>
Cc Arnaud Pouliquen <[email protected]>
Cc Bjorn Andersson <[email protected]>
Cc Georgi Djakov <[email protected]>
Cc Ulf Hansson <[email protected]>
Cc Thierry Reding <[email protected]>
Cc Jonathan Hunter <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Paolo Abeni <[email protected]>
Cc Kishon Vijay Abraham I <[email protected]>
Cc Vinod Koul <[email protected]>
Cc Mark Brown <[email protected]>
Cc Fabrice Gasnier <[email protected]>
Cc Grygorii Strashko <[email protected]>
Cc Dmitry Osipenko <[email protected]>
Quoted 14 lines
---
 .../bindings/iio/adc/adi,ad7476.yaml          |  1 +
 .../bindings/iio/adc/st,stm32-dfsdm-adc.yaml  |  8 +-
 .../bindings/iio/dac/adi,ad5360.yaml          |  6 +-
 .../bindings/interconnect/qcom,rpm.yaml       | 84 +++++++++----------
 .../bindings/mmc/nvidia,tegra20-sdhci.yaml    |  2 +
 .../bindings/net/ti,davinci-mdio.yaml         |  1 +
 .../bindings/phy/nvidia,tegra20-usb-phy.yaml  | 20 ++---
 .../bindings/phy/qcom,usb-hs-phy.yaml         | 36 ++++----
 .../bindings/regulator/fixed-regulator.yaml   | 34 ++++----
 .../bindings/sound/st,stm32-sai.yaml          |  6 +-
 .../devicetree/bindings/sram/sram.yaml        | 16 ++--
 11 files changed, 108 insertions(+), 106 deletions(-)

Applied, thanks!

Signature · 3 lines
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy