Devicetree
 help / color / mirror / Atom feed
* [PATCH] dt-bindings: example-schema: Show example of dependentRequired
@ 2026-11-11  9:04 Krzysztof Kozlowski
  2026-11-11  9:14 ` sashiko-bot
  0 siblings, 1 reply; 3+ messages in thread
From: Krzysztof Kozlowski @ 2026-11-11  9:04 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>
---
 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


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

* Re: [PATCH] dt-bindings: example-schema: Show example of dependentRequired
  2026-11-11  9:04 [PATCH] dt-bindings: example-schema: Show example of dependentRequired Krzysztof Kozlowski
@ 2026-11-11  9:14 ` sashiko-bot
  2026-11-11 11:08   ` Krzysztof Kozlowski
  0 siblings, 1 reply; 3+ messages in thread
From: sashiko-bot @ 2026-11-11  9:14 UTC (permalink / raw)
  To: Krzysztof Kozlowski, devicetree; +Cc: robh, conor+dt

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] dt-bindings: example-schema: conflicting and duplicate
  dependentRequired example
--

commit a3f4513191420436a3b3975020d020b961833f59
Author: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

dt-bindings: example-schema: Show example of dependentRequired

This commit adds a dependentRequired example to example-schema.yaml to
document the preferred way to express conditional property requirements.

> diff --git a/Documentation/devicetree/bindings/example-schema.yaml b/Documentation/devicetree/bindings/example-schema.yaml
> index b04f3cc4312c0..0c78eda67a2e6 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 ]

[Severity: Low]
Does requiring foo-supply when foo-gpios is present conflict with the allOf
conditional block right below?

Documentation/devicetree/bindings/example-schema.yaml:allOf:
    then:
      required:
        - foo-supply
    else:
      # If otherwise the property is not allowed:
      properties:
        foo-supply: false

That block already makes foo-supply unconditionally required on
vendor,soc2-ip and forbids foo-supply on all other compatibles, which makes
it impossible to specify foo-gpios on any compatible other than
vendor,soc2-ip.

Also, should this replace the existing dependencies block just above
required (and the comment in allOf referring to dependencies) rather than
leaving two top-level keywords in the example schema that demonstrate the
same construct?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261111090449.53511-2-krzysztof.kozlowski@oss.qualcomm.com?part=1

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

* Re: [PATCH] dt-bindings: example-schema: Show example of dependentRequired
  2026-11-11  9:14 ` sashiko-bot
@ 2026-11-11 11:08   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2026-11-11 11:08 UTC (permalink / raw)
  To: sashiko-reviews, devicetree; +Cc: robh, conor+dt

On 11/11/2026 10:14, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [Low] dt-bindings: example-schema: conflicting and duplicate
>   dependentRequired example

I should choose different properties...

Best regards,
Krzysztof

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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-11  9:04 [PATCH] dt-bindings: example-schema: Show example of dependentRequired Krzysztof Kozlowski
2026-11-11  9:14 ` sashiko-bot
2026-11-11 11:08   ` Krzysztof Kozlowski

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