mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] dt-bindings: example-schema: Show example of dependentRequired
@ 2026-11-11 11:14 Krzysztof Kozlowski
  2026-11-11 17:21 ` Rob Herring
  0 siblings, 1 reply; 2+ messages in thread
From: Krzysztof Kozlowski @ 2026-11-11 11:14 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, devicetree, linux-kernel
  Cc: Krzysztof Kozlowski

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@oss.qualcomm.com>

---

Changes in v2:
1. Use clocks/clock-names in the dependentRequired, to avoid conflict
   with existing foo-supply constraint.
---
 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..a37d10ff7469 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:
+  # clocks is not a required property in this binding, but if present, then
+  # clock-names must be provided as well.
+  clocks: [ clock-names ]
+
 # 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] dt-bindings: example-schema: Show example of dependentRequired
  2026-11-11 11:14 [PATCH v2] dt-bindings: example-schema: Show example of dependentRequired Krzysztof Kozlowski
@ 2026-11-11 17:21 ` Rob Herring
  0 siblings, 0 replies; 2+ messages in thread
From: Rob Herring @ 2026-11-11 17:21 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Krzysztof Kozlowski, Conor Dooley, devicetree, linux-kernel

On Wed, Nov 11, 2026 at 12:14:04PM +0100, Krzysztof Kozlowski wrote:
> 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@oss.qualcomm.com>
> 
> ---
> 
> Changes in v2:
> 1. Use clocks/clock-names in the dependentRequired, to avoid conflict
>    with existing foo-supply constraint.
> ---
>  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..a37d10ff7469 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:

Update 'dependencies' instead. We can drop 'dependencies' for 
dependentRequired. Would be good to add a dependentSchemas too though we 
don't use that too much.

Rob

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-11 17:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-11 11:14 [PATCH v2] dt-bindings: example-schema: Show example of dependentRequired Krzysztof Kozlowski
2026-11-11 17:21 ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®