Commit Graph
13 Commits
Author SHA1 Message Date
Krzysztof Kozlowski 7a150b0d85 docs: dt: writing-schema: mention coding style
Mention the usage of YAML coding style.  Describe explicitly that
four-space indentation in DTS examples is preferred, because:
1. The YAML's default two-space indentation for DTS code makes it
   significantly less readable.
2. Linux coding style tabs would introduce inconsistency (entire file is
   indented with spaces).
3. On the other hand, eight spaces would not align with example's
   opening '  - |' part.  Four spaces makes the code nicely aligned with
   it.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Rob Herring <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
2022-04-04 19:55:03 -05:00
Krzysztof Kozlowski 418adabeb3 dt-bindings: example: Extend with typical case (int-array and disallowed prop)
Extend the example with:
 - an array where each element has constraints (min/max value),
 - property not allowed in case of different compatible.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Rob Herring <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
2022-02-24 09:55:56 -06:00
Simon Glass 37ef2c34e4 docs: dt: Fix a few grammar nits in the binding/schema docs
Add missing hyphens and reword one sentence for clarity.

Signed-off-by: Simon Glass <[email protected]>
Reviewed-by: Randy Dunlap <[email protected]>
Link: https://lore.kernel.org/r/20211003124936.1.Idc7beddc77250bca0cfb5912b56be719d9073bc4@changeid
Signed-off-by: Rob Herring <[email protected]>
2021-10-04 13:55:37 -05:00
Rob Herring 972d6a7dce dt-bindings: Drop redundant minItems/maxItems
If a property has an 'items' list, then a 'minItems' or 'maxItems' with the
same size as the list is redundant and can be dropped. Note that is DT
schema specific behavior and not standard json-schema behavior. The tooling
will fixup the final schema adding any unspecified minItems/maxItems.

This condition is partially checked with the meta-schema already, but
only if both 'minItems' and 'maxItems' are equal to the 'items' length.
An improved meta-schema is pending.

Cc: Jens Axboe <[email protected]>
Cc: Stephen Boyd <[email protected]>
Cc: Herbert Xu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: Bartosz Golaszewski <[email protected]>
Cc: Kamal Dasu <[email protected]>
Cc: Lars-Peter Clausen <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Marc Zyngier <[email protected]>
Cc: Joerg Roedel <[email protected]>
Cc: Mauro Carvalho Chehab <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Wolfgang Grandegger <[email protected]>
Cc: Andrew Lunn <[email protected]>
Cc: Vivien Didelot <[email protected]>
Cc: Vladimir Oltean <[email protected]>
Cc: Bjorn Helgaas <[email protected]>
Cc: Kishon Vijay Abraham I <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: "Uwe Kleine-König" <[email protected]>
Cc: Lee Jones <[email protected]>
Cc: Ohad Ben-Cohen <[email protected]>
Cc: Mathieu Poirier <[email protected]>
Cc: Paul Walmsley <[email protected]>
Cc: Palmer Dabbelt <[email protected]>
Cc: Albert Ou <[email protected]>
Cc: Alessandro Zummo <[email protected]>
Cc: Alexandre Belloni <[email protected]>
Cc: Zhang Rui <[email protected]>
Cc: Daniel Lezcano <[email protected]>
Cc: Wim Van Sebroeck <[email protected]>
Cc: Guenter Roeck <[email protected]>
Signed-off-by: Rob Herring <[email protected]>
Acked-by: Marc Kleine-Budde <[email protected]>
Acked-by: Ulf Hansson <[email protected]> # for MMC
Acked-by: Jassi Brar <[email protected]>
Acked-By: Vinod Koul <[email protected]>
Reviewed-by: Greg Kroah-Hartman <[email protected]>
Reviewed-by: Arnaud Pouliquen <[email protected]>
Acked-by: Mark Brown <[email protected]>
Acked-by: Philipp Zabel <[email protected]>
Acked-by: Wolfram Sang <[email protected]> # for I2C
Acked-by: Jonathan Cameron <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
2021-06-21 13:56:46 -06:00
Geert Uytterhoeven 873462adb0 dt-bindings: example: Grammar improvements
Improve grammar in recently added sentences:
  - Drop superfluous "be" in front of "have",
  - Add missing articles.

Fixes: 73f76a41c4 ("dt-bindings: example: Extend based on practice")
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Geert Uytterhoeven <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Rob Herring <[email protected]>
2020-09-29 15:32:53 -05:00
Krzysztof Kozlowski 73f76a41c4 dt-bindings: example: Extend based on practice
Extend the example schema with common rules which seems to be not that
obvious:
1. Expecting arrays of phandles to be always ordered, regardless if
   "xxx-names" is provided (e.g. clocks),
