checks: Suppress warnings on overlay fragments
PATCH 1/1 checks: Suppress warnings on overlay fragments
The overlay fragment is a speial case where some properties are not present in the overlay source file, but in the base file.
example:
+-----------------------------+--------------------+
| base.dts | overlay.dts |
+-----------------------------+--------------------+
| /dts-v1/; | /dts-v1/; |
| | /plugin/; |
| /{ | |
| parent: test { | &parent { |
| #address-cells = <1>; | child@0 { |
| #size-cells = <0>; | reg = <0x0>; |
| }; | }; |
| }; | }; |
+-----------------------------+--------------------+It will cause the following false alarms when compiling the overlay dts.
1. /fragment@0/__overlay__: Character '_' not recommended in node name
2. /fragment@0/__overlay__: Relying on default #address-cells value
3. /fragment@0/__overlay__: Relying on default #size-cells value
4. /fragment@0/__overlay__:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1)
This workaround will fix them by skip checking for node named __overlay__.
--- checks.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
checks.c +10 -0
@@ -325,6 +325,9 @@ static void check_node_name_chars_strict(struct check *c, struct dt_info *dti, {int n =strspn (node->name, c->data); +if (streq (node->name,"__overlay__" )) +return ; +if (n < node->basenamelen)FAIL (c, dti, node,"Character '%c' not recommended in node name" , node->name[n]);
@@ -767,6 +770,9 @@ static void check_reg_format(struct check *c, struct dt_info *dti,return ; } +if (streq (node->parent->name,"__overlay__" )) +return ; +if (prop->val.len ==0 )FAIL_PROP (c, dti, node, prop,"property is empty" );
@@ -1197,6 +1203,10 @@ static void check_avoid_default_addr_size(struct check *c, struct dt_info *dti,if (!node->parent)return ;/* Ignore root node */ + +if (streq (node->parent->name,"__overlay__" )) +return ; + reg =get_property (node,"reg" ); ranges =get_property (node,"ranges" );
Signature · 1 line
2.18.0
A message that is not in the archive (sent off-list or not yet received): 20230111023417.24141-1-qun-wei.lin-NuS5LvNUpcJWk0Htik3J/[email protected]
Quoted 66 lines · Qun-Wei Lin
The overlay fragment is a speial case where some properties are not present in the overlay source file, but in the base file.
example:
+-----------------------------+--------------------+ > base.dts | overlay.dts |+-----------------------------+--------------------+ > /dts-v1/; | /dts-v1/; | > | /plugin/; | > /{ | | > parent: test { | &parent { | > #address-cells = <1>; | child@0 { | > #size-cells = <0>; | reg = <0x0>; | > }; | }; | > }; | }; |+-----------------------------+--------------------+
It will cause the following false alarms when compiling the overlay dts.
1. /fragment@0/__overlay__: Character '_' not recommended in node name
2. /fragment@0/__overlay__: Relying on default #address-cells value
3. /fragment@0/__overlay__: Relying on default #size-cells value
4. /fragment@0/__overlay__:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1)This workaround will fix them by skip checking for node named
__overlay__.Signed-off-by Qun-Wei Lin <[email protected]>--- checks.c | 10 ++++++++++ 1 file changed, 10 insertions(+)checks.c +3
-0@@ -325,6 +325,9 @@ static void check_node_name_chars_strict(struct check *c, struct dt_info *dti, { int n = strspn(node->name, c->data); +if (streq (node->name,"__overlay__" )) +return ; + if (n < node->basenamelen) FAIL(c, dti, node, "Character '%c' not recommended innode name",
checks.c +3
-0node->name[n]);@@ -767,6 +770,9 @@ static void check_reg_format(struct check *c,struct dt_info *dti, return; } +if (streq (node->parent->name,"__overlay__" )) +return ; +if (prop->val.len ==0 )FAIL_PROP (c, dti, node, prop,"property is empty" );
checks.c static void · line 1212
Quoted 10 lines
checks.c +4
-0@@ -1197,6 +1203,10 @@ static void check_avoid_default_addr_size(struct check *c, struct dt_info *dti, if (!node->parent) return; /* Ignore root node */ + +if (streq (node->parent->name,"__overlay__" )) +return ; + reg =get_property (node,"reg" ); ranges =get_property (node,"ranges" );
Hi, maintainers, kindly ping...
Please help to review this patch.
Thanks!
Quoted 2 lines · Qun-Wei Lin
The overlay fragment is a speial case where some properties are not
special
Quoted 36 lines
present in the overlay source file, but in the base file.
example:
+-----------------------------+--------------------+ | base.dts | overlay.dts | +-----------------------------+--------------------+ | /dts-v1/; | /dts-v1/; | | | /plugin/; | | /{ | | | parent: test { | &parent { | | #address-cells = <1>; | child@0 { | | #size-cells = <0>; | reg = <0x0>; | | }; | }; | | }; | }; | +-----------------------------+--------------------+It will cause the following false alarms when compiling the overlay dts.
1. /fragment@0/__overlay__: Character '_' not recommended in node name
2. /fragment@0/__overlay__: Relying on default #address-cells value
3. /fragment@0/__overlay__: Relying on default #size-cells value
4. /fragment@0/__overlay__:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1)This workaround will fix them by skip checking for node named
__overlay__.--- checks.c | 10 ++++++++++ 1 file changed, 10 insertions(+)checks.c +0
-0
checks.c static void check_node_name_chars_strict(struct check *c, struct dt_info *dti, · line 328
Quoted 4 lines
checks.c +1
-0@@ -325,6 +325,9 @@ static void check_node_name_chars_strict(struct check *c, struct dt_info *dti, {int n =strspn (node->name, c->data); +if (streq (node->name,"__overlay__" ))
Do we hit the same thing with __fixups__ or __local_fixups__? If so, just skip anything starting with "__".
checks.c static void check_reg_format(struct check *c, struct dt_info *dti, · line 773
Quoted 10 lines
checks.c +3
-0+return ; +if (n < node->basenamelen)FAIL (c, dti, node,"Character '%c' not recommended in node name" , node->name[n]);@@ -767,6 +770,9 @@ static void check_reg_format(struct check *c, struct dt_info *dti,return ; } +if (streq (node->parent->name,"__overlay__" ))
Move this to a helper: is_overlay_node(node->parent)
checks.c static void check_avoid_default_addr_size(struct check *c, struct dt_info *dti, · line 1206
Quoted 10 lines
checks.c +3
-0+return ; +if (prop->val.len ==0 )FAIL_PROP (c, dti, node, prop,"property is empty" );@@ -1197,6 +1203,10 @@ static void check_avoid_default_addr_size(struct check *c, struct dt_info *dti,if (!node->parent)return ;/* Ignore root node */ +
Extra blank line.
Quoted 9 lines
checks.c +3
-1+if (streq (node->parent->name,"__overlay__" )) +return ; + reg =get_property (node,"reg" ); ranges =get_property (node,"ranges" ); --2.18.0