LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Grant Likely <grant.likely@arm.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Rob Herring <robh@kernel.org>,
	Frank Rowand <frowand.list@gmail.com>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
	<devicetree@vger.kernel.org>,
	devicetree-spec@vger.kernel.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Linus Walleij <linus.walleij@linaro.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	Mark Brown <broonie@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Arnd Bergmann <arnd@arndb.de>, Stephen Boyd <sboyd@kernel.org>,
	Jonathan Cameron <jic23@kernel.org>
Subject: Re: [RFC PATCH] dt-bindings: add a jsonschema binding example
Date: Wed, 25 Apr 2018 11:15:43 +0100	[thread overview]
Message-ID: <3a4299cf-b737-8e74-2e9e-994f5943d006@arm.com> (raw)
In-Reply-To: <CAMuHMdU8q0VUxw-EXDqjjYbjeCwCkKuDJUjO0vSaCVrYLXqX4A@mail.gmail.com>

On 23/04/2018 17:49, Geert Uytterhoeven wrote:
> Hi Grant,
>
> On Mon, Apr 23, 2018 at 4:47 PM, Grant Likely <grant.likely@arm.com> wrote:
>> On 21/04/2018 02:28, Rob Herring wrote:
>>> On Fri, Apr 20, 2018 at 4:00 PM, Frank Rowand <frowand.list@gmail.com>
>>> wrote:
>>>>> +  interrupts:
>>>>> +    # Either 1 or 2 interrupts can be present
>>>>> +    minItems: 1
>>>>> +    maxItems: 2
>>>>> +    items:
>>>>> +      - description: tx or combined interrupt
>>>>> +      - description: rx interrupt
>>>>> +
>>>>> +    description: |
>>>>> +      A variable number of interrupts warrants a description of what
>>>>> conditions
>>>>> +      affect the number of interrupts. Otherwise, descriptions on
>>>>> standard
>>>>> +      properties are not necessary.
>>>>> +
>>>>> +  interrupt-names:
>>>>> +    # minItems must be specified here because the default would be 2
>>>>> +    minItems: 1
>>>>
>>>> Why the difference between the interrupts property and the
>>>> interrupt-names
>>>> property (specifying maxItems for interrupt, but not interrupt-names)?
>>>
>>> I should probably have maxItems here too.
>>>
>>>> Others have already commented on a desire to have a way to specify that
>>>> number of interrupts should match number of interrupt-names.
>>>
>>> Yeah, but I don't see a way to do that. You could stick the array size
>>> constraints in a common definition and have a $ref to that definition
>>> from both, but that doesn't really save you too much.
>>
>>
>> There has been discussions in the jsonschema community regarding
>> referencing data in the document when applying the schema.
>>
>> https://github.com/json-schema-org/json-schema-spec/issues/549
>>
>> However, those discussions are ongoing and have been pushed back to
>> after draft-8 (the current release is draft-7). We can instead define
>> DT-specific keywords and extend the validator to make it do what we
>> want. We need to do something very similar to validate that the length
>> of tuples in 'reg', 'interrupts', and '*gpios' match the '#*-cells' values.
>
> Checking that property lengths match the corresponding #*-cells cannot
> be done for a schema, but only for the final DTS, as #*-cells is a property
> of the target node, right?

It can be done in the schema checking of the target node. For example,
given a GPIO specifier of:

gpios = <&gpio1 0> <&gpio2 4 1> <&gpio2 3 0>;

The validation engine could validate that the &gpio1 and &gpio2 targets
have the same length as the associated gpio descriptor tuples. (ex.
gpio1 needs #gpio-cells=<1>; and gpio2 needs #gpio-cells=<2>; If the
tuples are the wrong size, then validation should fail.

g.
>
> Gr{oetje,eeting}s,
>
>                          Geert
>

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

  reply	other threads:[~2018-04-25 10:15 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-18 22:29 Rob Herring
2018-04-20 16:47 ` Stephen Boyd
2018-04-20 18:15   ` Rob Herring
2018-04-20 19:53     ` Frank Rowand
2018-04-20 23:41     ` Stephen Boyd
2018-04-21  1:34       ` Rob Herring
2018-04-23 14:01       ` Grant Likely
2018-04-23 14:38         ` Rob Herring
2018-04-23 14:49           ` Grant Likely
2018-04-20 16:59 ` Mark Brown
2018-04-20 18:47   ` Rob Herring
2018-04-20 21:00 ` Frank Rowand
2018-04-21  1:28   ` Rob Herring
2018-04-23  7:25     ` Geert Uytterhoeven
2018-04-23 14:47     ` Grant Likely
2018-04-23 16:49       ` Geert Uytterhoeven
2018-04-25 10:15         ` Grant Likely [this message]
2018-04-25  0:33     ` Frank Rowand
2018-11-14 19:39     ` jonsmirl
2018-11-15 23:42       ` Rob Herring
2018-11-16  1:34         ` jonsmirl
2018-04-20 21:47 ` Bjorn Andersson
2018-04-23 16:51   ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3a4299cf-b737-8e74-2e9e-994f5943d006@arm.com \
    --to=grant.likely@arm.com \
    --cc=arnd@arndb.de \
    --cc=bjorn.andersson@linaro.org \
    --cc=broonie@kernel.org \
    --cc=devicetree-spec@vger.kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=geert+renesas@glider.be \
    --cc=geert@linux-m68k.org \
    --cc=jic23@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=thierry.reding@gmail.com \
    --subject='Re: [RFC PATCH] dt-bindings: add a jsonschema binding example' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).