From: Krzysztof Kozlowski <krzk@kernel.org>
To: Dragan Simic <dsimic@manjaro.org>
Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
heiko@sntech.de, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] docs: dt-bindings: Specify ordering for properties within groups
Date: Fri, 7 Mar 2025 08:14:56 +0100 [thread overview]
Message-ID: <c965f9dc-518d-4878-810d-420b0ee6c87e@kernel.org> (raw)
In-Reply-To: <c166178a01b7e83e9d3c488f4871bad3@manjaro.org>
On 06/03/2025 09:57, Dragan Simic wrote:
> Hello Krzysztof,
>
> On 2025-03-06 09:38, Krzysztof Kozlowski wrote:
>> On Wed, Mar 05, 2025 at 10:53:48AM +0100, Dragan Simic wrote:
>>> On 2025-03-05 10:36, Krzysztof Kozlowski wrote:
>>>> On 05/03/2025 09:45, Dragan Simic wrote:
>>>>>
>>>>> diff --git a/Documentation/devicetree/bindings/dts-coding-style.rst
>>>>> b/Documentation/devicetree/bindings/dts-coding-style.rst
>>>>> index 8a68331075a0..15de3ede2d9c 100644
>>>>> --- a/Documentation/devicetree/bindings/dts-coding-style.rst
>>>>> +++ b/Documentation/devicetree/bindings/dts-coding-style.rst
>>>>> @@ -133,6 +133,12 @@ The above-described ordering follows this
>>>>> approach:
>>>>> 3. Status is the last information to annotate that device node is
>>>>> or is not
>>>>> finished (board resources are needed).
>>>>>
>>>>> +The above-described ordering specifies the preferred ordering of
>>>>> property
>>>>> +groups, while the individual properties inside each group shall use
>>>>> natural
>>>>> +sort order by the property name. More specifically, natural sort
>>>>> order shall
>>>>> +apply to multi-digit numbers found inside the property names, while
>>>>> alpha-
>>>>> +numerical ordering shall apply otherwise.
>>>>
>>>> The last sentence was not here and I don't get the point. Natural sort
>>>> order should be always preferred over alpha-numerical for properties.
>>>> About which other case ("...apply otherwise.") are you thinking?
>>>
>>> Yes, I added that sentence in the v2 to, hopefully, clarify the
>>> natural
>>> sort order itself a bit. I've researched the natural sort order a bit
>>> further, and it technically applies only to the multi-digit numbers
>>> found
>>> inside the sorted strings. That's what I wanted to explain, and
>>> "shall
>>
>> Natural sort applies to everywhere. It's just the same as
>> alpha-numerical sort for single digits.
>
> Technically, it depends on how one describes the natural sort order.
> I'll get back to this below.
>
>>> apply otherwise" refers to applying the alpha-numerical sort order to
>>> the
>>> remainders of the sorted strings, i.e. to everything but the
>>> multi-digit
>>> numbers found in the property names.
>>
>> Sorry, still don't get. What would be the difference if for remainders
>> of properties you would also apply natural sort instead of
>> alphanumerical sort?
>
> Oh, there are no differences in the results of the ordering, it's just
> about the formal definition of the natural sort order. In some places,
> the natural sort order is described to apply to the multi-digit numbers
I am no language expert, so I rely on Wikipedia:
https://en.wikipedia.org/wiki/Natural_sort_order
"except that single- and multi-digit numbers are treated atomically,"
and anyway I don't really know how natural sort order would work for
single digits if it was applying to them differently.
> found in the sorted strings only. Thus, the wording I proposed tries
> to explain that further, but I do agree that it's somewhat confusing.
>
> In other words, the way natural sort order is defined in some places,
> it applies to the multi-digit parts of the sorted strings only, while
> the remainders of the strings are sorted alpha-numerically. I'll
> consult
> some more sources and get back with some better wording in the v3, to
> make it less confusing, while still describing the natural sort order
> a bit, because the people who will be reading the DTS coding style may
> not already be familiar with it.
Please drop the second sentence. The point is to be concise. If text
grows too long, people won't read it (just like they don't read
submitting-patches).
Best regards,
Krzysztof
prev parent reply other threads:[~2025-03-07 7:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-05 8:45 Dragan Simic
2025-03-05 9:36 ` Krzysztof Kozlowski
2025-03-05 9:53 ` Dragan Simic
2025-03-06 8:38 ` Krzysztof Kozlowski
2025-03-06 8:57 ` Dragan Simic
2025-03-07 7:14 ` Krzysztof Kozlowski [this message]
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=c965f9dc-518d-4878-810d-420b0ee6c87e@kernel.org \
--to=krzk@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dsimic@manjaro.org \
--cc=heiko@sntech.de \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@kernel.org \
/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
all inboxes | Powered by JetHome®