Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scripts: dtc: only show unique unit address warning for enabled nodes

In some cases an hardware peripheral can be used for two exclusive usages.
For example, on STM32MP15 we have the same peripheral for I2S and SPI. We
have dedicated driver for each usage and so a dedicated device node in
devicetree.
To avoid to get useless warnings running "make W=1 dtbs", this patch adds
the "-Wunique_unit_address_if_enabled" flag for a make with W=1. In this
case we will detect a duplicate address only if both devices are
enabled in the devicetree, which is a real error case.

Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
Link: https://lore.kernel.org/r/20221021084447.5550-1-alexandre.torgue@foss.st.com
[robh: Refactor options and keep 'unique_unit_address' for W=2]
Signed-off-by: Rob Herring <robh@kernel.org>

authored by

Alexandre Torgue and committed by
Rob Herring
ae5a16c8 33ce453c

+8 -4
+8 -4
scripts/Makefile.lib
··· 334 334 # DTC 335 335 # --------------------------------------------------------------------------- 336 336 DTC ?= $(objtree)/scripts/dtc/dtc 337 - DTC_FLAGS += -Wno-interrupt_provider 337 + DTC_FLAGS += -Wno-interrupt_provider \ 338 + -Wno-unique_unit_address 338 339 339 340 # Disable noisy checks by default 340 341 ifeq ($(findstring 1,$(KBUILD_EXTRA_WARN)),) ··· 343 342 -Wno-avoid_unnecessary_addr_size \ 344 343 -Wno-alias_paths \ 345 344 -Wno-graph_child_address \ 346 - -Wno-simple_bus_reg \ 347 - -Wno-unique_unit_address 345 + -Wno-simple_bus_reg 346 + else 347 + DTC_FLAGS += \ 348 + -Wunique_unit_address_if_enabled 348 349 endif 349 350 350 351 ifneq ($(findstring 2,$(KBUILD_EXTRA_WARN)),) 351 352 DTC_FLAGS += -Wnode_name_chars_strict \ 352 353 -Wproperty_name_chars_strict \ 353 - -Winterrupt_provider 354 + -Winterrupt_provider \ 355 + -Wunique_unit_address 354 356 endif 355 357 356 358 DTC_FLAGS += $(DTC_FLAGS_$(basetarget))