Skip to content

Commit 18d0055

Browse files
Dragan Simicrobherring
authored andcommitted
docs: dt-bindings: Specify ordering for properties within groups
Ordering of the individual properties inside each property group benefits from applying natural sort order [1] by the property names, because it results in more logical and more usable property lists, similarly to what's already the case with the alpha-numerical ordering of the nodes without unit addresses. Let's have this clearly specified in the DTS coding style, and let's expand the provided node example a bit, to actually show the results of applying natural sort order. Applying strict alpha-numerical ordering can result in property lists that are suboptimal from the usability standpoint. For the provided example, which stems from a real-world DT, [2][3][4] applying strict alpha-numerical ordering produces the following undesirable result: vdd-0v9-supply = <&board_vreg1>; vdd-12v-supply = <&board_vreg3>; vdd-1v8-supply = <&board_vreg4>; vdd-3v3-supply = <&board_vreg2>; Having the properties sorted in natural order by their associated voltages is more logical, more usable, and a bit more consistent. [1] https://en.wikipedia.org/wiki/Natural_sort_order [2] https://lore.kernel.org/linux-rockchip/b39cfd7490d8194f053bf3971f13a43472d1769e.1740941097.git.dsimic@manjaro.org/ [3] https://lore.kernel.org/linux-rockchip/[email protected]/ [4] https://lore.kernel.org/linux-rockchip/[email protected]/ Signed-off-by: Dragan Simic <[email protected]> Reviewed-by: Krzysztof Kozlowski <[email protected]> Link: https://lore.kernel.org/r/6468619098f94d8acb00de0431c414c5fcfbbdbf.1742532899.git.dsimic@manjaro.org Signed-off-by: Rob Herring (Arm) <[email protected]>
1 parent d47bdcb commit 18d0055

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Documentation/devicetree/bindings/dts-coding-style.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ The above-described ordering follows this approach:
133133
3. Status is the last information to annotate that device node is or is not
134134
finished (board resources are needed).
135135

136+
The individual properties inside each group shall use natural sort order by
137+
the property name.
138+
136139
Example::
137140

138141
/* SoC DTSI */
@@ -158,7 +161,10 @@ Example::
158161
/* Board DTS */
159162

160163
&device_node {
161-
vdd-supply = <&board_vreg1>;
164+
vdd-0v9-supply = <&board_vreg1>;
165+
vdd-1v8-supply = <&board_vreg4>;
166+
vdd-3v3-supply = <&board_vreg2>;
167+
vdd-12v-supply = <&board_vreg3>;
162168
status = "okay";
163169
}
164170

0 commit comments

Comments
 (0)