dt_binding_check report false alarm?

Conor Dooley conor.dooley at microchip.com
Thu May 25 06:23:46 PDT 2023


Hey William,

On Wed, May 24, 2023 at 10:02:41PM -0700, William Zhang wrote:
> Hi,
> 
> It seems dt_binding_check reports a false error when run on this
> modified yaml. I picked this simple file just to demostrate this issue.
> Basically I made the interrupts and interrupt-names as optional
> properties. But when there are two interrupts present, then
> interrupt-names are required.  However in the example, I don't define
> interrupts and interrupt-name at all, the dt binding check reports error
> that interrupt-names are required:

Rob and Krzysztof would know more than me, but since they're not
around...

> diff --git a/Documentation/devicetree/bindings/crypto/fsl-imx-scc.yaml b/Documentation/devicetree/bindings/crypto/fsl-imx-scc.yaml
> index 563a31605d2b..c37a3a64a78c 100644
> --- a/Documentation/devicetree/bindings/crypto/fsl-imx-scc.yaml
> +++ b/Documentation/devicetree/bindings/crypto/fsl-imx-scc.yaml
> @@ -32,11 +32,18 @@ properties:
>    clock-names:
>      const: ipg
>  
> +allOf:
> +  - if:
> +      properties:
> +        interrupts:
> +          minItems: 2

...I don't think you can actually do this and "minItems: 2" will always
evaluate to true because it is an assignment. Don't hold me to that
though! The standard pattern here is to do:
allOf:
  - if:
      properties:
        compatible:
          contains:
            const: foo
    then:
      required:
        - interrupt-names

Cheers,
Conor.

> +    then:
> +      required:
> +        - interrupt-names
> +
>  required:
>    - compatible
>    - reg
> -  - interrupts
> -  - interrupt-names
>    - clocks
>    - clock-names
>  
> @@ -49,6 +56,4 @@ examples:
>          reg = <0x53fac000 0x4000>;
>          clocks = <&clks 111>;
>          clock-names = "ipg";
> -        interrupts = <49>, <50>;
> -        interrupt-names = "scm", "smn";
>      };
> -- 
> 2.34.1
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20230525/e6a40809/attachment-0001.sig>


More information about the linux-arm-kernel mailing list