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

From: Konrad Dybcio
Date: Fri Nov 17 2023 - 18:53:51 EST


On 16.11.2023 19:12, Krzysztof Kozlowski wrote:
> Document preferred coding style for Devicetree sources (DTS and DTSI),
> to bring consistency among all (sub)architectures and ease in reviews.
>
> Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>
> Cc: Arnd Bergmann <arnd@xxxxxxxx>
> Cc: Bjorn Andersson <andersson@xxxxxxxxxx>
> Cc: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
> Cc: Heiko Stuebner <heiko@xxxxxxxxx>
> Cc: Konrad Dybcio <konrad.dybcio@xxxxxxxxxx>
> Cc: Matthias Brugger <matthias.bgg@xxxxxxxxx>
> Cc: Michal Simek <michal.simek@xxxxxxx>
> Cc: Neil Armstrong <neil.armstrong@xxxxxxxxxx>
> Cc: Nishanth Menon <nm@xxxxxx>
> Cc: Olof Johansson <olof@xxxxxxxxx>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
>
> ---
[...]

> +Order of Nodes
> +--------------
> +
> +1. Nodes within any bus, thus using unit addresses for children, shall be
> + ordered incrementally by unit address.
> +
> +2. Nodes without unit addresses should be ordered alpha-numerically.
I largely agree with all this given our fight for some level of
tidyness across linux-msm, but there's one specific case where I think
it would make sense to break this ordering, and that's GPIO states:


&pinctrl {
xyz-active-state {
pins ="gpio0";
...
};

abc-active-state {
pins ="gpio1";
...
};

qwe-active-state {
pins ="gpio2";
...
};
};

looks so much more readable to me than

&pinctrl {
abc-active-state {
pins ="gpio1";
...
};

qwe-active-state {
pins ="gpio2";
...
};

xyz-active-state {
pins ="gpio0";
...
};
};

Konrad