[PATCH v2] dtc: Demote graph_child_address checks to W=2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The dtc graph_child_address check can't distinguish between bindings
where there can only be a single endpoint, and cases where there can be
multiple endpoints.

In cases where the bindings allow for multiple endpoints but only one is
described false warnings about unnecessary #address-cells/#size-cells
can be generated, but only if the endpoint described have an address of
0 (A), for single endpoints with a non-zero address (B) no warnings are
generated.

A)
    ports {
        #address-cells = <1>;
        #size-cells = <0>;

        port@0 {
            #address-cells = <1>;
            #size-cells = <0>;

            sourceA: endpoint@0 {
                reg = <0>
            };
        };
    };

B)
    ports {
        #address-cells = <1>;
        #size-cells = <0>;

        port@0 {
            #address-cells = <1>;
            #size-cells = <0>;

            sourceB: endpoint@1 {
                reg = <1>
            };
        };
    };

The false warnings, and especially the confusion on why it only triggers
for single endpoints where the address is 0, leads to confused user and
reports of issues with DTS files. To try and mitigate this behavior by
demote the check to W=2.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@xxxxxxxxxxxx>
---
* Changes since v1
- Drop adding a comment to dtc/checks.c documenting the possibility for
  a false warning. This change have been posted separately to the
  devicetree-compiler list [1]

1.  https://lore.kernel.org/devicetree-compiler/20250706122638.1040347-1-niklas.soderlund+renesas@xxxxxxxxxxxx/

---
Hi,

This solution was lightly hinted at [1] by Rob and I have ran with it
for a while locally and I'm happy with the result. Lets see what the
rest of you think.

1. https://lore.kernel.org/all/20250109150327.GA3352888-robh@xxxxxxxxxx/
---
 scripts/Makefile.dtbs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/Makefile.dtbs b/scripts/Makefile.dtbs
index 8d56c0815f33..fd8316bcf6c9 100644
--- a/scripts/Makefile.dtbs
+++ b/scripts/Makefile.dtbs
@@ -89,21 +89,21 @@ $(call multi_depend, $(multi-dtb-y), .dtb, -dtbs)
 # ---------------------------------------------------------------------------
 
 DTC ?= $(objtree)/scripts/dtc/dtc
-DTC_FLAGS += -Wno-unique_unit_address
+DTC_FLAGS += -Wno-graph_child_address -Wno-unique_unit_address
 
 # Disable noisy checks by default
 ifeq ($(findstring 1,$(KBUILD_EXTRA_WARN)),)
 DTC_FLAGS += -Wno-unit_address_vs_reg \
              -Wno-avoid_unnecessary_addr_size \
              -Wno-alias_paths \
-             -Wno-graph_child_address \
              -Wno-simple_bus_reg
 else
 DTC_FLAGS += -Wunique_unit_address_if_enabled
 endif
 
 ifneq ($(findstring 2,$(KBUILD_EXTRA_WARN)),)
-DTC_FLAGS += -Wnode_name_chars_strict \
+DTC_FLAGS += -Wgraph_child_address \
+             -Wnode_name_chars_strict \
              -Wproperty_name_chars_strict \
              -Wunique_unit_address
 endif
-- 
2.50.0





[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux