[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9237db9f-0d80-4ae1-88e8-ea7c53bd0c8b@linaro.org>
Date: Mon, 20 Nov 2023 08:16:04 +0100
From: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To: Geert Uytterhoeven <geert@...ux-m68k.org>
Cc: Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>,
Arnd Bergmann <arnd@...db.de>,
Bjorn Andersson <andersson@...nel.org>,
Heiko Stuebner <heiko@...ech.de>,
Konrad Dybcio <konrad.dybcio@...aro.org>,
Matthias Brugger <matthias.bgg@...il.com>,
Michal Simek <michal.simek@....com>,
Neil Armstrong <neil.armstrong@...aro.org>,
Nishanth Menon <nm@...com>, Olof Johansson <olof@...om.net>
Subject: Re: [PATCH] docs: dt-bindings: add DTS Coding Style document
On 16/11/2023 22:32, Geert Uytterhoeven wrote:
> Hi Krzysztof,
>
> On Thu, Nov 16, 2023 at 7:12 PM Krzysztof Kozlowski
> <krzysztof.kozlowski@...aro.org> wrote>
>> Document preferred coding style for Devicetree sources (DTS and DTSI),
>> to bring consistency among all (sub)architectures and ease in reviews.
>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
>
> Thanks for your patch!
>
>> --- a/Documentation/devicetree/bindings/index.rst
>> +++ b/Documentation/devicetree/bindings/index.rst
>
>> +Order of Nodes
>> +--------------
>> +
>> +1. Nodes within any bus, thus using unit addresses for children, shall be
>> + ordered incrementally by unit address.
>
> In Renesas DTS files, we have an (unwritten) additional rule: when there
> are multiple nodes of the same type, they do not follow the global
> ordering by unit-address, but are grouped together.
> E.g. the second and any subsequent serial ports are always listed
> immediately after the first serial port.
OK, I'll add here some exception paragraph. pin-state nodes also need one.
>
>> +2. Nodes without unit addresses should be ordered alpha-numerically.
>> +
>> +3. When extending nodes in board DTS via &label, the entries should be ordered
>> + alpha-numerically.
>
>
>> +Order of Properties in Device Node
>> +----------------------------------
>> +
>> +Following order of properties in device nodes is preferred:
>> +
>> +1. compatible
>> +2. reg
>> +3. ranges
>> +4. All properties with values
>> +5. Boolean properties
>> +6. status (if applicable)
>
> There must be a lank line between properties and child nodes?
+1
>
> And once we have a documented coding style, the next long-standing item
> from our wishlist would be a script to sort the contents of a DTS file
> according to the rules ;-)
Yeah...
Best regards,
Krzysztof
Powered by blists - more mailing lists