From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A4881C77B7E for ; Thu, 25 May 2023 15:34:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=NN5pd1hrPQ/ml/KWIlr7RWiDoJHeQ8aHeSo45gK8PbA=; b=gFdUfJ5GgZLV57TOJHUL2EeqZT AHvPmJ74rz8oeQuKDnMLS9bAvv3o4RXciAMOhW0+DaCv6iBq0Oh/3KfXNktLtJIn+7MrmBYDA24EN hDZN0OUAQJcZE/M3lta7vpOCzH9cfvyDkvDKH0TNqmijcq7dpidvGKvLchvY0BwV6ngs2tLNRG/WT bqbZmsyLS7kqLMwk16bATCnaAP6Seu0J5mPWudZclaFUY0mX0fPDfnwlvAAZWEmlfxtn0DBvCqKob Pd9QKML9xzVbgZwluXY5gOxRDBNEPSruBJQRnVUuHBx1ex1MqzwklDjSe+y6666+c/g6rVei168dR RvPt/Mlg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q2CyN-00Gyms-1k; Thu, 25 May 2023 15:33:51 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q2CyL-00GymR-03 for linux-arm-kernel@lists.infradead.org; Thu, 25 May 2023 15:33:50 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 596406111D; Thu, 25 May 2023 15:33:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AB7BC433EF; Thu, 25 May 2023 15:33:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685028827; bh=R/0sYGOUGm5iNb1+bPkPKlgQmZZL0k1s6pKYpNlqQKI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cCaMdUxiwlLKqJXV0qbYeLCKrHZBS+NQFHpcd9WcNidlEea0Phd7wjP33GlmNRGsh vcX4m/QlBUvC/QMVCOmr/5e89qFcB37FaVqY1Ud6NG2E6oStnSI65DzQyopyVQU68N Phm1W4Ar3khSzemCjHC0oKtzoUwNEPwlOYfNBr/X/7RTcD9Qh9S9fi0OpD8iOCZCsI xCV8xbLPzjm6+w/2ejTcK5wrNXa0mpUyuDA04X4i4R7+A1fbtJ5Z9fMtUYJegphNWn iCDBmOuKdGG6ViD4Ws6a1RGHQqaITPyhIRweS9yFf7jvhWi1TYxJPpwjS/kvV1+3zT QeWq0RxedPn3g== Date: Thu, 25 May 2023 16:33:43 +0100 From: Conor Dooley To: William Zhang Cc: Conor Dooley , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, f.fainelli@gmail.com, Krzysztof Kozlowski , Rob Herring Subject: Re: dt_binding_check report false alarm? Message-ID: <20230525-unlearned-trusting-1ed0cf6a6364@spud> References: <20230525050241.3700-1-william.zhang@broadcom.com> <20230525-wrench-lushness-f9a1ad022798@wendy> <00604ffd-ccb3-e640-5457-1fa1ed663d26@broadcom.com> MIME-Version: 1.0 In-Reply-To: <00604ffd-ccb3-e640-5457-1fa1ed663d26@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230525_083349_128831_E769480E X-CRM114-Status: GOOD ( 33.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============8081091291142733778==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============8081091291142733778== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="CFxmMaNzIEG8k6h0" Content-Disposition: inline --CFxmMaNzIEG8k6h0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, May 25, 2023 at 08:23:30AM -0700, William Zhang wrote: > Sorry for the multiple emails. Our mail relay server was not working > properly. I only got one /shrug > On 05/25/2023 06:23 AM, Conor Dooley wrote: > > Hey William, > >=20 > > On Wed, May 24, 2023 at 10:02:41PM -0700, William Zhang wrote: > > > Hi, > > >=20 > > > It seems dt_binding_check reports a false error when run on this > > > modified yaml. I picked this simple file just to demostrate this issu= e. > > > 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 er= ror > > > that interrupt-names are required: > >=20 > > Rob and Krzysztof would know more than me, but since they're not > > around... > >=20 > > > diff --git a/Documentation/devicetree/bindings/crypto/fsl-imx-scc.yam= l 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 > >=20 > > ...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 > >=20 > > Cheers, > > Conor. > >=20 > 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 do= es > not have interrupt and interrupt name, it falsely report error. Looks to > me that it does not treat minItem =3D 0 case properly. Right. I would not bother with the "only interrupt-names when 2 interrupts" stuff & do the simple thing of always making it required when you have interrupts. Then you can use allOf and oneOf to allow for both schemes for the new device and keep enforcement of 2 items for the existing one. Cheers, Conor. > > > + then: > > > + required: > > > + - interrupt-names > > > + > > > required: > > > - compatible > > > - reg > > > - - interrupts > > > - - interrupt-names > > > - clocks > > > - clock-names > > > @@ -49,6 +56,4 @@ examples: > > > reg =3D <0x53fac000 0x4000>; > > > clocks =3D <&clks 111>; > > > clock-names =3D "ipg"; > > > - interrupts =3D <49>, <50>; > > > - interrupt-names =3D "scm", "smn"; > > > }; > > > --=20 > > > 2.34.1 > > >=20 > >=20 > >=20 --CFxmMaNzIEG8k6h0 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZG9/1wAKCRB4tDGHoIJi 0hEpAQDdY7ORGUelBFzCsXernO5QjtC3/gE4LvW57/SLWrIacgD/ZFwmUAyCJQuq pFNoVwdRxDoEx84RoXyPdiT9ZprhfAc= =BIFh -----END PGP SIGNATURE----- --CFxmMaNzIEG8k6h0-- --===============8081091291142733778== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============8081091291142733778==--