mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 1/2] media: dt-bindings: renesas,fcp: add top-level constraints
@ 2025-01-28  9:53 Krzysztof Kozlowski
  2025-01-28  9:53 ` [PATCH v2 2/2] media: dt-bindings: renesas,vsp1: " Krzysztof Kozlowski
  2025-01-28 16:10 ` [PATCH v2 1/2] media: dt-bindings: renesas,fcp: " Rob Herring
  0 siblings, 2 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2025-01-28  9:53 UTC (permalink / raw)
  To: Laurent Pinchart, Mauro Carvalho Chehab, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Kieran Bingham,
	Geert Uytterhoeven, Magnus Damm, linux-media, linux-renesas-soc,
	devicetree, linux-kernel
  Cc: Krzysztof Kozlowski, Conor Dooley

Properties with variable number of items per each device are expected to
have widest constraints in top-level "properties:" block and further
customized (narrowed) in "if:then:".  Add missing top-level constraints
for clocks and clock-names.

Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

---

Changes in v2:
1. Add tag
2. Move clocks description to top level
---
 .../bindings/media/renesas,fcp.yaml           | 23 ++++++++++---------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/renesas,fcp.yaml b/Documentation/devicetree/bindings/media/renesas,fcp.yaml
index f94dacd96278..acc08ba7940b 100644
--- a/Documentation/devicetree/bindings/media/renesas,fcp.yaml
+++ b/Documentation/devicetree/bindings/media/renesas,fcp.yaml
@@ -35,9 +35,18 @@ properties:
   reg:
     maxItems: 1
 
-  clocks: true
+  clocks:
+    minItems: 1
+    items:
+      - description: Main clock
+      - description: Register access clock
+      - description: Video clock
 
-  clock-names: true
+  clock-names:
+    items:
+      - const: aclk
+      - const: pclk
+      - const: vclk
 
   iommus:
     maxItems: 1
@@ -69,15 +78,7 @@ allOf:
     then:
       properties:
         clocks:
-          items:
-            - description: Main clock
-            - description: Register access clock
-            - description: Video clock
-        clock-names:
-          items:
-            - const: aclk
-            - const: pclk
-            - const: vclk
+          minItems: 3
       required:
         - clock-names
     else:
-- 
2.43.0


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

* [PATCH v2 2/2] media: dt-bindings: renesas,vsp1: add top-level constraints
  2025-01-28  9:53 [PATCH v2 1/2] media: dt-bindings: renesas,fcp: add top-level constraints Krzysztof Kozlowski
@ 2025-01-28  9:53 ` Krzysztof Kozlowski
  2025-01-28 16:10 ` [PATCH v2 1/2] media: dt-bindings: renesas,fcp: " Rob Herring
  1 sibling, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2025-01-28  9:53 UTC (permalink / raw)
  To: Laurent Pinchart, Mauro Carvalho Chehab, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Kieran Bingham,
	Geert Uytterhoeven, Magnus Damm, linux-media, linux-renesas-soc,
	devicetree, linux-kernel
  Cc: Krzysztof Kozlowski, Conor Dooley

Properties with variable number of items per each device are expected to
have widest constraints in top-level "properties:" block and further
customized (narrowed) in "if:then:".  Add missing top-level constraints
for clocks and clock-names.

Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

---

Changes in v2:
1. Add tag
2. Move clocks description to top level
---
 .../bindings/media/renesas,vsp1.yaml          | 24 ++++++++++---------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/renesas,vsp1.yaml b/Documentation/devicetree/bindings/media/renesas,vsp1.yaml
index 1a03e67462a4..dc4b8f00aa7d 100644
--- a/Documentation/devicetree/bindings/media/renesas,vsp1.yaml
+++ b/Documentation/devicetree/bindings/media/renesas,vsp1.yaml
@@ -33,8 +33,18 @@ properties:
   interrupts:
     maxItems: 1
 
-  clocks: true
-  clock-names: true
+  clocks:
+    minItems: 1
+    items:
+      - description: Main clock
+      - description: Register access clock
+      - description: Video clock
+
+  clock-names:
+    items:
+      - const: aclk
+      - const: pclk
+      - const: vclk
 
   power-domains:
     maxItems: 1
@@ -78,15 +88,7 @@ allOf:
     then:
       properties:
         clocks:
-          items:
-            - description: Main clock
-            - description: Register access clock
-            - description: Video clock
-        clock-names:
-          items:
-            - const: aclk
-            - const: pclk
-            - const: vclk
+          minItems: 3
       required:
         - clock-names
     else:
-- 
2.43.0


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

