[PATCH] dt-bindings: example-schema: Show example of dependentRequired
From: Krzysztof Kozlowski
Date: Wed Nov 11 2026 - 04:07:28 EST
dependentRequired is shorter and preferred form of conditional property
requirement, over allOf:if:then: block, so document example usage.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxxxxxxxx>
---
Documentation/devicetree/bindings/example-schema.yaml | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Documentation/devicetree/bindings/example-schema.yaml b/Documentation/devicetree/bindings/example-schema.yaml
index b04f3cc4312c..0c78eda67a2e 100644
--- a/Documentation/devicetree/bindings/example-schema.yaml
+++ b/Documentation/devicetree/bindings/example-schema.yaml
@@ -217,6 +217,14 @@ required:
- interrupts
- interrupt-controller
+# Properties might be required only if some other property is present.
+# dependentRequired is a shorter and preferred way to express this, instead of
+# if:then: block.
+dependentRequired:
+ # foo-gpios is not a required property, but if present, then foo-supply must
+ # be provided as well.
+ foo-gpios: [ foo-supply ]
+
# if/then schema can be used to handle conditions on a property affecting
# another property. A typical case is a specific 'compatible' value changes the
# constraints on other properties.
--
2.53.0