LKML Archive on lore.kernel.org
 help / color / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: Rob Herring <robh@kernel.org>
Cc: devicetree@vger.kernel.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Michael Turquette <mturquette@baylibre.com>,
	linux-clk <linux-clk@vger.kernel.org>
Subject: Re: [PATCH] dt-bindings: clock: Convert fixed-clock binding to json-schema
Date: Fri, 11 Jan 2019 10:54:00 -0800
Message-ID: <154723284041.169631.6622751321828044091@swboyd.mtv.corp.google.com> (raw)
In-Reply-To: <CAL_JsqJzNBYCMWbZtR37eZd4yx2kc590V+q3603Hg=kG2bZwhw@mail.gmail.com>

Quoting Rob Herring (2019-01-11 10:27:48)
> On Fri, Jan 11, 2019 at 11:44 AM Stephen Boyd <sboyd@kernel.org> wrote:
> >
> > Quoting Rob Herring (2019-01-10 14:19:01)
> > > Convert the fixed-clock binding to DT schema format using json-schema.
> > >
> >
> > Any pointer to the full schema?
> 
> https://github.com/robherring/yaml-bindings/blob/master/schemas/
> 
> And the clock schema in particular:
> https://github.com/robherring/yaml-bindings/blob/master/schemas/clock.yaml

Awesome. Thanks for the pointers! Is the clock schema posted to the list
somewhere?

> 
> > > Cc: Michael Turquette <mturquette@baylibre.com>
> > > Cc: Stephen Boyd <sboyd@kernel.org>
> > > Cc: linux-clk@vger.kernel.org
> > > Signed-off-by: Rob Herring <robh@kernel.org>
> > [...]
> > > diff --git a/Documentation/devicetree/bindings/clock/fixed-clock.yaml b/Documentation/devicetree/bindings/clock/fixed-clock.yaml
> > > new file mode 100644
> > > index 000000000000..8b5628463b90
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/clock/fixed-clock.yaml
> > > @@ -0,0 +1,44 @@
> > > +# SPDX-License-Identifier: GPL-2.0
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/clock/fixed-clock.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: Binding for simple fixed-rate clock sources.
> >
> > Why does title have a full stop?
> 
> Because it was there in the original. My script to extract just takes
> the first line of alphanumeric text.

Ok. I think it would be good to treat them like commit subjects that
don't have the full stop either, so if the script is able to drop the
full stop it would be great.

> 
> > > +
> > > +maintainers:
> > > +  - Michael Turquette <mturquette@baylibre.com>
> > > +  - Stephen Boyd <sboyd@kernel.org>
> > > +
> > > +properties:
> > > +  compatible:
> > > +    const: fixed-clock
> > > +
> > > +  "#clock-cells":
> > > +    const: 0
> > > +
> > > +  clock-frequency: true
> >
> > Why doesn't this need the $ref: /schemas/types.yaml#/... thing?
> 
> You might want to read bindings/example-schema.yaml which tries to
> explain some of this.
> 
> Standard properties are already defined in the core schemas. So we
> only have to say "we use this property" and any binding specific
> constraints. In this case, there aren't any other constraints. It is
> also needed to be listed here to mark it required and to satisfy
> 'additionalProperties: false'.

Hmm ok. I suppose I'll have to hold that information in my mind when
reviewing bindings. Is there any tooling or some script that I can run
on json-schema bindings to verify they're correct? Or to find something
redundant like this where a standard property is redefined? Grep would
work for the redundant problem I suppose.

> 
> > > +  clock-accuracy:
> > > +    description: accuracy of clock in ppb (parts per billion).
> > > +    $ref: /schemas/types.yaml#/definitions/uint32
> > > +
> > > +  clock-output-names:
> > > +    maxItems: 1
> >
> > Is there a schema for strings?
> 
> Yes. The core already covers that '*-names' properties are a list of
> strings. So no need to do that again here and we just need to define
> how many strings are valid.

Alright. Thanks for the explanations.

> 
> > > +
> > > +required:
> > > +  - compatible
> > > +  - "#clock-cells"
> > > +  - clock-frequency
> > > +
> > > +additionalProperties: false
> >
> > Does this always have to be specified even if it's false?
> 
> Yes, the default defined as true by the json-schema spec. In some
> cases we don't want to specify it.
> 
> > > +
> > > +examples:
> > > +  - |
> > > +    clock {
> > > +      compatible = "fixed-clock";
> > > +      #clock-cells = <0>;
> > > +      clock-frequency = <1000000000>;
> > > +      clock-accuracy = <100>;
> > > +    };
> > > +...
> > >
> >
> > Is the triple dot part of the schema?
> 
> Yes. Well, it is part of YAML. It's optional really as are the 2 lines
> at the start. It's just good hygiene.
> 

Sounds good.


  reply index

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-10 22:19 Rob Herring
2019-01-11 17:44 ` Stephen Boyd
2019-01-11 18:27   ` Rob Herring
2019-01-11 18:54     ` Stephen Boyd [this message]
2019-01-11 20:49       ` Rob Herring
2019-01-11 22:42         ` Stephen Boyd
2019-01-11 23:09           ` Rob Herring
2019-01-24 22:50             ` Stephen Boyd

Reply instructions:

You may reply publically 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=154723284041.169631.6622751321828044091@swboyd.mtv.corp.google.com \
    --to=sboyd@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=robh@kernel.org \
    /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

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org linux-kernel@archiver.kernel.org
	public-inbox-index lkml


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox