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 X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E472C433E6 for ; Wed, 3 Feb 2021 15:57:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4348164F95 for ; Wed, 3 Feb 2021 15:57:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234659AbhBCP5V (ORCPT ); Wed, 3 Feb 2021 10:57:21 -0500 Received: from mail-oi1-f173.google.com ([209.85.167.173]:44424 "EHLO mail-oi1-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234575AbhBCP4F (ORCPT ); Wed, 3 Feb 2021 10:56:05 -0500 Received: by mail-oi1-f173.google.com with SMTP id n7so296941oic.11; Wed, 03 Feb 2021 07:55:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=qT9vhKEcJnv2UxHfk3LsH4oahpbnsqDoYZLdzv8tkwQ=; b=YCZJ1yp85PvCKJN7RAdn+4VEigPGpegOt2q/tut50IqCuAFWiO1topmTGZQ7Y8e14N RmJF6Bblo/B7D48QIiAG9sEfVgOB4qYTwNObAKUd9XMDrwP4Z0CfOolEkL+WD1okGXpU sz+biOuKuoB/1jTAqeG0HlwZp1714Ud90/Sg22EVD/TLOhRau3YrvQFGJUfjH6QY1qUQ EBDLPt+eweof8NpOr/gRsDK1DyjjWy/kq0NWUiehPcn/6HZPw+F7nnv4cvpvedBPGc+p Memp5xX+UcC/LJY/Aam5aNJgJTLKr+lmqSjjiV9WWpgT02zDk8vrjVusJ6PDI62Oct48 iQQw== X-Gm-Message-State: AOAM533b2I7bGEo3hw3v6/mIth82iIPKKHFI1b62M5w+kvVcFITRjxuC rvuRRCB0nb4iPVEFxKbbeg== X-Google-Smtp-Source: ABdhPJxmOBQcH5R+lFiUlGBqVbuj5kwZxcJFcUI25C3II5lOgKlwz+nfG7ePzMnfdKQ5jcv5RyiyOg== X-Received: by 2002:aca:4e13:: with SMTP id c19mr2424431oib.66.1612367721055; Wed, 03 Feb 2021 07:55:21 -0800 (PST) Received: from robh.at.kernel.org (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.gmail.com with ESMTPSA id o14sm481868oof.38.2021.02.03.07.55.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Feb 2021 07:55:19 -0800 (PST) Received: (nullmailer pid 1895243 invoked by uid 1000); Wed, 03 Feb 2021 15:55:17 -0000 Date: Wed, 3 Feb 2021 09:55:17 -0600 From: Rob Herring To: Geert Uytterhoeven Cc: "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux Kernel Mailing List , Stephen Boyd , Maxime Ripard , Chen-Yu Tsai , Linus Walleij , Herbert Xu , "David S. Miller" , Daniel Palmer , Bartosz Golaszewski , Avi Fishman , Tomer Maimon , Tali Perry , Joerg Roedel , Will Deacon , Andrew Jeffery , Joel Stanley , Wim Van Sebroeck , Guenter Roeck , Yoshihiro Shimoda , Vincent Cheng , linux-clk , Linux Crypto Mailing List , "open list:GPIO SUBSYSTEM" , Linux I2C , Linux IOMMU , Linux Watchdog Mailing List , Eric Anholt , Nicolas Saenz Julienne , Florian Fainelli , Ray Jui , Scott Branden , Pavel Machek , Ulf Hansson , Kishon Vijay Abraham I , Vinod Koul , Geert Uytterhoeven , Daniel Lezcano , DRI Development , linux-leds , Linux MMC List Subject: Re: [PATCH 3/3] dt-bindings: Fix errors in 'if' schemas Message-ID: <20210203155517.GC3706951@robh.at.kernel.org> References: <20210202205544.24812-1-robh@kernel.org> <20210202205544.24812-3-robh@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org On Wed, Feb 03, 2021 at 09:01:23AM +0100, Geert Uytterhoeven wrote: > Hi Rob, > > On Tue, Feb 2, 2021 at 9:55 PM Rob Herring wrote: > > Properties in if/then schemas weren't getting checked by the meta-schemas. > > Enabling meta-schema checks finds several errors. > > > > The use of an 'items' schema (as opposed to the list form) is wrong in > > some cases as it applies to all entries. 'contains' is the correct schema > > to use in the case of multiple entries. > > > Signed-off-by: Rob Herring > > Thanks for your patch! > > > --- a/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml > > +++ b/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml > > @@ -81,9 +81,8 @@ properties: > > if: > > properties: > > compatible: > > - items: > > - enum: > > - - renesas,usb2-phy-r7s9210 > > + contains: > > + const: renesas,usb2-phy-r7s9210 > > Single entry, so "contains" not needed? No, you are misunderstanding how these work. 'contains' means at least one entry in an array passes with the subschema. In this case, 'renesas,usb2-phy-r7s9210' must appear somewhere in the 'compatible' values. (Before, it said *every* entry must be 'renesas,usb2-phy-r7s9210'.) As there is a fallback compatible, we need 'contains'. > > --- a/Documentation/devicetree/bindings/pinctrl/renesas,pfc.yaml > > +++ b/Documentation/devicetree/bindings/pinctrl/renesas,pfc.yaml > > @@ -76,11 +76,10 @@ required: > > if: > > properties: > > compatible: > > - items: > > - enum: > > - - renesas,pfc-r8a73a4 > > - - renesas,pfc-r8a7740 > > - - renesas,pfc-sh73a0 > > + enum: > > + - renesas,pfc-r8a73a4 > > + - renesas,pfc-r8a7740 > > + - renesas,pfc-sh73a0 > > Missing "contains"? No. In this case, 'compatible' is always a single entry, so no 'contains' needed (but would work). If compatible is one of these 3 strings, then the 'if' is true. The original way would actually work in this case (i.e. is valid json-schema), but we require 'items' to have a size (maxItems/minItems) in our meta-schema. Rob