Skip to contentSkip to conversation

dt-bindings: mtd: fixed-partitions: Fix 'sercomm,scpart-id' schema

PATCH Applied Rob Herring 2 participants 3 messages Nov 11, 2022 – Nov 17, 2022

Subsystems (2)
lore
Share & tools
lore

Rob Herring

author maintainer
#0 lore raw

PATCH 1/1 dt-bindings: mtd: fixed-partitions: Fix 'sercomm,scpart-id' schema

The schema for 'sercomm,scpart-id' is broken. The 'if' condition is never true because 'compatible' is in the parent node, not the child node the sub-schema applies to. The example passes as there are no constraints on additional/unevaluated properties. That's a secondary issue which is complicated due to nested partitions.

Drop the if/then schema and the unnecessary 'allOf' so that the 'sercomm,scpart-id' property is at least defined.

Cc Mikhail Zhilkin <[email protected]>
---
 .../mtd/partitions/fixed-partitions.yaml      | 29 +++++++------------
 1 file changed, 11 insertions(+), 18 deletions(-)
Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml +11 -18
index ad3ccd250802..39b715aad2dc 100644
@@ -31,24 +31,17 @@ properties:
 
 patternProperties:
   "@[0-9a-f]+$":
-    allOf:
-      - $ref: "partition.yaml#"
-      - if:
-          properties:
-            compatible:
-              contains:
-                const: sercomm,sc-partitions
-        then:
-          properties:
-            sercomm,scpart-id:
-              description: Partition id in Sercomm partition map. Mtd
-                parser uses this id to find a record in the partition map
-                containing offset and size of the current partition. The
-                values from partition map overrides partition offset and
-                size defined in reg property of the dts. Frequently these
-                values are the same, but may differ if device has bad
-                eraseblocks on a flash.
-              $ref: /schemas/types.yaml#/definitions/uint32
+    $ref: partition.yaml#
+
+    properties:
+      sercomm,scpart-id:
+        description: Partition id in Sercomm partition map. Mtd parser
+          uses this id to find a record in the partition map containing
+          offset and size of the current partition. The values from
+          partition map overrides partition offset and size defined in
+          reg property of the dts. Frequently these values are the same,
+          but may differ if device has bad eraseblocks on a flash.
+        $ref: /schemas/types.yaml#/definitions/uint32
 
 required:
   - "#address-cells"
Signature · 1 line
2.35.1
maintainer
#1 lore raw

Hi Rob,

[email protected] wrote on Fri, 11 Nov 2022 15:28:24 -0600:

Quoted 11 lines

The schema for 'sercomm,scpart-id' is broken. The 'if' condition is never true because 'compatible' is in the parent node, not the child node the sub-schema applies to. The example passes as there are no constraints on additional/unevaluated properties. That's a secondary issue which is complicated due to nested partitions.

Drop the if/then schema and the unnecessary 'allOf' so that the 'sercomm,scpart-id' property is at least defined.

Cc Mikhail Zhilkin <[email protected]>

Mmmh right, I've missed that in my little rework. I'll apply it with the big series "[PATCH v3 00/17] Improve MTD bindings" as soon as the last remaining patch gets reviewed.

Quoted 34 lines
---
 .../mtd/partitions/fixed-partitions.yaml      | 29 +++++++------------
 1 file changed, 11 insertions(+), 18 deletions(-)
Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml +4 -18
index ad3ccd250802..39b715aad2dc 100644
@@ -31,24 +31,17 @@ properties:
 
 patternProperties:
   "@[0-9a-f]+$":
-    allOf:
-      - $ref: "partition.yaml#"
-      - if:
-          properties:
-            compatible:
-              contains:
-                const: sercomm,sc-partitions
-        then:
-          properties:
-            sercomm,scpart-id:
-              description: Partition id in Sercomm partition map. Mtd
-                parser uses this id to find a record in the partition map
-                containing offset and size of the current partition. The
-                values from partition map overrides partition offset and
-                size defined in reg property of the dts. Frequently these
-                values are the same, but may differ if device has bad
-                eraseblocks on a flash.
-              $ref: /schemas/types.yaml#/definitions/uint32
+    $ref: partition.yaml#
+
+    properties:
+      sercomm,scpart-id:

Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml properties: · line 47

Quoted 10 lines
Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml +7 -0
+        description: Partition id in Sercomm partition map. Mtd parser
+          uses this id to find a record in the partition map containing
+          offset and size of the current partition. The values from
+          partition map overrides partition offset and size defined in
+          reg property of the dts. Frequently these values are the same,
+          but may differ if device has bad eraseblocks on a flash.
+        $ref: /schemas/types.yaml#/definitions/uint32
 
 required:
   - "#address-cells"

Thanks,
Miquèl

maintainer Applied
#2 lore raw
In reply to Rob Herring
Quoted 11 lines · Rob Herring

The schema for 'sercomm,scpart-id' is broken. The 'if' condition is never true because 'compatible' is in the parent node, not the child node the sub-schema applies to. The example passes as there are no constraints on additional/unevaluated properties. That's a secondary issue which is complicated due to nested partitions.

Drop the if/then schema and the unnecessary 'allOf' so that the 'sercomm,scpart-id' property is at least defined.

Cc Mikhail Zhilkin <[email protected]>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.

Miquel