Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <krzysztof.kozlowski@linaro.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220403081849.8051-2-krzysztof.kozlowski@linaro.org

authored by

Krzysztof Kozlowski and committed by
Rob Herring
7a150b0d 44c8a51a

+13 -7
+7 -7
Documentation/devicetree/bindings/example-schema.yaml
··· 249 249 # be overridden or an appropriate parent bus node should be shown (such as on 250 250 # i2c buses). 251 251 # 252 - # Any includes used have to be explicitly included. 252 + # Any includes used have to be explicitly included. Use 4-space indentation. 253 253 - | 254 254 node@1000 { 255 - compatible = "vendor,soc4-ip", "vendor,soc1-ip"; 256 - reg = <0x1000 0x80>, 257 - <0x3000 0x80>; 258 - reg-names = "core", "aux"; 259 - interrupts = <10>; 260 - interrupt-controller; 255 + compatible = "vendor,soc4-ip", "vendor,soc1-ip"; 256 + reg = <0x1000 0x80>, 257 + <0x3000 0x80>; 258 + reg-names = "core", "aux"; 259 + interrupts = <10>; 260 + interrupt-controller; 261 261 };
+6
Documentation/devicetree/bindings/writing-schema.rst
··· 108 108 values a matrix (in order to define groupings) even when only a single value 109 109 is present. Single entries in schemas are fixed up to match this encoding. 110 110 111 + Coding style 112 + ------------ 113 + 114 + Use YAML coding style (two-space indentation). For DTS examples in the schema, 115 + preferred is four-space indentation. 116 + 111 117 Testing 112 118 ------- 113 119