Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp944629rwb; Thu, 1 Dec 2022 10:14:08 -0800 (PST) X-Google-Smtp-Source: AA0mqf4HOeQWfUnbQLTGNiw3vZhwsfXLnGh4vmiemBt0vXrWWIveLQNCdbCRzslbmxTch9vGw+Yt X-Received: by 2002:a17:907:cf84:b0:78d:4795:ff1f with SMTP id ux4-20020a170907cf8400b0078d4795ff1fmr11330930ejc.331.1669918448543; Thu, 01 Dec 2022 10:14:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669918448; cv=none; d=google.com; s=arc-20160816; b=pro/v1nUn4Y1MMbQ9O9u8J2MvPnGEZtCWpbNTD6pMHqj0rBWNc63MkeDl4lFxNZZtQ qOUPitfoxrlL6gi8pIu0dUZF7OqlWspy8qqFm0gj3H7GAWbs8MV/rEA7JlgVeqcKcvDU hd3gwTlu+d9SOoov86fEaBTVKlRvb79dFj8maL0QPqXsQY5e+xfsCIAWfXlDeMItIR/v cAEAIRw36zOLpPc2nR3hxCd7Bs/A4BfrkJheEEjZnbf+ijLYwMadfUg8NaM+7+TGi/+B jCXaWm+qKa7rKeSb8xQ0FZX02xgFY/mrGcrlUlOeLhy6S5MH2E3KbPS4aRO69WFauwQI D+dQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=P5hJGWMRYOS9WP3cnmaxShGuogXWZGmPZS0+L5jgKPk=; b=g1cEIfp0uJnoaYtCZZeQ5HCQLq5WeBCHaAyQx4S/xBPljXjmKoz3B5arqRbJiSPQ0H 2HkDL0669nbPdo3de777X8RTTIb2pcfX38irgS1mGL4stCbwujiMkpOHL39kyex7oVLx f3d4LFpwWRAx3vGgsRib3gO8UQuStTX+ueBbgnEfuxoSS4OCvaDrzEVcxpH0f5J0qnbW hv/zWIdPY+ZOJQFOtBbXyUfPZnMcCdE7vBnOyxT/8UJ/bDgS4/VmJYK2//sPpe5743OK z9pYHu+Cu/RqakTF3vhRheVVVoCl+Rr/+OY0UiTbGgu6It4Hp3MNKrheMwPSipU0kc0B biNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="NI/gXF8N"; 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 wu9-20020a170906eec900b007a4feae7adfsi791198ejb.565.2022.12.01.10.13.48; Thu, 01 Dec 2022 10:14:08 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="NI/gXF8N"; 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 S229951AbiLASLU (ORCPT + 82 others); Thu, 1 Dec 2022 13:11:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229669AbiLASLI (ORCPT ); Thu, 1 Dec 2022 13:11:08 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B716EB71ED; Thu, 1 Dec 2022 10:11:06 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id 6F8E8B81FD1; Thu, 1 Dec 2022 18:11:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 124E4C433C1; Thu, 1 Dec 2022 18:11:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669918264; bh=abbxDko8xxIgN43TGD7PjO4ktuR8obKuUDRggHGcGh0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=NI/gXF8N4bqL1rTkyPrfaWjTUpOEpjbrOjVnuEaPhoxgbEubRQpcGpo04jTvM5/g/ nYelXUZzhXZOxzxn6B3J83OmdNeC2L5pk5uaiENG585sFVUIKWKPwO09SDgzWBuIF0 r+hHQy9tLY2C3OYdp1eBljCI4oJBDDaUp/lXVOg3Du61yaGPDVwMg+4Noc1NBaYhx8 WcB9LdbpH3HOgHbe5vBWw8YFl3enrHm1QWrBgI0FhmrmfwpYQP7pBgGFwwUKLMIKm/ L0vopg3IjCpPQw8tcsXPJE9p8iQga7Eumwek9LmzeoK1EjJDIJKPhDKfmHIrgT8Dk8 cD4YByX/98U0w== Received: by mail-ua1-f45.google.com with SMTP id n9so866397uao.13; Thu, 01 Dec 2022 10:11:04 -0800 (PST) X-Gm-Message-State: ANoB5pnBgr0vBOV0CO0ez6+vq/L2k8CWyzAUtMqvW3lW2SvzlnJL2Uxx OxNIBsnFSUswqtJgECKYqIVnE0Euk2Da5M7Gqw== X-Received: by 2002:a05:6130:83:b0:418:b849:8187 with SMTP id x3-20020a056130008300b00418b8498187mr41149171uaf.43.1669918262913; Thu, 01 Dec 2022 10:11:02 -0800 (PST) MIME-Version: 1.0 References: <20221125202008.64595-1-samuel@sholland.org> <20221125202008.64595-3-samuel@sholland.org> <5b05317d-28cc-bfc8-f415-e6acf453dc7c@linaro.org> <20221126142735.47dcca6d@slackpad.lan> <99c3e666-ec26-07a0-be40-0177dd449d84@linaro.org> <20221201034557.GA2998157-robh@kernel.org> In-Reply-To: <20221201034557.GA2998157-robh@kernel.org> From: Rob Herring Date: Thu, 1 Dec 2022 12:10:49 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/3] dt-bindings: net: sun8i-emac: Fix snps,dwmac.yaml inheritance To: Krzysztof Kozlowski , Andre Przywara , Samuel Holland Cc: Chen-Yu Tsai , Jernej Skrabec , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Krzysztof Kozlowski , LABBE Corentin , Maxime Ripard , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev, netdev@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 Wed, Nov 30, 2022 at 9:45 PM Rob Herring wrote: > > On Sat, Nov 26, 2022 at 03:48:33PM +0100, Krzysztof Kozlowski wrote: > > On 26/11/2022 15:28, Andre Przywara wrote: > > > On Sat, 26 Nov 2022 14:26:25 +0100 > > > Krzysztof Kozlowski wrote: > > > > > > Hi, > > > > > >> On 25/11/2022 21:20, Samuel Holland wrote: > > >>> The sun8i-emac binding extends snps,dwmac.yaml, and should accept all > > >>> properties defined there, including "mdio", "resets", and "reset-names". > > >>> However, validation currently fails for these properties because the > > >> > > >> validation does not fail: > > >> make dt_binding_check -> no problems > > >> > > >> Maybe you meant that DTS do not pass dtbs_check? > > > > > > Yes, that's what he meant: If a board actually doesn't have Ethernet > > > configured, dt-validate complains. I saw this before, but didn't find > > > any solution. > > > An example is: $ dt-validate ... sun50i-a64-pinephone-1.2.dtb > > > arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.2.dtb: > > > ethernet@1c30000: Unevaluated properties are not allowed ('resets', 'reset-names', 'mdio' were unexpected) > > > From schema: Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml > > > > > > Why exactly is beyond me, but this patch removes this message. > > > > I don't think this should be fixed like this. That's the problem of > > dtschema (not ignoring fully disabled nodes) and such patch only moves > > from one correct syntax to another correct syntax, which fixes dtschema > > problem, but changes nothing here. > > Humm, it looks to me like the 'phy-mode' required in snps,dwmac.yaml > causes the problem, but I can't get a minimized example to fail. > Something in 'required' shouldn't matter. Definitely seems like an issue > in the jsonschema package. I'll keep looking at it. TLDR: A fix in dtschema for this will be in place soon. I've simplified this down to: { "$schema": "https://json-schema.org/draft/2019-09/schema", "unevaluatedProperties": false, "allOf":[ { "properties": { "foo": true, "bar": true }, "required": [ "foo" ] } ] } An instance { "bar": 1 } will fail due to the 'required' failing. When you have a subschema (what's under 'allOf'), then it all has to pass to be 'evaluated'. This seems inconsistent to me, but the json-schema folks say it is operating as intended. I've got 2 possible fixes. One is to just ignore unevaluatedProperties errors on disabled nodes like is already done for 'required'. This means disabled nodes can have any unknown property or child node added which isn't great. The other way overrides 'required' validation to always pass on disabled nodes. This would be better, but there are some exceptions we need to still fail. 'oneOf' with N entries of 'required' to say 1 of N properties must be present for example. Excluding each one of these cases will be fragile, so probably going with the first fix. Rob