From: William Zhang <william.zhang@broadcom.com>
To: Conor Dooley <conor.dooley@microchip.com>
Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
f.fainelli@gmail.com,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Rob Herring <robh+dt@kernel.org>
Subject: Re: dt_binding_check report false alarm?
Date: Thu, 25 May 2023 08:23:30 -0700 [thread overview]
Message-ID: <00604ffd-ccb3-e640-5457-1fa1ed663d26@broadcom.com> (raw)
In-Reply-To: <20230525-wrench-lushness-f9a1ad022798@wendy>
[-- Attachment #1.1: Type: text/plain, Size: 2696 bytes --]
Sorry for the multiple emails. Our mail relay server was not working
properly.
Hi Conor,
On 05/25/2023 06:23 AM, Conor Dooley wrote:
> 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.
>
Our device can use one or two interrupt, or choose to not use interrupt
at all(polling mode). Interrupt names is only required when there are
two interrupts(so the driver code can tell which is which). So I will
need to check if it contains two interrupts. My check does work if I
have two interrupt but don't have interrupt name, the check catches the
error. If I have one interrupt without interrupt name, the check pass.
Only when I does not have interrupt and interrupt name, it falsely
report error. Looks to me that it does not treat minItem = 0 case
properly.
>> + 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
>>
>
>
[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4212 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: William Zhang <william.zhang@broadcom.com>
To: Conor Dooley <conor.dooley@microchip.com>
Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
f.fainelli@gmail.com,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Rob Herring <robh+dt@kernel.org>
Subject: Re: dt_binding_check report false alarm?
Date: Thu, 25 May 2023 08:23:30 -0700 [thread overview]
Message-ID: <00604ffd-ccb3-e640-5457-1fa1ed663d26@broadcom.com> (raw)
In-Reply-To: <20230525-wrench-lushness-f9a1ad022798@wendy>
[-- Attachment #1: Type: text/plain, Size: 2696 bytes --]
Sorry for the multiple emails. Our mail relay server was not working
properly.
Hi Conor,
On 05/25/2023 06:23 AM, Conor Dooley wrote:
> 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.
>
Our device can use one or two interrupt, or choose to not use interrupt
at all(polling mode). Interrupt names is only required when there are
two interrupts(so the driver code can tell which is which). So I will
need to check if it contains two interrupts. My check does work if I
have two interrupt but don't have interrupt name, the check catches the
error. If I have one interrupt without interrupt name, the check pass.
Only when I does not have interrupt and interrupt name, it falsely
report error. Looks to me that it does not treat minItem = 0 case
properly.
>> + 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
>>
>
>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4212 bytes --]
next prev parent reply other threads:[~2023-05-25 15:24 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-25 5:02 dt_binding_check report false alarm? William Zhang
2023-05-25 5:02 ` William Zhang
2023-05-25 13:23 ` Conor Dooley
2023-05-25 13:23 ` Conor Dooley
2023-05-25 15:23 ` William Zhang [this message]
2023-05-25 15:23 ` William Zhang
2023-05-25 15:33 ` Conor Dooley
2023-05-25 15:33 ` Conor Dooley
2023-05-25 17:10 ` William Zhang
2023-05-25 17:10 ` William Zhang
2023-05-25 18:12 ` Conor Dooley
2023-05-25 18:12 ` Conor Dooley
2023-05-26 5:56 ` William Zhang
2023-05-26 5:56 ` William Zhang
2023-05-26 6:25 ` Conor Dooley
2023-05-26 6:25 ` Conor Dooley
2023-05-25 17:29 ` Robin Murphy
2023-05-25 17:29 ` Robin Murphy
2023-05-26 1:43 ` Rob Herring
2023-05-26 1:43 ` Rob Herring
2023-06-08 14:57 ` Rob Herring
2023-06-08 14:57 ` Rob Herring
2023-06-08 23:00 ` William Zhang
2023-06-08 23:00 ` William Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=00604ffd-ccb3-e640-5457-1fa1ed663d26@broadcom.com \
--to=william.zhang@broadcom.com \
--cc=conor.dooley@microchip.com \
--cc=devicetree@vger.kernel.org \
--cc=f.fainelli@gmail.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.