[PATCH 12/12] dt-bindings: mtd: Constrain the list of parsers

Rob Herring robh at kernel.org
Mon Oct 31 14:10:08 PDT 2022


On Sat, Oct 29, 2022 at 01:59:33AM +0200, Miquel Raynal wrote:
> Parser compatibles cannot be used anywhere, and the list is limited. In
> order to constrain this list, enumerate them all under the top
> "partitions" subnode. New parsers will have to add their own compatible
> here as well.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal at bootlin.com>
> ---
>  Documentation/devicetree/bindings/mtd/mtd.yaml | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/mtd/mtd.yaml b/Documentation/devicetree/bindings/mtd/mtd.yaml
> index bddb7bdf441b..29db0b5c115e 100644
> --- a/Documentation/devicetree/bindings/mtd/mtd.yaml
> +++ b/Documentation/devicetree/bindings/mtd/mtd.yaml
> @@ -27,13 +27,29 @@ properties:
>    partitions:
>      type: object
>      properties:
> +      compatible:
> +        contains:
> +          enum:
> +            - fixed-partitions
> +            - arm,arm-firmware-suite
> +            - brcm,bcm4908-partitions
> +            - brcm,bcm947xx-cfe-partitions
> +            - nksys,ns-partitions
> +            - nvmem-cells
> +            - qcom,smem-part
> +            - redboot-fis
> +
>        '#address-cells': true
> +
>        '#size-cells': true

Alternatively, you could add a 'oneOf' with $ref's to each partition 
type. Then we don't have the same compatible in 2 places. If you do, 
then the partition schemas should have a 'select: false' so we don't 
apply the schema twice.

Or keeping it like this is fine too.

Reviewed-by: Rob Herring <robh at kernel.org>

Rob



More information about the linux-mtd mailing list