Skip to content

Commit

Permalink
schemas: simple-bus: Rework handling of child nodes without unit-address
Browse files Browse the repository at this point in the history
The simple-bus currently will spit out the whole bus subtree when it
contains a child node without a unit-address. It also has a false positive
when the child node is another bus that has an empty 'ranges' property.

Rework the schema to use 'additionalProperties' instead of a pattern and
use an if/then schema. Now validation will report "ranges is required"
which is a little misleading, but better than the huge dump of the whole
subtree.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
  • Loading branch information
robherring committed May 3, 2024
1 parent 1a2c5d8 commit ed9190d
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions dtschema/schemas/simple-bus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,19 @@ patternProperties:
- required:
- ranges

"^[^@]+$":
# Only additional properties should be properties, not nodes.
not:
type: object
additionalProperties:
description:
Anything else must be a property or have empty 'ranges'. An empty 'ranges'
is only appropriate if the child node is another 'simple-bus' or similar.
if:
type: object
then:
properties:
ranges:
type: boolean

additionalProperties: false
required:
- ranges

required:
- compatible
Expand Down

0 comments on commit ed9190d

Please sign in to comment.