Skip to content

Commit 1eb9fab

Browse files
robherringmiquelraynal
authored andcommitted
dt-bindings: mtd: Ensure partition node properties are documented
Partition nodes without a compatible have no restrictions on additional properties. Fix this by ensuring 'unevaluatedProperties' is set when there's no compatible property. If there is a compatible property, then there should be a specific schema for it which will enforce 'unevaluatedProperties'. Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Signed-off-by: Rob Herring (Arm) <robh@kernel.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
1 parent 95af1e6 commit 1eb9fab

6 files changed

Lines changed: 18 additions & 10 deletions

File tree

Documentation/devicetree/bindings/mtd/mtd.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,8 @@ properties:
3636
- compatible
3737

3838
patternProperties:
39-
"@[0-9a-f]+$":
40-
$ref: partitions/partition.yaml
41-
deprecated: true
42-
43-
"^partition@[0-9a-f]+":
44-
$ref: partitions/partition.yaml
39+
"(^partition)?@[0-9a-f]+$":
40+
$ref: /schemas/mtd/partitions/partition.yaml#/$defs/partition-node
4541
deprecated: true
4642

4743
"^otp(-[0-9]+)?$":

Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ properties:
3333

3434
patternProperties:
3535
"@[0-9a-f]+$":
36-
$ref: partition.yaml#
36+
$ref: partition.yaml#/$defs/partition-node
3737

3838
required:
3939
- "#address-cells"

Documentation/devicetree/bindings/mtd/partitions/partition.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,18 @@ then:
149149
# This is a generic file other binding inherit from and extend
150150
additionalProperties: true
151151

152+
$defs:
153+
partition-node:
154+
type: object
155+
if:
156+
not:
157+
required: [ compatible ]
158+
then:
159+
$ref: '#'
160+
unevaluatedProperties: false
161+
else:
162+
$ref: '#'
163+
152164
examples:
153165
- |
154166
partitions {

Documentation/devicetree/bindings/mtd/partitions/tplink,safeloader-partitions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ properties:
3838

3939
patternProperties:
4040
"^partition-.*$":
41-
$ref: partition.yaml#
41+
$ref: partition.yaml#/$defs/partition-node
4242

4343
required:
4444
- partitions-table-offset

Documentation/devicetree/bindings/mtd/partitions/u-boot.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ properties:
2929
3030
patternProperties:
3131
"^partition-.*$":
32-
$ref: partition.yaml#
32+
$ref: partition.yaml#/$defs/partition-node
3333

3434
unevaluatedProperties: false
3535

Documentation/devicetree/bindings/mtd/ti,gpmc-onenand.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ properties:
3636

3737
patternProperties:
3838
"@[0-9a-f]+$":
39-
$ref: /schemas/mtd/partitions/partition.yaml
39+
$ref: /schemas/mtd/partitions/partition.yaml#/$defs/partition-node
4040

4141
allOf:
4242
- $ref: /schemas/memory-controllers/ti,gpmc-child.yaml

0 commit comments

Comments
 (0)