* Re: [PATCH v2 1/2] media: dt-bindings: renesas,fcp: add top-level constraints
  2025-01-28  9:53 [PATCH v2 1/2] media: dt-bindings: renesas,fcp: add top-level constraints Krzysztof Kozlowski
  2025-01-28  9:53 ` [PATCH v2 2/2] media: dt-bindings: renesas,vsp1: " Krzysztof Kozlowski
@ 2025-01-28 16:10 ` Rob Herring
  2025-01-28 16:32   ` Krzysztof Kozlowski
  1 sibling, 1 reply; 4+ messages in thread
From: Rob Herring @ 2025-01-28 16:10 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Laurent Pinchart, Mauro Carvalho Chehab, Krzysztof Kozlowski,
	Conor Dooley, Kieran Bingham, Geert Uytterhoeven, Magnus Damm,
	linux-media, linux-renesas-soc, devicetree, linux-kernel,
	Conor Dooley

On Tue, Jan 28, 2025 at 10:53:54AM +0100, Krzysztof Kozlowski wrote:
> Properties with variable number of items per each device are expected to
> have widest constraints in top-level "properties:" block and further
> customized (narrowed) in "if:then:".  Add missing top-level constraints
> for clocks and clock-names.
> 
> Acked-by: Conor Dooley <conor.dooley@microchip.com>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

How did you find these? The below dtschema patch will find them. 
Unfortunately, there's a lot of false positives. We could eliminate some 
of them, but not sure we could get to 0. The main problem is if the 
constraints are somewhere else (e.g. reset-gpios) or via a $ref.

8<-------------------------------------------------------

diff --git a/dtschema/meta-schemas/cell.yaml b/dtschema/meta-schemas/cell.yaml
index 3f61ed93593b..b4f0d9ea0559 100644
--- a/dtschema/meta-schemas/cell.yaml
+++ b/dtschema/meta-schemas/cell.yaml
@@ -7,6 +7,7 @@ $id: http://devicetree.org/meta-schemas/cell.yaml#
 $schema: https://json-schema.org/draft/2019-09/schema
 
 array:
+  type: object
   description: cell array properties must define how many entries and what the
     entries are when there is more than one entry.
   anyOf:
diff --git a/dtschema/meta-schemas/core.yaml b/dtschema/meta-schemas/core.yaml
index c8cd03439239..233a2afd696b 100644
--- a/dtschema/meta-schemas/core.yaml
+++ b/dtschema/meta-schemas/core.yaml
@@ -16,7 +16,9 @@ allOf:
 
 definitions:
   unit-suffix-properties:
-    $ref: cell.yaml#/array
+    oneOf:
+      - $ref: cell.yaml#/array
+      - type: boolean
     propertyNames:
       description: Standard unit suffix properties don't need a type $ref
       not:
@@ -44,7 +46,9 @@ definitions:
   core-properties:
     properties:
       ranges:
-        $ref: cell.yaml#/array
+        oneOf:
+          - $ref: cell.yaml#/array
+          - type: boolean
       reg:
         $ref: cell.yaml#/array
       compatible:
diff --git a/dtschema/meta-schemas/string-array.yaml b/dtschema/meta-schemas/string-array.yaml
index f5234c6c2fc6..4d4824bc108b 100644
--- a/dtschema/meta-schemas/string-array.yaml
+++ b/dtschema/meta-schemas/string-array.yaml
@@ -5,7 +5,8 @@
 ---
 $id: http://devicetree.org/meta-schemas/string-array.yaml#
 $schema: https://json-schema.org/draft/2019-09/schema
-#type: object
+
+type: object
 
 if:
   not:


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

* Re: [PATCH v2 1/2] media: dt-bindings: renesas,fcp: add top-level constraints
  2025-01-28 16:10 ` [PATCH v2 1/2] media: dt-bindings: renesas,fcp: " Rob Herring
@ 2025-01-28 16:32   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2025-01-28 16:32 UTC (permalink / raw)
  To: Rob Herring
  Cc: Laurent Pinchart, Mauro Carvalho Chehab, Krzysztof Kozlowski,
	Conor Dooley, Kieran Bingham, Geert Uytterhoeven, Magnus Damm,
	linux-media, linux-renesas-soc, devicetree, linux-kernel,
	Conor Dooley

On 28/01/2025 17:10, Rob Herring wrote:
> On Tue, Jan 28, 2025 at 10:53:54AM +0100, Krzysztof Kozlowski wrote:
>> Properties with variable number of items per each device are expected to
>> have widest constraints in top-level "properties:" block and further
>> customized (narrowed) in "if:then:".  Add missing top-level constraints
>> for clocks and clock-names.
>>
>> Acked-by: Conor Dooley <conor.dooley@microchip.com>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> 
> How did you find these? The below dtschema patch will find them. 

Don't remember, v1 was in August, but I think purely manual - by
reviewing other people's code and then looking at the existing binding file.

> Unfortunately, there's a lot of false positives. We could eliminate some 
> of them, but not sure we could get to 0. The main problem is if the 
> constraints are somewhere else (e.g. reset-gpios) or via a $ref.
> 
> 8<-------------------------------------------------------
> 
> diff --git a/dtschema/meta-schemas/cell.yaml b/dtschema/meta-schemas/cell.yaml
> index 3f61ed93593b..b4f0d9ea0559 100644
> --- a/dtschema/meta-schemas/cell.yaml
> +++ b/dtschema/meta-schemas/cell.yaml
> @@ -7,6 +7,7 @@ $id: http://devicetree.org/meta-schemas/cell.yaml#
>  $schema: https://json-schema.org/draft/2019-09/schema


I'll give it a try, maybe will point few more cases.


Best regards,
Krzysztof

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

end of thread, other threads:[~2025-01-28 16:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-28  9:53 [PATCH v2 1/2] media: dt-bindings: renesas,fcp: add top-level constraints Krzysztof Kozlowski
2025-01-28  9:53 ` [PATCH v2 2/2] media: dt-bindings: renesas,vsp1: " Krzysztof Kozlowski
2025-01-28 16:10 ` [PATCH v2 1/2] media: dt-bindings: renesas,fcp: " Rob Herring
2025-01-28 16:32   ` Krzysztof Kozlowski

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®