Skip to content

ST DTS lint #90611

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

yishai1999
Copy link
Collaborator

Fixed two issues according to the device tree guidelines https://docs.kernel.org/devicetree/bindings/dts-coding-style.html:

  1. The reg property should be second only to the compatible property within a node. This was not the case in many partition nodes definitions.
  2. The status property should be the last property in a node.

Copy link
Collaborator

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed these changes are recommended.
A few review comments.

@@ -117,6 +117,7 @@ arduino_i2c: &i2c1 {};
&spi1_miso_pa6 &spi1_mosi_pa7>;
pinctrl-names = "default";
status = "okay";

Copy link
Collaborator

@etienne-lms etienne-lms May 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from the specs, I guess we should rather have:

	pinctrl-names = "default";
+	cs-gpios = <&gpioa 15 GPIO_ACTIVE_LOW>;
	status = "okay";
-	cs-gpios = <&gpioa 15 GPIO_ACTIVE_LOW>;

	lora: lora@0 {

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This exists in a bunch of places. I think it falls into the category of splitting into paragraphs for readabillity. It's nice to have the cs-gpios right before the spi device sub-nodes because they go together logically

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I must say I don't understand why you don't want to change this while still change other status properties placement.
(2 other occurrences).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did I fix all the inconsistancies?

@yishai1999
Copy link
Collaborator Author

@etienne-lms All good?

Copy link
Collaborator

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside the 3 comments below, the changes here are consistent.
(edited) the 3 comments are here, here and here.

@erwango, what do you think about such changes?

The DTS spec talks about a "preferred" order that is addressed in these changes (in https://docs.kernel.org/devicetree/bindings/dts-coding-style.html#order-of-properties-in-device-node). It's not a strong recommendation.

The following order of properties in device nodes is preferred:

  1. “compatible”
  2. “reg”
  3. “ranges”
  4. Standard/common properties (defined by common bindings, e.g. without vendor-prefixes)
  5. Vendor-specific properties
  6. “status” (if applicable)
  7. Child nodes, where each node is preceded with a blank line

There are a few changes in this P-R that I'm fully in favor of: rules 7. (sub nodes always after properties). As for the other, I'm not sure. That said, I must admit that always expecting the status property at this end is simpler, to know whether it's present or not, especially in case there are a lot of properties.

height = <320>;
pixel-format = <PANEL_PIXEL_FORMAT_RGB_565>;
width = <240>;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

width is better placed next to height.
(several occurrences)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree but how would you arrange it? Separate block?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 	def-back-color-green = <0xFF>;
 	def-back-color-blue = <0xFF>;
 	display-controller = <&ili9341>;
 	ext-sdram = <&sdram2>;
 	height = <320>;
+	width = <240>;
 	pixel-format = <PANEL_PIXEL_FORMAT_RGB_565>;
-	width = <240>;
 
 	display-timings {

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit weird but all right...

@@ -117,6 +117,7 @@ arduino_i2c: &i2c1 {};
&spi1_miso_pa6 &spi1_mosi_pa7>;
pinctrl-names = "default";
status = "okay";

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I must say I don't understand why you don't want to change this while still change other status properties placement.
(2 other occurrences).


mx25lm51245: ospi-nor-flash@90000000 {
status = "okay";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Equivalent change in boards/st/stm32l562e_dk/stm32l562e_dk_common.dtsi is missing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed it. Will fix

According to the guidelines the `reg` property should always come before
any other property other than `compatible`.

Link: https://docs.kernel.org/devicetree/bindings/dts-coding-style.html
Signed-off-by: Yishai Jaffe <[email protected]>
According to the guidelines the `status` property should always be the
last property listed.

Link: https://docs.kernel.org/devicetree/bindings/dts-coding-style.html
Signed-off-by: Yishai Jaffe <[email protected]>
Copy link

sonarqubecloud bot commented Jun 9, 2025

Copy link
Member

@erwango erwango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the effort and care provided to these files.

This being said, I'm a bit concerned by the spread of the change and:

  • the probability it will create churn to anyone that has PR/branch/patch on those files
  • the fact that this change is only a one time thing and will be hard to maintain (one going and next PR should be reviewed with the same requirements) and not enforced by linting script/checker, so won't be likely enforced in future
  • applied only on part of the files (st boards), so most probably, contamination from other areas will happen some day.

For all these reasons, I'd suggest to drop 2 parts to minimize the spread of the change:

  • status moves
  • label moves

I hope you understand my concern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Coding Guidelines Coding guidelines and style area: Devicetree platform: STM32 ST Micro STM32
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants