Re: [PATCH v3] docs: dt-bindings: add DTS Coding Style document

From: Krzysztof Kozlowski
Date: Wed Nov 29 2023 - 05:16:44 EST


On 27/11/2023 15:19, Geert Uytterhoeven wrote:
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/dts-coding-style.rst
>
>> + /* SoC DTSI */
>> +
>> + / {
>> + cpus {
>> + /* ... */
>> + };
>> +
>> + psci {
>> + /* ... */
>> + };
>> +
>> + soc@ {
>
> "soc@" is invalid, that should be "soc".

soc@0 is valid.

>
> As the "soc" node is special, you may want to elaborate:
>
> compatible = "simple-bus";
> #address-cells = <1>;
> #size-cells = <1>;
> ranges;

but then we go to missing address/size cells in root node. Your comment
is in general correct, but what you propose here is not a coding style,
but DTS correctness and I only wanted to show the order of nodes. dtc
already enforces the proper unit addresses, ranges and cells.

>
>> + dma: dma-controller@10000 {
>> + /* ... */
>> + };
>> +
>> + clk: clock-controller@80000 {
>> + /* ... */
>> + };
>> + };
>> + };
>> +
>> + /* Board DTS - alphabetical order */
>> +
>> + &clk {
>> + /* ... */
>> + };
>> +
>> + &dma {
>> + /* ... */
>> + };
>> +
>> + /* Board DTS - alternative order, keep as DTSI */
>> +
>> + &dma {
>> + /* ... */
>> + };
>> +
>> + &clk {
>> + /* ... */
>> + };
>
> IMO that alternative order is hard to review: you need to have multiple
> files open. It will also make validation hard, as you can only validate
> the end result, not individual files.

Rob commented on this - tools (will) solve the issue. :)

>
> Anyway, this is already quite usable so
> Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
>
> Gr{oetje,eeting}s,
>
> Geert
>

Best regards,
Krzysztof