Skip to contentSkip to conversation

dt-bindings: More use 'enum' instead of 'oneOf' plus 'const' entries

PATCH In review Rob Herring 4 participants 4 messages Sep 10, 2021 – Sep 13, 2021

Subsystems (6)
lore
Share & tools
lore

Rob Herring

author maintainer
#0 lore raw

PATCH 1/1 dt-bindings: More use 'enum' instead of 'oneOf' plus 'const' entries

'enum' is equivalent to 'oneOf' with a list of 'const' entries, but 'enum' is more concise and yields better error messages.

Fix a couple more cases which have appeared.

Cc Rob Clark <[email protected]>
Cc Sean Paul <[email protected]>
Cc Mark Brown <[email protected]>
Cc Wim Van Sebroeck <[email protected]>
Cc Guenter Roeck <[email protected]>
Cc Jonathan Marek <[email protected]>
Cc Aswath Govindraju <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Linus Walleij <[email protected]>
---
 .../bindings/display/msm/dsi-phy-7nm.yaml          |  8 ++++----
 .../devicetree/bindings/spi/omap-spi.yaml          |  6 +++---
 .../bindings/watchdog/maxim,max63xx.yaml           | 14 +++++++-------
 3 files changed, 14 insertions(+), 14 deletions(-)
Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml +4 -4
index 4265399bb154..c851770bbdf2 100644
@@ -14,10 +14,10 @@ allOf:
 
 properties:
   compatible:
-    oneOf:
-      - const: qcom,dsi-phy-7nm
-      - const: qcom,dsi-phy-7nm-8150
-      - const: qcom,sc7280-dsi-phy-7nm
+    enum:
+      - qcom,dsi-phy-7nm
+      - qcom,dsi-phy-7nm-8150
+      - qcom,sc7280-dsi-phy-7nm
 
   reg:
     items:
Documentation/devicetree/bindings/spi/omap-spi.yaml +3 -3
index e55538186cf6..9952199cae11 100644
@@ -84,9 +84,9 @@ unevaluatedProperties: false
 if:
   properties:
     compatible:
-      oneOf:
-        - const: ti,omap2-mcspi
-        - const: ti,omap4-mcspi
+      enum:
+        - ti,omap2-mcspi
+        - ti,omap4-mcspi
 
 then:
   properties:
Documentation/devicetree/bindings/watchdog/maxim,max63xx.yaml +7 -7
index f2105eedac2c..ab9641e845db 100644
@@ -15,13 +15,13 @@ maintainers:
 
 properties:
   compatible:
-    oneOf:
-      - const: maxim,max6369
-      - const: maxim,max6370
-      - const: maxim,max6371
-      - const: maxim,max6372
-      - const: maxim,max6373
-      - const: maxim,max6374
+    enum:
+      - maxim,max6369
+      - maxim,max6370
+      - maxim,max6371
+      - maxim,max6372
+      - maxim,max6373
+      - maxim,max6374
 
   reg:
     description: This is a 1-byte memory-mapped address
Signature · 1 line
2.30.2
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · Rob Herring

'enum' is equivalent to 'oneOf' with a list of 'const' entries, but 'enum' is more concise and yields better error messages.

maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Rob Herring
Quoted 19 lines · Rob Herring

'enum' is equivalent to 'oneOf' with a list of 'const' entries, but 'enum' is more concise and yields better error messages.

Fix a couple more cases which have appeared.

Cc Rob Clark <[email protected]>
Cc Sean Paul <[email protected]>
Cc Mark Brown <[email protected]>
Cc Wim Van Sebroeck <[email protected]>
Cc Guenter Roeck <[email protected]>
Cc Jonathan Marek <[email protected]>
Cc Aswath Govindraju <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Linus Walleij <[email protected]>
Quoted 4 lines
---
  .../bindings/display/msm/dsi-phy-7nm.yaml          |  8 ++++----
  .../devicetree/bindings/spi/omap-spi.yaml          |  6 +++---
  .../bindings/watchdog/maxim,max63xx.yaml           | 14 +++++++-------

For watchdog:

Quoted 64 lines
  3 files changed, 14 insertions(+), 14 deletions(-)
Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml +4 -4
index 4265399bb154..c851770bbdf2 100644
@@ -14,10 +14,10 @@ allOf:
 
  properties:
    compatible:
