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
Contributor

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
Contributor

@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
Contributor

@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
Contributor 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
Contributor

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
Contributor 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?

@@ -170,6 +170,7 @@
pinctrl-0 = <&spi2_sck_pd1 &spi2_miso_pd3 &spi2_mosi_pc3>;
pinctrl-names = "default";
status = "okay";

Copy link
Contributor

Choose a reason for hiding this comment

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

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

	spbtle_1s_sensortile_box: spbtle-1s@0 {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same

Copy link
Contributor

Choose a reason for hiding this comment

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

I still believe, if following the recommendation, that cs-gpios = ... should come before status = ....

@yishai1999
Copy link
Contributor Author

@etienne-lms All good?

Copy link
Contributor

@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.

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

Copy link
Contributor

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
Contributor

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
Contributor 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.

Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label Aug 19, 2025
Copy link
Contributor

@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.

I'm still not sure the recommendations on status and label properties ordering in nodes really need to be strictly followed. That said, these changes almost look good to me, see my few remaining review comments.

reg = <0x0 DT_SIZE_K(64)>;
label = "mcuboot";
Copy link
Contributor

Choose a reason for hiding this comment

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

This change belongs to previous commit "boards: st: change order of reg property in partitions."
Ditto for changes around lines 241, 253, 261 and 269.

@@ -170,6 +170,7 @@
pinctrl-0 = <&spi2_sck_pd1 &spi2_miso_pd3 &spi2_mosi_pc3>;
pinctrl-names = "default";
status = "okay";

Copy link
Contributor

Choose a reason for hiding this comment

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

I still believe, if following the recommendation, that cs-gpios = ... should come before status = ....

status = "okay";

cs-gpios = <&gpioa 2 GPIO_ACTIVE_LOW>;
Copy link
Contributor

Choose a reason for hiding this comment

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

I still believe, if following the recommendation, that cs-gpios = ... should come before status = ....

@@ -234,7 +234,6 @@ stm32_lp_tick_source: &lptim1 {
spi-bus-width = <OSPI_OPI_MODE>;
data-rate = <OSPI_DTR_TRANSFER>;
four-byte-opcodes;
status = "okay";
Copy link
Contributor

Choose a reason for hiding this comment

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

status = "okay" is missing below sfdp-bfp property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants