Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Krzysztof Kozlowski" <krzysztof.kozlowski@oss.qualcomm.com>
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v3 5/6] dtc: dt-check-style: Do not sort top-level nodes in DTS by unit address
Date: Mon, 06 Jul 2026 16:05:39 +0000	[thread overview]
Message-ID: <20260706160540.032001F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260706-dts-style-checker-v3-5-03ffacff9226@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The checker script inadvertently disables unit address sorting validation for all immediate children of top-level reference nodes.
- [Medium] Top-level nodes with unit addresses are completely excluded from both address-based and name-based sorting checks.
--

commit 52ef4b5728a3b53330c7623fdea74a0e2eddd12d
Author: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

dtc: dt-check-style: Do not sort top-level nodes in DTS by unit address

This commit modifies the dt-check-style script to stop enforcing unit
address sorting for top-level nodes in DTS files. It notes that top-level
nodes with unit addresses are typically sorted by node name instead.

> diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style
> index d9080297bd4db..3c1aa9e28347e 100755
> --- a/scripts/dtc/dt-check-style
> +++ b/scripts/dtc/dt-check-style
> @@ -515,12 +515,18 @@ def _natural_sort_key(s):
>  
>  def check_child_address_order(ctx):
>      """Addressed siblings (foo@N) must appear in ascending address
> -    order within their parent node body."""
> +    order within their parent node body.
> +    Exception: Top-level in DTS follows name order, regardless of unit address
> +    in memory@N and soc@N nodes
> +    """
>      for children in _walk_bodies(ctx.lines):
>          addressed = []
>          for c in children:
>              if c.node_addr is None:
>                  continue
> +            if (ctx.file_type == 'dts') and (c.depth < 2):
> +                # Top-level does not use unit address sorting usually
> +                continue

[Severity: Medium]
Does this unintentionally disable address-order validation for the vast
majority of peripheral nodes added in board files?

When using top-level reference nodes (e.g., &i2c0 { sensor@50 { ... }; };)
in a .dts or .dtso file, the lexical depth of &i2c0 is 0. This makes the
depth of sensor@50 equal to 1. Since c.depth < 2 is true here, won't this
skip the unit address validation for all immediate children of top-level
references?

[Severity: Medium]
The commit message states that the DTS usually chooses sorting by node
name for the top-level part. However, does this change leave top-level
nodes with unit addresses completely unvalidated?

Looking at check_child_name_order() elsewhere in this script, it explicitly
skips all nodes with a unit address:

scripts/dtc/dt-check-style:check_child_name_order() {
    for children in _walk_bodies(ctx.lines):
        for c in children:
            if c.node_addr is not None:
                continue
...
}

Since check_child_name_order() bypasses nodes with unit addresses, and
this new logic skips them in check_child_address_order(), will nodes like
memory@0 and soc@0 bypass both sorting checks?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260706-dts-style-checker-v3-0-03ffacff9226@oss.qualcomm.com?part=5

  reply	other threads:[~2026-07-06 16:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-06 15:53 [PATCH v3 0/6] dtc: dt-check-style: Improvement after using on DTS Krzysztof Kozlowski
2026-07-06 15:53 ` [PATCH v3 1/6] dtc: dt-check-style: Narrow disallowing of tab in DTS only to YAML Krzysztof Kozlowski
2026-07-06 15:59   ` sashiko-bot
2026-07-06 16:00     ` Krzysztof Kozlowski
2026-07-06 15:53 ` [PATCH v3 2/6] dtc: dt-check-style: Allow space-aligning indentation in DTS Krzysztof Kozlowski
2026-07-06 15:53 ` [PATCH v3 3/6] dtc: dt-check-style: Rework handling YAML/DTS in rules Krzysztof Kozlowski
2026-07-06 15:53 ` [PATCH v3 4/6] dtc: dt-check-style: Expect first device_type Krzysztof Kozlowski
2026-07-06 16:07   ` sashiko-bot
2026-07-06 16:09     ` Krzysztof Kozlowski
2026-07-06 15:53 ` [PATCH v3 5/6] dtc: dt-check-style: Do not sort top-level nodes in DTS by unit address Krzysztof Kozlowski
2026-07-06 16:05   ` sashiko-bot [this message]
2026-07-06 15:53 ` [PATCH v3 6/6] dtc: dt-check-style: Handle properly DTC-style includes Krzysztof Kozlowski
2026-07-06 16:13   ` sashiko-bot
2026-07-06 16:20     ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260706160540.032001F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski@oss.qualcomm.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox