Skip to contentSkip to conversation

EDAC, {skx|i10nm}_edac: Fix randconfig build error

PATCH New Arnd Bergmann 1 participant 1 message Mar 22, 2019 EDAC-core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 EDAC, {skx|i10nm}_edac: Fix randconfig build error

Configurations with CONFIG_EDAC_SKX and CONFIG_EDAC_I10NM both enabled, but only one of them built-in and the other being a loadable module fail to link because the common file is built the wrong way:

skx_common.c:672: undefined reference to `__this_module'

This overrides the way the modules are built, building both into the zImage file if that happens.

---
 drivers/edac/Kconfig  | 9 +++++++++
 drivers/edac/Makefile | 8 ++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
drivers/edac/Kconfig +9 -0
index 47eb4d13ed5f..70080926329f 100644
@@ -235,6 +235,7 @@ config EDAC_SKX
 	depends on ACPI_NFIT || !ACPI_NFIT # if ACPI_NFIT=m, EDAC_SKX can't be y
 	select DMI
 	select ACPI_ADXL
+	select EDAC_SKX_COMMON
 	help
 	  Support for error detection and correction the Intel
 	  Skylake server Integrated Memory Controllers. If your
@@ -247,12 +248,20 @@ config EDAC_I10NM
 	depends on ACPI_NFIT || !ACPI_NFIT # if ACPI_NFIT=m, EDAC_I10NM can't be y
 	select DMI
 	select ACPI_ADXL
+	select EDAC_SKX_COMMON
 	help
 	  Support for error detection and correction the Intel
 	  10nm server Integrated Memory Controllers. If your
 	  system has non-volatile DIMMs you should also manually
 	  select CONFIG_ACPI_NFIT.
 
+config EDAC_SKX_COMMON
+	tristate
+	help
+	  This is an internal helper symbol to ensure that all variants
+	  of the EDAC_SKX driver are either built-in or modular, as mixing
+	  the two causes link time problems.
+
 config EDAC_PND2
 	tristate "Intel Pondicherry2"
 	depends on PCI && X86_64 && X86_MCE_INTEL
drivers/edac/Makefile +6 -2
index 89ad4a84a0f6..0f363309f662 100644
@@ -58,10 +58,14 @@ layerscape_edac_mod-y			:= fsl_ddr_edac.o layerscape_edac.o
 obj-$(CONFIG_EDAC_LAYERSCAPE)		+= layerscape_edac_mod.o
 
 skx_edac-y				:= skx_common.o skx_base.o
-obj-$(CONFIG_EDAC_SKX)			+= skx_edac.o
+ifdef CONFIG_EDAC_SKX
+obj-$(CONFIG_EDAC_SKX_COMMON)		+= skx_edac.o
+endif
 
 i10nm_edac-y				:= skx_common.o i10nm_base.o
-obj-$(CONFIG_EDAC_I10NM)		+= i10nm_edac.o
+ifdef CONFIG_EDAC_I10NM
+obj-$(CONFIG_EDAC_SKX_COMMON))		+= i10nm_edac.o
+endif
 
 obj-$(CONFIG_EDAC_MV64X60)		+= mv64x60_edac.o
 obj-$(CONFIG_EDAC_CELL)			+= cell_edac.o