From: Michal Simek <michal.simek@amd.com>
To: Dragan Simic <dsimic@manjaro.org>,
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: wens@kernel.org, "Rafał Miłecki" <zajec5@gmail.com>,
"Rob Herring" <robh+dt@kernel.org>,
"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, "Andrew Davis" <afd@ti.com>,
"Arnd Bergmann" <arnd@arndb.de>,
"Bjorn Andersson" <andersson@kernel.org>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
"Heiko Stuebner" <heiko@sntech.de>,
"Konrad Dybcio" <konrad.dybcio@linaro.org>,
"Neil Armstrong" <neil.armstrong@linaro.org>,
"Nishanth Menon" <nm@ti.com>, "Olof Johansson" <olof@lixom.net>,
linux-rockchip@lists.infradead.org,
linux-samsung-soc@vger.kernel.org,
linux-amlogic@lists.infradead.org, linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH v2] docs: dt-bindings: add DTS Coding Style document
Date: Wed, 22 Nov 2023 09:49:34 +0100 [thread overview]
Message-ID: <cc4c789c-b595-41eb-b543-9e03549c6e61@amd.com> (raw)
In-Reply-To: <58a9caacc1226c7c3a2bdfe73ef1791f@manjaro.org>
On 11/22/23 09:29, Dragan Simic wrote:
> On 2023-11-22 09:21, Krzysztof Kozlowski wrote:
>> On 22/11/2023 09:09, Chen-Yu Tsai wrote:
>>> On Wed, Nov 22, 2023 at 4:05 PM Krzysztof Kozlowski
>>> <krzysztof.kozlowski@linaro.org> wrote:
>>>>
>>>> On 21/11/2023 14:50, Rafał Miłecki wrote:
>>>>>> +Order of Properties in Device Node
>>>>>> +----------------------------------
>>>>>> +
>>>>>> +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
>>>>>> +
>>>>>> +The "status" property is by default "okay", thus it can be omitted.
>>>>>
>>>>> I think it would really help to include position of #address-cells and
>>>>> #size-cells here. In some files I saw them above "compatible" that seems
>>>>> unintuitive. Some prefer putting them at end which I think makes sense
>>>>> as they affect children nodes.
>>>>>
>>>>> Whatever you choose it'd be just nice to have things consistent.
>>>>
>>>> This is a standard/common property, thus it goes to (4) above.
>>>
>>> It's probably a mix, but AFAIK a lot of the device trees in tree have
>>> #*-cells after "status". In some cases they are added in the board
>>> .dts files, not the chip/module .dtsi files.
>>
>> Existing DTS is not a good example :)
>>
>>>
>>> +1 that it makes sense at the end as they affect child nodes.
>>
>> I still insist that status must be the last, because:
>> 1. Many SoC nodes have address/size cells but do not have any children
>> (I2C, SPI), so we put useless information at the end.
>> 2. Status should be the final information to say whether the node is
>> ready or is not. I read the node, check properties and then look at the end:
>> a. Lack of status means it is ready.
>> b. status=disabled means device still needs board resources/customization
>
> I agree with the "status" belonging to the very end, because it's both logical
> and much more readable. Also, "status" is expected to be modified in the
> dependent DT files, which makes it kind of volatile and even more deserving to
> be placed last.
I am just curious if having status property at the end won't affect
execution/boot up time. Not sure how it is done in Linux but in U-Boot at least
(we want to have DTs in sync between Linux and U-Boot) of_find_property is
pretty much big loop over all properties. And status property defined at the end
means going over all of them to find it out to if device is present.
Not sure if Linux works in the same way but at least of_get_property is done in
the same way.
It is not big deal on high speed cpus but wanted to point it out.
Thanks,
Michal
next prev parent reply other threads:[~2023-11-22 8:50 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-20 8:40 [PATCH v2] docs: dt-bindings: add DTS Coding Style document Krzysztof Kozlowski
2023-11-20 9:04 ` Neil Armstrong
2023-11-20 9:38 ` Heiko Stübner
2023-11-20 11:43 ` AngeloGioacchino Del Regno
2023-11-20 14:57 ` Krzysztof Kozlowski
2023-11-21 10:25 ` AngeloGioacchino Del Regno
2023-11-20 14:01 ` Michal Simek
2023-11-20 14:53 ` Krzysztof Kozlowski
2023-11-20 19:18 ` Geert Uytterhoeven
2023-11-20 19:31 ` Krzysztof Kozlowski
2023-11-21 7:33 ` Michal Simek
2023-11-21 7:47 ` Krzysztof Kozlowski
2023-11-21 8:08 ` Geert Uytterhoeven
2023-11-21 8:37 ` Krzysztof Kozlowski
2023-11-21 10:13 ` Dmitry Baryshkov
2023-11-21 10:28 ` Krzysztof Kozlowski
2023-11-21 11:53 ` Michal Simek
2023-11-21 11:55 ` Michal Simek
2023-11-21 12:36 ` Krzysztof Kozlowski
2023-11-21 16:04 ` Geert Uytterhoeven
2023-11-22 8:01 ` Krzysztof Kozlowski
2023-11-22 8:15 ` Dragan Simic
2023-11-20 20:15 ` Andrew Lunn
2023-11-21 7:36 ` Michal Simek
2023-11-21 7:47 ` Krzysztof Kozlowski
2023-11-22 8:18 ` Krzysztof Kozlowski
2023-11-21 13:50 ` Rafał Miłecki
2023-11-22 8:05 ` Krzysztof Kozlowski
2023-11-22 8:09 ` Chen-Yu Tsai
2023-11-22 8:21 ` Krzysztof Kozlowski
2023-11-22 8:28 ` Geert Uytterhoeven
2023-11-22 8:29 ` Dragan Simic
2023-11-22 8:49 ` Michal Simek [this message]
2023-11-22 8:53 ` Geert Uytterhoeven
2023-11-22 8:57 ` Michal Simek
2023-11-22 9:09 ` Krzysztof Kozlowski
2023-11-22 14:34 ` Rob Herring
2023-11-22 14:42 ` Dragan Simic
2023-11-22 8:59 ` Dragan Simic
2023-11-22 14:55 ` Rob Herring
2023-11-25 18:44 ` 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=cc4c789c-b595-41eb-b543-9e03549c6e61@amd.com \
--to=michal.simek@amd.com \
--cc=afd@ti.com \
--cc=andersson@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=arnd@arndb.de \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dsimic@manjaro.org \
--cc=geert+renesas@glider.be \
--cc=heiko@sntech.de \
--cc=konrad.dybcio@linaro.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=neil.armstrong@linaro.org \
--cc=nm@ti.com \
--cc=olof@lixom.net \
--cc=robh+dt@kernel.org \
--cc=wens@kernel.org \
--cc=zajec5@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).