2. Add example of altering a property based on presence of other
   property,
3. Document usage of unevaluatedProperties.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Rob Herring <[email protected]>
2020-09-15 16:42:11 -06:00
Rob Herring f516fb704d dt-bindings: Whitespace clean-ups in schema files
Clean-up incorrect indentation, extra spaces, long lines, and missing
EOF newline in schema files. Most of the clean-ups are for list
indentation which should always be 2 spaces more than the preceding
keyword.

Found with yamllint (which I plan to integrate into the checks).

Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Acked-by: Sam Ravnborg <[email protected]>
Signed-off-by: Rob Herring <[email protected]>
2020-08-14 08:55:58 -06:00
Rob Herring 3d21a46093 dt-bindings: Remove cases of 'allOf' containing a '$ref'
json-schema versions draft7 and earlier have a weird behavior in that
any keywords combined with a '$ref' are ignored (silently). The correct
form was to put a '$ref' under an 'allOf'. This behavior is now changed
in the 2019-09 json-schema spec and '$ref' can be mixed with other
keywords. The json-schema library doesn't yet support this, but the
tooling now does a fixup for this and either way works.

This has been a constant source of review comments, so let's change this
treewide so everyone copies the simpler syntax.

Scripted with ruamel.yaml with some manual fixups. Some minor whitespace
changes from the script.

Signed-off-by: Rob Herring <[email protected]>
Acked-by: Maxime Ripard <[email protected]>
Acked-by: Lee Jones <[email protected]>
Acked-By: Vinod Koul <[email protected]>
Acked-by: Mark Brown <[email protected]>
Acked-by: Alexandre Belloni <[email protected]>
Acked-by: Wolfram Sang <[email protected]> # for I2C
Reviewed-by: Linus Walleij <[email protected]>
Acked-by: Jonathan Cameron <[email protected]> #for-iio
Reviewed-by: Stephen Boyd <[email protected]> # clock
Signed-off-by: Rob Herring <[email protected]>
2020-05-03 11:10:41 -05:00
Geert Uytterhoeven 238415f760 dt-bindings: example-schema: Drop double quotes around URLs
It is no longer needed to wrap URLs in double quotes.

Signed-off-by: Geert Uytterhoeven <[email protected]>
Signed-off-by: Rob Herring <[email protected]>
2020-02-26 09:35:57 -06:00
Rob Herring 2fa0a53059 dt-bindings: example-schema: Standard unit should be microvolt not microvolts
Even the DT maintainer gets confused. The schema in dt-schema was wrong
too, so this was passing validation until trying to add some common
incorrect patterns to check.

Fixes: 58fbe999ff ("dt-bindings: example-schema: Add some additional examples and commentary")
Signed-off-by: Rob Herring <[email protected]>
2019-11-11 11:21:58 -06:00
Rob Herring 58fbe999ff dt-bindings: example-schema: Add some additional examples and commentary
Add examples for properties with standard units, child nodes,
dependencies, and if/then schema. Also, make some minor updates based on
common questions and review issues.

Signed-off-by: Rob Herring <[email protected]>
2019-10-25 09:14:21 -05:00
Simon Horman 43c63c15bd dt-bindings: Correct spelling in example schema
Correct spelling of "identifier".

Signed-off-by: Simon Horman <[email protected]>
Reviewed-by: Geert Uytterhoeven <[email protected]>
Signed-off-by: Rob Herring <[email protected]>
2019-09-06 15:29:12 +01:00
Rob Herring 00ce8a8000 dt-bindings: Add a writing DT schemas how-to and annotated example
Add a how-to doc on writing DT schema documentation. This gives a
description of each section and details on how to validate the DT schema
file. The DT schema are written using json-schema vocabulary in a YAML
encoded document. Using jsonschema gives us access to existing tooling.
A YAML encoding gives us something easy to edit. The example is
annotated to help explain what each section does.

This example is just the tip of the iceberg, but is it the part most
developers writing bindings will interact with. Backing all this up
are meta-schema (to validate the binding schemas), some DT core schema,
YAML encoded DT output with dtc, and a small number of python scripts to
run validation.

Cc: Mark Rutland <[email protected]>
Cc: [email protected]
Signed-off-by: Rob Herring <[email protected]>
2018-12-13 09:41:49 -06:00