浏览代码

EDAC, skx: Fix randconfig builds

The driver depends on the ADXL component glue and selects it. However,
ADXL itself implicitly depends on ACPI and in nonsensical randconfig
builds like this:

  # CONFIG_ACPI is not set
  CONFIG_ACPI_ADXL=y

where ACPI is not enabled, the build fails with:

  drivers/edac/skx_edac.o: In function `skx_mce_check_error':
  skx_edac.c:(.text+0xab): undefined reference to `adxl_decode'
  drivers/edac/skx_edac.o: In function `skx_init':
  skx_edac.c:(.init.text+0x8bf): undefined reference to `adxl_get_component_names'
  make: *** [vmlinux] Error 1

Add stubs for that case so that the build succeeds. CONFIG_ACPI=n
doesn't make any sense for real configurations but this fix will at
least silence randconfig builds.

Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Tony Luck <tony.luck@intel.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Borislav Petkov 6 年之前
父节点
当前提交
a324e9396c
共有 2 个文件被更改,包括 6 次插入1 次删除
  1. 1 1
      drivers/edac/Kconfig
  2. 5 0
      include/linux/adxl.h

+ 1 - 1
drivers/edac/Kconfig

@@ -234,7 +234,7 @@ config EDAC_SKX
 	depends on PCI && X86_64 && X86_MCE_INTEL && PCI_MMCONFIG
 	depends on PCI && X86_64 && X86_MCE_INTEL && PCI_MMCONFIG
 	depends on ACPI_NFIT || !ACPI_NFIT # if ACPI_NFIT=m, EDAC_SKX can't be y
 	depends on ACPI_NFIT || !ACPI_NFIT # if ACPI_NFIT=m, EDAC_SKX can't be y
 	select DMI
 	select DMI
-	select ACPI_ADXL
+	select ACPI_ADXL if ACPI
 	help
 	help
 	  Support for error detection and correction the Intel
 	  Support for error detection and correction the Intel
 	  Skylake server Integrated Memory Controllers. If your
 	  Skylake server Integrated Memory Controllers. If your

+ 5 - 0
include/linux/adxl.h

@@ -7,7 +7,12 @@
 #ifndef _LINUX_ADXL_H
 #ifndef _LINUX_ADXL_H
 #define _LINUX_ADXL_H
 #define _LINUX_ADXL_H
 
 
+#ifdef CONFIG_ACPI_ADXL
 const char * const *adxl_get_component_names(void);
 const char * const *adxl_get_component_names(void);
 int adxl_decode(u64 addr, u64 component_values[]);
 int adxl_decode(u64 addr, u64 component_values[]);
+#else
+static inline const char * const *adxl_get_component_names(void)  { return NULL; }
+static inline int adxl_decode(u64 addr, u64 component_values[])   { return  -EOPNOTSUPP; }
+#endif
 
 
 #endif /* _LINUX_ADXL_H */
 #endif /* _LINUX_ADXL_H */