From ed9190d20f146d13e262cc9138506326f7d4da91 Mon Sep 17 00:00:00 2001 From: "Rob Herring (Arm)" Date: Fri, 3 May 2024 13:54:04 -0500 Subject: [PATCH] schemas: simple-bus: Rework handling of child nodes without unit-address 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) --- dtschema/schemas/simple-bus.yaml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/dtschema/schemas/simple-bus.yaml b/dtschema/schemas/simple-bus.yaml index 5f3524ea..0d1d37d4 100644 --- a/dtschema/schemas/simple-bus.yaml +++ b/dtschema/schemas/simple-bus.yaml @@ -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