diff mbox series

dt-bindings: reserved-memory: Add restricted-dma-pool constraints

Message ID 79d1914ff04b44c3005072a990d14291c9ce6fce.1645103404.git.robin.murphy@arm.com
State Superseded, archived
Headers show
Series dt-bindings: reserved-memory: Add restricted-dma-pool constraints | expand

Checks

Context Check Description
robh/patch-applied success
robh/checkpatch success
robh/dtbs-check success
robh/dt-meta-schema success

Commit Message

Robin Murphy Feb. 17, 2022, 1:10 p.m. UTC
The "restricted-dma-pool" definition prohibits combination with either
of the "no-map" and "reusable" properties, but this is only stated in
the description text. Add those constraints to the schema so we can
properly validate them.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
 .../bindings/reserved-memory/shared-dma-pool.yaml   | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Rob Herring Feb. 17, 2022, 4:05 p.m. UTC | #1
On Thu, Feb 17, 2022 at 7:10 AM Robin Murphy <robin.murphy@arm.com> wrote:
>
> The "restricted-dma-pool" definition prohibits combination with either
> of the "no-map" and "reusable" properties, but this is only stated in
> the description text. Add those constraints to the schema so we can
> properly validate them.
>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
>  .../bindings/reserved-memory/shared-dma-pool.yaml   | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/reserved-memory/shared-dma-pool.yaml b/Documentation/devicetree/bindings/reserved-memory/shared-dma-pool.yaml
> index a4bf757d6881..01385581f663 100644
> --- a/Documentation/devicetree/bindings/reserved-memory/shared-dma-pool.yaml
> +++ b/Documentation/devicetree/bindings/reserved-memory/shared-dma-pool.yaml
> @@ -56,6 +56,19 @@ properties:
>        If this property is present, then Linux will use the region for
>        the default pool of the consistent DMA allocator.
>
> +if:
> +  properties:
> +    compatible:
> +      contains:
> +        const: restricted-dma-pool
> +then:
> +  not:
> +    anyOf:
> +      - required:
> +          - no-map
> +      - required:
> +          - reusable

I think it is a bit clearer to disallow properties like this:

then:
  properties:
    no-map: false
    reusable: false


> +
>  unevaluatedProperties: false
>
>  examples:
> --
> 2.28.0.dirty
>
Robin Murphy Feb. 17, 2022, 4:20 p.m. UTC | #2
On 2022-02-17 16:05, Rob Herring wrote:
> On Thu, Feb 17, 2022 at 7:10 AM Robin Murphy <robin.murphy@arm.com> wrote:
>>
>> The "restricted-dma-pool" definition prohibits combination with either
>> of the "no-map" and "reusable" properties, but this is only stated in
>> the description text. Add those constraints to the schema so we can
>> properly validate them.
>>
>> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
>> ---
>>   .../bindings/reserved-memory/shared-dma-pool.yaml   | 13 +++++++++++++
>>   1 file changed, 13 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/reserved-memory/shared-dma-pool.yaml b/Documentation/devicetree/bindings/reserved-memory/shared-dma-pool.yaml
>> index a4bf757d6881..01385581f663 100644
>> --- a/Documentation/devicetree/bindings/reserved-memory/shared-dma-pool.yaml
>> +++ b/Documentation/devicetree/bindings/reserved-memory/shared-dma-pool.yaml
>> @@ -56,6 +56,19 @@ properties:
>>         If this property is present, then Linux will use the region for
>>         the default pool of the consistent DMA allocator.
>>
>> +if:
>> +  properties:
>> +    compatible:
>> +      contains:
>> +        const: restricted-dma-pool
>> +then:
>> +  not:
>> +    anyOf:
>> +      - required:
>> +          - no-map
>> +      - required:
>> +          - reusable
> 
> I think it is a bit clearer to disallow properties like this:
> 
> then:
>    properties:
>      no-map: false
>      reusable: false

Aha! I was sure there must be a better way, but couldn't see the wood 
for the trees, thanks!

Robin.

> 
> 
>> +
>>   unevaluatedProperties: false
>>
>>   examples:
>> --
>> 2.28.0.dirty
>>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/reserved-memory/shared-dma-pool.yaml b/Documentation/devicetree/bindings/reserved-memory/shared-dma-pool.yaml
index a4bf757d6881..01385581f663 100644
--- a/Documentation/devicetree/bindings/reserved-memory/shared-dma-pool.yaml
+++ b/Documentation/devicetree/bindings/reserved-memory/shared-dma-pool.yaml
@@ -56,6 +56,19 @@  properties:
       If this property is present, then Linux will use the region for
       the default pool of the consistent DMA allocator.
 
+if:
+  properties:
+    compatible:
+      contains:
+        const: restricted-dma-pool
+then:
+  not:
+    anyOf:
+      - required:
+          - no-map
+      - required:
+          - reusable
+
 unevaluatedProperties: false
 
 examples: