Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7056413rwb; Mon, 12 Dec 2022 09:29:48 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Un6D/tUeLs0gEldGk12I0lVLiRaKnx8sdy/g1R6nekF+Dxq8rA77ELTjg+DMfSajhfdcx X-Received: by 2002:a05:6402:25c5:b0:467:6e86:e963 with SMTP id x5-20020a05640225c500b004676e86e963mr15054458edb.38.1670866188400; Mon, 12 Dec 2022 09:29:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670866188; cv=none; d=google.com; s=arc-20160816; b=hgo85369ZZzLiH58dXrB/3Yz5tZSdP+S1U/ApJJfywMFEf09NHELmbUCKXDSn3bXoO AMvxGem+28Kx1myQ5ZV48a+UUX/vA/5A6SdM3ZWFRff05ooS7AwZOklNpocOyBsF6fRG IHvdWzB1NxzT0b/mEHrVUyNyskYe7Xp461th1//+qsv8AlLfFXATA2zwCTW5B8rjFjls f21FLEx1jNUqZ11WnS0HvVcStF0Oh9mUaFyR/fj1aPx41q/1qV+ImG0lQn0728nvMhwy vo/F39rTem0glidJSKLVglWVjWLlnVrXks98qUvOKt8Jyx3z5BWdh4b9R/vtB3HzAItu cpDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=fw+FQfUWqgrmWhnQ5tTZXz7tACC4Nbw/x4d/Z5/ycXo=; b=mCCBOeyHfEnNl3R33h/MwAdnG4ttND2e35YGDsiBD+DwxFAFyxS6HsC7v9LpZcwSRt 7lqy9F+PHa9GhSmAFUocuH92XpSMk0k6180tq9/Ft32Sqzpcb4UoQ+nKICyoVcWxqTWP blF2vVvEtqCxXxFN1F3SRPgKHOE6OFcSnWCkqA6EeNCwpUTcdD58QsSGOyA52ICcI6Xp 33JGCjS9Qdx166e2Rl9bqu0tWF9KeQEAeKACzbdNLcyUdE5XQuXzfi+XRiYZvW94cZOT b1FJ4NoyMG8yGj7O86bw+Q8gBwELEkSE+tNHZreJM3ULbDDrhxNZbruMiGNNqn0+3SYI oozA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v19-20020a50a453000000b00461a7bb34c2si7413536edb.473.2022.12.12.09.29.26; Mon, 12 Dec 2022 09:29:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232450AbiLLQvw (ORCPT + 74 others); Mon, 12 Dec 2022 11:51:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229827AbiLLQvv (ORCPT ); Mon, 12 Dec 2022 11:51:51 -0500 Received: from mail-oo1-f46.google.com (mail-oo1-f46.google.com [209.85.161.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76E71FCFA; Mon, 12 Dec 2022 08:51:50 -0800 (PST) Received: by mail-oo1-f46.google.com with SMTP id f7-20020a4a8907000000b004a0cb08d0afso1879988ooi.8; Mon, 12 Dec 2022 08:51:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=fw+FQfUWqgrmWhnQ5tTZXz7tACC4Nbw/x4d/Z5/ycXo=; b=Vm1rEgU3ayyJODFbZftmIYCPLyed6KvRgHwtAjDiQcKkG7EG1CdSI0K0dRUPLXxdb1 hkkEuHXGpaovMynAspbzPhe/cC5xQtIkuNe99BxzOpZ7FJKryzhUMxc8O29T8XcfbAPJ ZCQs5eJCLQ5QSGgby6yF8sLxz8Ns16TAVX4dnsLa01A9aY4NDPBCVfh8JbLpIKSNGRnH FhwkFWmM4NMQD6E61gatBrABtZMRkbrtyOBzz5E1gwynrN9NwX6orYgmfzmj01aumNZm gos0j4VOppvviHNiKtpZBZHlTO3jw9+NnKeGYe/PpuFcmwGxnI9PZ43xC0w7gedyiBlX RfjA== X-Gm-Message-State: ANoB5pl0Vq8mUcgb2DRSYZB1XYvvb2oCf2vaEOHUZqgNaOiV+gMR79Pb RGq4ZRwWPKuJBrkTgPS4tQ== X-Received: by 2002:a4a:e247:0:b0:49f:dba7:5e65 with SMTP id c7-20020a4ae247000000b0049fdba75e65mr6556517oot.3.1670863909584; Mon, 12 Dec 2022 08:51:49 -0800 (PST) Received: from robh_at_kernel.org (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id s21-20020a4ac815000000b004a0aac2d28fsm97397ooq.35.2022.12.12.08.51.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Dec 2022 08:51:49 -0800 (PST) Received: (nullmailer pid 1116541 invoked by uid 1000); Mon, 12 Dec 2022 16:51:47 -0000 Date: Mon, 12 Dec 2022 10:51:47 -0600 From: Rob Herring To: =?utf-8?B?QXLEsW7DpyDDnE5BTA==?= Cc: Colin Foster , linux-renesas-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, netdev@vger.kernel.org, John Crispin , Alexandre Belloni , Claudiu Manoil , Marek Vasut , Sean Wang , DENG Qingfang , Landen Chao , Vivien Didelot , =?UTF-8?B?Q2zDqW1lbnQgTMOpZ2Vy?= , =?UTF-8?Q?Alvin_=C5=A0ipraga?= , Linus Walleij , UNGLinuxDriver@microchip.com, Woojung Huh , Matthias Brugger , Kurt Kanzenbach , Krzysztof Kozlowski , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Vladimir Oltean , Florian Fainelli , Andrew Lunn , George McCollister Subject: Re: [PATCH v5 net-next 04/10] dt-bindings: net: dsa: utilize base definitions for standard dsa switches Message-ID: <20221212165147.GA1092706-robh@kernel.org> References: <20221210033033.662553-1-colin.foster@in-advantage.com> <20221210033033.662553-5-colin.foster@in-advantage.com> <1df417b5-a924-33d4-a302-eb526f7124b4@arinc9.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 12, 2022 at 12:28:06PM +0300, Arınç ÜNAL wrote: > On 10.12.2022 21:02, Colin Foster wrote: > > Hi Arınç, > > On Sat, Dec 10, 2022 at 07:24:42PM +0300, Arınç ÜNAL wrote: > > > On 10.12.2022 06:30, Colin Foster wrote: > > > > DSA a/Documentation/devicetree/bindings/net/dsa/dsa.yaml > > > > +++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml > > > > @@ -58,4 +58,26 @@ oneOf: > > > > additionalProperties: true > > > > +$defs: > > > > + ethernet-ports: > > > > + description: A DSA switch without any extra port properties > > > > + $ref: '#/' > > > > + > > > > + patternProperties: > > > > + "^(ethernet-)?ports$": > > > > + type: object > > > > + additionalProperties: false > > > > + > > > > + properties: > > > > + '#address-cells': > > > > + const: 1 > > > > + '#size-cells': > > > > + const: 0 > > > > + > > > > + patternProperties: > > > > + "^(ethernet-)?port@[0-9]+$": > > > > + description: Ethernet switch ports > > > > + $ref: dsa-port.yaml# > > > > + unevaluatedProperties: false > > > > > > I've got moderate experience in json-schema but shouldn't you put 'type: > > > object' here like you did for "^(ethernet-)?ports$"? > > > > I can't say for sure, but adding "type: object" here and removing it > > from mediatek,mt7530.yaml still causes the same issue I mention below. > > > > Rob's initial suggestion for this patch set (which was basically the > > entire implementation... many thanks again Rob) can be found here: > > https://lore.kernel.org/netdev/20221104200212.GA2315642-robh@kernel.org/ > > > > From what I can tell, the omission of "type: object" here was > > intentional. At the very least, it doesn't seem to have any effect on > > warnings. > > > > > > > > > + > > > > ... > > > > diff --git a/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml b/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml > > > > index 73b774eadd0b..748ef9983ce2 100644 > > > > --- a/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml > > > > +++ b/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml > > > > @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# > > > > title: Hirschmann Hellcreek TSN Switch Device Tree Bindings > > > > allOf: > > > > - - $ref: dsa.yaml# > > > > + - $ref: dsa.yaml#/$defs/ethernet-ports > > > > maintainers: > > > > - Andrew Lunn > > > > diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml > > > > index f2e9ff3f580b..20312f5d1944 100644 > > > > --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml > > > > +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml > > > > @@ -157,9 +157,6 @@ patternProperties: > > > > patternProperties: > > > > "^(ethernet-)?port@[0-9]+$": > > > > type: object > > > > > > This line was being removed on the previous version. Must be related to > > > above. > > > > Without the 'object' type here, I get the following warning: > > > > Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml: patternProperties:^(ethernet-)?ports$:patternProperties:^(ethernet-)?port@[0-9]+$: 'anyOf' conditional failed, one must be fixed: > > 'type' is a required property > > '$ref' is a required property > > hint: node schemas must have a type or $ref > > from schema $id: http://devicetree.org/meta-schemas/core.yaml# > > ./Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml: Error in referenced schema matching $id: http://devicetree.org/schemas/net/dsa/mediatek,mt7530.yaml > > SCHEMA Documentation/devicetree/bindings/processed-schema.json > > /home/colin/src/work/linux_vsc/linux-imx/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml: ignoring, error in schema: patternProperties: ^(ethernet-)?ports$: patternProperties: ^(ethernet-)?port@[0-9]+$ Is the above warning not clear? We require either 'type' or a $ref to define nodes as json-schema objects. > > I'm testing this now and I'm noticing something is going on with the > > "ref: dsa-port.yaml" > > > > > > Everything seems to work fine (in that I don't see any warnings) when I > > have this diff: > > > > > > diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml > > index 20312f5d1944..db0122020f98 100644 > > --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml > > +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yam > > @@ -156,8 +156,7 @@ patternProperties: > > > > patternProperties: > > "^(ethernet-)?port@[0-9]+$": > > - type: object > > - > > + $ref: dsa-port.yaml# > > properties: > > reg: > > description: > > @@ -165,7 +164,6 @@ patternProperties: > > for user ports. > > > > allOf: > > - - $ref: dsa-port.yaml# > > - if: > > required: [ ethernet ] > > then: > > > > > > > > This one has me [still] scratching my head... > > Right there with you. In addition to this, having or deleting type object > on/from "^(ethernet-)?ports$" and "^(ethernet-)?port@[0-9]+$" on dsa.yaml > doesn't cause any warnings (checked with make dt_binding_check > DT_SCHEMA_FILES=net/dsa) which makes me question why it's there in the first > place. That check probably doesn't consider an ref being under an 'allOf'. Perhaps what is missing in understanding is every schema at the top-level has an implicit 'type: object'. But nothing is ever implicit in json-schema which will silently ignore keywords which don't make sense for an instance type. Instead of a bunch of boilerplate, the processed schema has 'type' added in lots of cases such as this one. Rob