[PATCH] scripts: dtc: fix a false alarm for node_name_chars_strict

qun-wei.lin qun-wei.lin at mediatek.com
Wed Jun 1 06:59:11 PDT 2022


On Tue, 2022-05-31 at 20:45 -0500, Frank Rowand wrote:
> On 5/31/22 17:49, Rob Herring wrote:
> > On Tue, May 31, 2022 at 04:43:18PM -0400, Frank Rowand wrote:
> > > On 5/31/22 01:33, Qun-Wei Lin wrote:
> > > > The function check_node_name_chars_strict issues a false alarm
> > > > when
> > > > compiling an overlay dts.
> > > > 
> > > > /fragment at 0/__overlay__: Character '_' not recommended in node
> > > > name
> > > > 
> > > > This workaround will fix it by skip checking for node named
> > > > __overlay__.
> > > 
> > > This is not a false alarm.
> > > 
> > > Do not special case node name "__overlay__".  This node name
> > > should never
> > > occur in a modern overlay source file.
> > 
> > A dtbo -> dts pass will give warnings, so handling these nodes is 
> > worthwhile. Though thinking a bit more about it, I think this one
> > is off 
> > by default, but W=2 turns it on.
> 

When DTC detects an overlay target, it will generate a node name
"__overlay__" in function add_orphan_node [1]

Use the example on page 34 of the slide [2]. When the parser reads this
line in overlay source file:

&{/soc/base_fpga_region} {

It will build two nodes, one with no name and the other one is a
subnode __overlay__ [2].

So if we set W=2, the following warning will be issued:

Warning (node_name_chars_strict): /fragment at 0/__overlay__: Character
'_' not recommended in node name

I think this is a false alarm because this __overlay__ is automatically
generated by DTC.

> Yes, at least as of 5.18-rc1 the warning is only if
> '-W node_name_chars_strict', so a dtbo -> dts pass will not give the
> warning for node __overlay__ by default.
> 
> -Frank
> 
> > 
> > Rob
> 
> 

We want to enable all warnings in DTC to ensure that all of our DTS are
compliant with the conventions.

[1] 
https://git.kernel.org/pub/scm/utils/dtc/dtc.git/tree/dtc-parser.y#n169
[2] https://elinux.org/images/0/03/Elce_2018_dt_bof.pdf
[3] 
https://git.kernel.org/pub/scm/utils/dtc/dtc.git/tree/livetree.c#n228







More information about the Linux-mediatek mailing list