-    oneOf:
-      - const: qcom,dsi-phy-7nm
-      - const: qcom,dsi-phy-7nm-8150
-      - const: qcom,sc7280-dsi-phy-7nm
+    enum:
+      - qcom,dsi-phy-7nm
+      - qcom,dsi-phy-7nm-8150
+      - qcom,sc7280-dsi-phy-7nm
 
    reg:
      items:
Documentation/devicetree/bindings/spi/omap-spi.yaml +3 -3
index e55538186cf6..9952199cae11 100644
@@ -84,9 +84,9 @@ unevaluatedProperties: false
  if:
    properties:
      compatible:
-      oneOf:
-        - const: ti,omap2-mcspi
-        - const: ti,omap4-mcspi
+      enum:
+        - ti,omap2-mcspi
+        - ti,omap4-mcspi
 
  then:
    properties:
Documentation/devicetree/bindings/watchdog/maxim,max63xx.yaml +7 -7
index f2105eedac2c..ab9641e845db 100644
@@ -15,13 +15,13 @@ maintainers:
 
  properties:
    compatible:
-    oneOf:
-      - const: maxim,max6369
-      - const: maxim,max6370
-      - const: maxim,max6371
-      - const: maxim,max6372
-      - const: maxim,max6373
-      - const: maxim,max6374
+    enum:
+      - maxim,max6369
+      - maxim,max6370
+      - maxim,max6371
+      - maxim,max6372
+      - maxim,max6373
+      - maxim,max6374
 
    reg:
      description: This is a 1-byte memory-mapped address
Acked-by on v1 1/1
#3 lore raw
In reply to Rob Herring
Quoted 19 lines · Rob Herring

'enum' is equivalent to 'oneOf' with a list of 'const' entries, but 'enum' is more concise and yields better error messages.

Fix a couple more cases which have appeared.

Cc Rob Clark <[email protected]>
Cc Sean Paul <[email protected]>
Cc Mark Brown <[email protected]>
Cc Wim Van Sebroeck <[email protected]>
Cc Guenter Roeck <[email protected]>
Cc Jonathan Marek <[email protected]>
Cc Aswath Govindraju <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Linus Walleij <[email protected]>
Quoted 3 lines
---
 .../bindings/display/msm/dsi-phy-7nm.yaml          |  8 ++++----
 .../devicetree/bindings/spi/omap-spi.yaml          |  6 +++---

For omap-spi:

Quoted 65 lines
 .../bindings/watchdog/maxim,max63xx.yaml           | 14 +++++++-------
 3 files changed, 14 insertions(+), 14 deletions(-)
Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml +4 -4
index 4265399bb154..c851770bbdf2 100644
@@ -14,10 +14,10 @@ allOf:
 
 properties:
   compatible:
-    oneOf:
-      - const: qcom,dsi-phy-7nm
-      - const: qcom,dsi-phy-7nm-8150
-      - const: qcom,sc7280-dsi-phy-7nm
+    enum:
+      - qcom,dsi-phy-7nm
+      - qcom,dsi-phy-7nm-8150
+      - qcom,sc7280-dsi-phy-7nm
 
   reg:
     items:
Documentation/devicetree/bindings/spi/omap-spi.yaml +3 -3
index e55538186cf6..9952199cae11 100644
@@ -84,9 +84,9 @@ unevaluatedProperties: false
 if:
   properties:
     compatible:
-      oneOf:
-        - const: ti,omap2-mcspi
-        - const: ti,omap4-mcspi
+      enum:
+        - ti,omap2-mcspi
+        - ti,omap4-mcspi
 
 then:
   properties:
Documentation/devicetree/bindings/watchdog/maxim,max63xx.yaml +7 -7
index f2105eedac2c..ab9641e845db 100644
@@ -15,13 +15,13 @@ maintainers:
 
 properties:
   compatible:
-    oneOf:
-      - const: maxim,max6369
-      - const: maxim,max6370
-      - const: maxim,max6371
-      - const: maxim,max6372
-      - const: maxim,max6373
-      - const: maxim,max6374
+    enum:
+      - maxim,max6369
+      - maxim,max6370
+      - maxim,max6371
+      - maxim,max6372
+      - maxim,max6373
+      - maxim,max6374
 
   reg:
     description: This is a 1-byte memory-mapped address