[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4fa1e860-48bd-456b-ab0b-88215c2b8d1b@lunn.ch>
Date: Sun, 26 Nov 2023 18:48:13 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
Cc: Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, Andrew Davis <afd@...com>,
Arnd Bergmann <arnd@...db.de>,
Bjorn Andersson <andersson@...nel.org>,
Chen-Yu Tsai <wens@...nel.org>,
Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Heiko Stuebner <heiko@...ech.de>,
Jonathan Corbet <corbet@....net>,
Konrad Dybcio <konrad.dybcio@...aro.org>,
Michal Simek <michal.simek@....com>,
Neil Armstrong <neil.armstrong@...aro.org>,
Nishanth Menon <nm@...com>, Olof Johansson <olof@...om.net>,
Rafał Miłecki <zajec5@...il.com>,
linux-rockchip@...ts.infradead.org,
linux-samsung-soc@...r.kernel.org,
linux-amlogic@...ts.infradead.org, linux-arm-msm@...r.kernel.org,
workflows@...r.kernel.org, linux-doc@...r.kernel.org
Subject: Re: [PATCH v3] docs: dt-bindings: add DTS Coding Style document
On Sun, Nov 26, 2023 at 11:38:38AM +0100, Krzysztof Kozlowski wrote:
> On 25/11/2023 20:47, Andrew Lunn wrote:
> >> +=====================================
> >> +Devicetree Sources (DTS) Coding Style
> >> +=====================================
> >> +
> >> +When writing Devicetree Sources (DTS) please observe below guidelines. They
> >> +should be considered complementary to any rules expressed already in Devicetree
> >> +Specification and dtc compiler (including W=1 and W=2 builds).
> >> +
> >> +Individual architectures and sub-architectures can add additional rules, making
> >> +the style stricter.
> >
> > It would be nice to add a pointer where such rules are documented.
>
> Subsystem profile or any other place. The generic doc should not point
> to specific ones.
That is not so friendly for a developer. A reviewer points out that a
file is not consistent with the coding style. So they go away and fix
it, as described here. They then get a second review which say, no,
you to do X, Y and Z, despite them actually following the coding
style.
Maybe add to the paragraph above:
These further restrictions are voluntary, until added to this
document.
This should encourage those architectures to document their coding
style.
> The root node is a bit special, but other than that mixing nodes with
> and without unit address is discouraged practice.
If the root node is special, maybe it needs a few rules of its own?
All properties without an address come first, then properties with
addresses. Sorting within these classes follow the normal rules
already stated?
> >> +Indentation
> >> +-----------
> >> +
> >> +1. Use indentation according to :ref:`codingstyle`.
> >> +2. For arrays spanning across lines, it is preferred to align the continued
> >> + entries with opening < from the first line.
> >> +3. Each entry in arrays with multiple cells (e.g. "reg" with two IO addresses)
> >> + shall be enclosed in <>.
> >> +
> >> +Example::
> >> +
> >> + thermal-sensor@...1000 {
> >> + compatible = "qcom,sm8550-tsens", "qcom,tsens-v2";
> >> + reg = <0x0 0x0c271000 0x0 0x1000>,
> >> + <0x0 0x0c222000 0x0 0x1000>;
> >> + };
> >
> > I'm not sure i understand this. Is this example correct?
> >
> > gpio-fan,speed-map = <0 0
> > 3000 1
> > 6000 2>;
> >
> > It exists a lot in todays files.
>
> Depends on the binidng. Is it matrix? If yes, then it is not correct.
It seems to me, rules 2 and 3 should be swapped. You can only align
the <, if you have <. So logically, the rule about having < should
come first.
Andrew
Powered by blists - more mailing lists