Skip to content

boards: silabs: fix boards DTS files coding style issues #90607

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

Merged
merged 1 commit into from
May 28, 2025

Conversation

yishai1999
Copy link
Collaborator

Fix board DTS coding style issues to prevent them from spreading when a new board is introduced and uses an existing DTS as a referance.

Issues addressed from Zephyr devicetree style guidelines [1]:

  • Don’t insert empty lines before a deindenting };.
  • Insert a single empty line to separate nodes at the same hierarchy level.
  • status is "okay" by default.
  • compatible property comes first in node.
  • reg property comes second in node.
  • status property comes last in node.
  • the rest of the properties within are nodes naturally sorted.
  • child nodes are sorted by address or alphabetically if there is no address.

No functional change.

Link: https://docs.zephyrproject.org/latest/contribute/style/devicetree.html [1]

Took inspiration from #90312

Copy link
Collaborator

@asmellby asmellby left a comment

Choose a reason for hiding this comment

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

Nice! Thanks for taking the initative to clean things up! I only have some comments/questions when it comes to pinctrl nodes specifically.

@@ -7,44 +7,46 @@
#include <dt-bindings/pinctrl/silabs/xg22-pinctrl.h>

&pinctrl {
usart0_default: usart0_default {
itm_default: itm_default {
Copy link
Collaborator

Choose a reason for hiding this comment

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

According to the style guidelines:

Use dashes (-) as word separators for node and property names.
Use underscores (_) as word separators in node labels.

This suggests that this should be itm_default: itm-default {. However, that doesn't match with any of the examples in the Pin Control documentation at https://docs.zephyrproject.org/latest/hardware/pinctrl/index.html.

The same documentation also consistently lists the pin selections before the properties that apply to the pins. IMO, it's more readable to consistently have the pin list come as the first child of the pinctrl node and for any pin properties to come after it, rather than having the pin list as a random node in the middle of the properties. But if this is consistent with how the project wants it, I'm not going to protest.

@gmarull @mbolivar As maintainers of pinctrl and devicetree respectively, what are your thoughts on this?

@jerome-pouiller
Copy link
Collaborator

the rest of the properties within are nodes naturally sorted.

I feel many people try to go from the most generic attributes to the most specific (with an exception for status): compatible, reg, pinctrl, dma, clock, then device class attributes, then driver specific attributes.

That's said, this is not a big deal.

@yishai1999
Copy link
Collaborator Author

Nice! Thanks for taking the initative to clean things up! I only have some comments/questions when it comes to pinctrl nodes specifically.

Reverted the pins property to be first.

Regarding the - vs _ - We can either wait for people to reply to your comment or do it at another time.

@yishai1999
Copy link
Collaborator Author

the rest of the properties within are nodes naturally sorted.

I feel many people try to go from the most generic attributes to the most specific (with an exception for status): compatible, reg, pinctrl, dma, clock, then device class attributes, then driver specific attributes.

That's said, this is not a big deal.

That makes some sense but unfortunately that's not what the guidelines say so I think that precedes.

rettichschnidi
rettichschnidi previously approved these changes May 27, 2025
Copy link
Collaborator

@rettichschnidi rettichschnidi 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 sgrm.dts improvements. Did not check the other changes.

@rettichschnidi rettichschnidi removed their assignment May 27, 2025
asmellby
asmellby previously approved these changes May 28, 2025
Copy link
Collaborator

@asmellby asmellby left a comment

Choose a reason for hiding this comment

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

Found a couple of minor inconsistencies, but that shouldn't block the big improvements for everything else.

pinctrl-0 = <&eusart1_default>;
pinctrl-names = "default";
cs-gpios = <&gpioc 0 GPIO_ACTIVE_LOW>;
clock-frequency = <4000000>;
#address-cells = <1>;
#size-cells = <0>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like this one was missed, other #-prefixed properties have been sorted first (using the # rather than the s).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yup. My bad

height = <128>;
spi-max-frequency = <DT_FREQ_M(2)>;
width = <128>;
extcomin-gpios = <&gpiod 2 GPIO_ACTIVE_HIGH>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Missing blank line before section or these should come before height?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

According to the guidelines, vendor specific properties like these come last.

Fix board DTS coding style issues to prevent them from spreading when a
new board is introduced and uses an existing DTS as a referance.

Issues addressed from Zephyr devicetree style guidelines [1]:
- Don’t insert empty lines before a deindenting };.
- Insert a single empty line to separate nodes at the same hierarchy
  level.
- status is "okay" by default.
- compatible property comes first in node.
- reg property comes second in node.
- status property comes last in node.
- the rest of the properties within are nodes naturally sorted.
- child nodes are sorted by address or alphabetically if there is no
  address.

No functional change.

Link: https://docs.zephyrproject.org/latest/contribute/style/devicetree.html [1]
Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>
Copy link

@yishai1999 yishai1999 assigned kartben and unassigned rettichschnidi May 28, 2025
@kartben kartben assigned jerome-pouiller and unassigned kartben May 28, 2025
@kartben kartben merged commit f384a86 into zephyrproject-rtos:main May 28, 2025
26 checks passed
@yishai1999 yishai1999 deleted the silabs-dts-lint branch May 28, 2025 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants