[PATCH v2 2/4] kbuild: Allow arch/platform override of dtc warning level

Rob Herring
2023-11-22T22:12:48Z

In order to allow enabling extra dtc warnings on a per arch or platform
basis, define a new variable, KBUILD_EXTRA_WARN_DTC, which contains the
warning level and can be set by an arch or platform independently of
KBUILD_EXTRA_WARN. The default value is KBUILD_EXTRA_WARN as before.

The platform setting and command line setting are merged. For example,
with a platform that defaults to W=1, one can run 'make W=2 dtbs' which
will enable both level 1 and 2 warnings.

Signed-off-by: Rob Herring <robh@kernel.org>
---
scripts/Makefile.lib | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index a67f781ae8ee..53a74e53e0ca 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -341,8 +341,10 @@ quiet_cmd_gzip = GZIP $@
# ---------------------------------------------------------------------------
DTC ?= $(objtree)/scripts/dtc/dtc

+KBUILD_EXTRA_WARN_DTC += $(KBUILD_EXTRA_WARN)
+
# Disable noisy checks by default
-ifeq ($(findstring 1,$(KBUILD_EXTRA_WARN)),)
+ifeq ($(findstring 1,$(KBUILD_EXTRA_WARN_DTC)),)
DTC_FLAGS += -Wno-unit_address_vs_reg \
-Wno-avoid_unnecessary_addr_size \
-Wno-alias_paths \
@@ -353,7 +355,7 @@ DTC_FLAGS += \
-Wunique_unit_address_if_enabled
endif

-ifneq ($(findstring 2,$(KBUILD_EXTRA_WARN)),)
+ifneq ($(findstring 2,$(KBUILD_EXTRA_WARN_DTC)),)
DTC_FLAGS += -Wnode_name_chars_strict \
-Wproperty_name_chars_strict
else

--
2.42.0