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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F10AC6FA89 for ; Thu, 8 Sep 2022 16:05:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231501AbiIHQFz (ORCPT ); Thu, 8 Sep 2022 12:05:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231676AbiIHQFy (ORCPT ); Thu, 8 Sep 2022 12:05:54 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 048B3B2D9B for ; Thu, 8 Sep 2022 09:05:52 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id i26so12772777lfp.11 for ; Thu, 08 Sep 2022 09:05:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date; bh=jAEzEWGfThUgGqQnHMOL1f5To09yVbEuEWo/Ad2g1YE=; b=c/Ng0z6ssSxi+cpYifD3Vfr1VP3RANTiQEUR6gMXz5q7H52V/1QlW79+sQxsIsnigc ko+17v26gBwHYzcLiMjPH2aeVRBIJDBsQCgekYeDxDc8yQjoMJJnetu0CXNni8QVpQAf aPxxKuLWxU4TG2mZbhutLQV1TAFVwbZDs7ZFnLI2vob89qKTzWOYITOUKDPfhnySnsgA 6FxC/bofZVHS8qp3Ae+yiikz+7+OMxW5p2gg7qtot7Xw4JADqKB4J63ijWi8A26ndVVa zIj6435QZQdKw4GcFpwHOYXSaK1Aexsw58IdCoCqwhrYXC0eAhLxkRBsUV4QZnQV8lpU CVVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=jAEzEWGfThUgGqQnHMOL1f5To09yVbEuEWo/Ad2g1YE=; b=aA4kwITeYI4svFKYrACFOe6+YqK0f658ZNqeXnxR3/JSsPStKU3f8SEtvG7a7iijTk TOTUkXEL/g1FBxBnwCU3WLGKgjG2M+lFsv5k9E5VCmmIm2LZ+l+nR55Sees9SHyd/YcY +W0FW9FMoFJyO6A9huV4hkernMAE+3jBT85jG1LhqTp03wC5TcHwfzCUOJtjw2G6kl1Q TtTHNRW1V8m/GwRKbA5yghm5QhSRfTb6ypouxOTQglv4eAYlYGXdJ2Oya7cDVeVUjM9T /ZUVoP+3Lm3JIM8rwzlr5tXLCDUAikJ5A+hUjs+5uyPBonyy6C27t/H1jPg91l7ud2xu TB4Q== X-Gm-Message-State: ACgBeo1adFWYuUJxaJdC6QY5W9UZalTmQMfXmNTheE1C4ENuUNhnD2G8 OQaDoJ43YdZI6hCWMh/D/9jh+TRpar7vEA== X-Google-Smtp-Source: AA6agR6wR8uJbmz0AnOAI2ki1zJ4q03Vfc9sBBd2mOdp+EOPC5CGqg0mWL2FdJ3CzGHLAyt4QEZvEA== X-Received: by 2002:a05:6512:3765:b0:492:d076:9f77 with SMTP id z5-20020a056512376500b00492d0769f77mr2761185lft.247.1662653149752; Thu, 08 Sep 2022 09:05:49 -0700 (PDT) Received: from [192.168.0.21] (78-11-189-27.static.ip.netia.com.pl. [78.11.189.27]) by smtp.gmail.com with ESMTPSA id k14-20020ac257ce000000b00490b5f09973sm241752lfo.92.2022.09.08.09.05.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Sep 2022 09:05:48 -0700 (PDT) Message-ID: <17d142eb-80c1-0aa5-c4fa-a8e4ccd97f08@linaro.org> Date: Thu, 8 Sep 2022 18:05:47 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Subject: Re: [PATCH v2 05/13] dt-bindings: serial: atmel,at91-usart: convert to json-schema Content-Language: en-US To: Sergiu.Moga@microchip.com, lee@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, Nicolas.Ferre@microchip.com, alexandre.belloni@bootlin.com, Claudiu.Beznea@microchip.com, richard.genoud@gmail.com, radu_nicolae.pirea@upb.ro, gregkh@linuxfoundation.org, broonie@kernel.org, mturquette@baylibre.com, sboyd@kernel.org, jirislaby@kernel.org, admin@hifiphile.com, Kavyasree.Kotagiri@microchip.com, Tudor.Ambarus@microchip.com Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-serial@vger.kernel.org, linux-clk@vger.kernel.org References: <20220906135511.144725-1-sergiu.moga@microchip.com> <20220906135511.144725-6-sergiu.moga@microchip.com> <1d3904d9-7fec-2e61-f999-61b89c4becb6@linaro.org> <753d73d0-44b9-9fba-1ed8-53691ecf2ee7@microchip.com> From: Krzysztof Kozlowski In-Reply-To: <753d73d0-44b9-9fba-1ed8-53691ecf2ee7@microchip.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On 08/09/2022 17:27, Sergiu.Moga@microchip.com wrote: > On 08.09.2022 18:10, Krzysztof Kozlowski wrote: >> On 08/09/2022 17:06, Sergiu.Moga@microchip.com wrote: >>> On 08.09.2022 15:29, Krzysztof Kozlowski wrote: >> >>>>> +required: >>>>> + - compatible >>>>> + - reg >>>>> + - interrupts >>>>> + - clock-names >>>>> + - clocks >>>>> + >>>>> +allOf: >>>>> + - if: >>>>> + properties: >>>>> + $nodename: >>>>> + pattern: "^serial@[0-9a-f]+$" >>>> >>>> You should rather check value of atmel,usart-mode, because now you won't >>>> properly match device nodes called "foobar". Since usart-mode has only >>>> two possible values, this will nicely simplify you if-else. >>>> >>>> >>> >>> >>> I did think of that but the previous binding specifies that >>> atmel,usart-mode is required only for the SPI mode and it is optional >>> for the USART mode. That is why I went for the node's regex since I >>> thought it is something that both nodes would have. >> >> I think it should be explicit - you configure node either to this or >> that, so the property should be always present. > > > > No DT of ours has that property atm, since they are all on USART mode by > default. If I were to make it required. all nodes would fail so I would > have to add it to each of them. Which is a problem because...? Have in mind that bindings can be changed. ABI here won't be broken. > > > > >> The node name should not >> be responsible for it, even though we want node names to match certain >> patterns. >> > > > Does checkig for the node's pattern not make it better then? Since it > imposes an additional check? Not really, because if it is "foobar" your schema would not be applied correctly. > If it would not have a conventional > pattern, it would fail through unevaluatedProperies:false at the end, > since it would have properties that were contained inside a branch that > the validation of the node would not have gone through since it contains > a pattern that does not match the conditions of that branch. Not for properties which are for example missing... Best regards, Krzysztof