Commit afa1f2ab authored by Amit Kucheria's avatar Amit Kucheria Committed by Rafael J. Wysocki
Browse files

thermal: cpu_cooling: Require thermal core to be compiled in



The CPU cooling driver (cpu_cooling.c) allows the platform's cpufreq
driver to register as a cooling device and cool down the platform by
throttling the CPU frequency. In order to be able to auto-register a
cpufreq driver as a cooling device from the cpufreq core, we need access
to code inside cpu_cooling.c which, in turn, accesses code inside
thermal core.

CPU_FREQ is a bool while THERMAL is tristate.  In some configurations
(e.g. allmodconfig), CONFIG_THERMAL ends up as a module while
CONFIG_CPU_FREQ is compiled in. This leads to following error:

drivers/cpufreq/cpufreq.o: In function `cpufreq_offline':
cpufreq.c:(.text+0x407c): undefined reference to `cpufreq_cooling_unregister'
drivers/cpufreq/cpufreq.o: In function `cpufreq_online':
cpufreq.c:(.text+0x70c0): undefined reference to `of_cpufreq_cooling_register'

Given that platforms using CPU_THERMAL usually want it compiled-in so it
is available early in boot, make CPU_THERMAL depend on THERMAL being
compiled-in instead of allowing it to be a module.

As a result of this change, get rid of the ugly (!CPU_THERMAL ||
THERMAL) dependency in all cpufreq drivers using CPU_THERMAL.

Suggested-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarAmit Kucheria <amit.kucheria@linaro.org>
Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 625c85a6
Loading
Loading
Loading
Loading
+0 −3
Original line number Original line Diff line number Diff line
@@ -207,8 +207,6 @@ comment "CPU frequency scaling drivers"
config CPUFREQ_DT
config CPUFREQ_DT
	tristate "Generic DT based cpufreq driver"
	tristate "Generic DT based cpufreq driver"
	depends on HAVE_CLK && OF
	depends on HAVE_CLK && OF
	# if CPU_THERMAL is on and THERMAL=m, CPUFREQ_DT cannot be =y:
	depends on !CPU_THERMAL || THERMAL
	select CPUFREQ_DT_PLATDEV
	select CPUFREQ_DT_PLATDEV
	select PM_OPP
	select PM_OPP
	help
	help
@@ -327,7 +325,6 @@ endif
config QORIQ_CPUFREQ
config QORIQ_CPUFREQ
	tristate "CPU frequency scaling driver for Freescale QorIQ SoCs"
	tristate "CPU frequency scaling driver for Freescale QorIQ SoCs"
	depends on OF && COMMON_CLK && (PPC_E500MC || ARM || ARM64)
	depends on OF && COMMON_CLK && (PPC_E500MC || ARM || ARM64)
	depends on !CPU_THERMAL || THERMAL
	select CLK_QORIQ
	select CLK_QORIQ
	help
	help
	  This adds the CPUFreq driver support for Freescale QorIQ SoCs
	  This adds the CPUFreq driver support for Freescale QorIQ SoCs
+0 −5
Original line number Original line Diff line number Diff line
@@ -29,8 +29,6 @@ config ARM_ARMADA_37XX_CPUFREQ
config ARM_BIG_LITTLE_CPUFREQ
config ARM_BIG_LITTLE_CPUFREQ
	tristate "Generic ARM big LITTLE CPUfreq driver"
	tristate "Generic ARM big LITTLE CPUfreq driver"
	depends on ARM_CPU_TOPOLOGY && HAVE_CLK
	depends on ARM_CPU_TOPOLOGY && HAVE_CLK
	# if CPU_THERMAL is on and THERMAL=m, ARM_BIT_LITTLE_CPUFREQ cannot be =y
	depends on !CPU_THERMAL || THERMAL
	select PM_OPP
	select PM_OPP
	help
	help
	  This enables the Generic CPUfreq driver for ARM big.LITTLE platforms.
	  This enables the Generic CPUfreq driver for ARM big.LITTLE platforms.
@@ -38,7 +36,6 @@ config ARM_BIG_LITTLE_CPUFREQ
config ARM_SCPI_CPUFREQ
config ARM_SCPI_CPUFREQ
	tristate "SCPI based CPUfreq driver"
	tristate "SCPI based CPUfreq driver"
	depends on ARM_SCPI_PROTOCOL && COMMON_CLK_SCPI
	depends on ARM_SCPI_PROTOCOL && COMMON_CLK_SCPI
	depends on !CPU_THERMAL || THERMAL
	help
	help
	  This adds the CPUfreq driver support for ARM platforms using SCPI
	  This adds the CPUfreq driver support for ARM platforms using SCPI
	  protocol for CPU power management.
	  protocol for CPU power management.
@@ -93,7 +90,6 @@ config ARM_KIRKWOOD_CPUFREQ
config ARM_MEDIATEK_CPUFREQ
config ARM_MEDIATEK_CPUFREQ
	tristate "CPU Frequency scaling support for MediaTek SoCs"
	tristate "CPU Frequency scaling support for MediaTek SoCs"
	depends on ARCH_MEDIATEK && REGULATOR
	depends on ARCH_MEDIATEK && REGULATOR
	depends on !CPU_THERMAL || THERMAL
	select PM_OPP
	select PM_OPP
	help
	help
	  This adds the CPUFreq driver support for MediaTek SoCs.
	  This adds the CPUFreq driver support for MediaTek SoCs.
@@ -233,7 +229,6 @@ config ARM_SA1110_CPUFREQ
config ARM_SCMI_CPUFREQ
config ARM_SCMI_CPUFREQ
	tristate "SCMI based CPUfreq driver"
	tristate "SCMI based CPUfreq driver"
	depends on ARM_SCMI_PROTOCOL || COMPILE_TEST
	depends on ARM_SCMI_PROTOCOL || COMPILE_TEST
	depends on !CPU_THERMAL || THERMAL
	select PM_OPP
	select PM_OPP
	help
	help
	  This adds the CPUfreq driver support for ARM platforms using SCMI
	  This adds the CPUfreq driver support for ARM platforms using SCMI
+1 −0
Original line number Original line Diff line number Diff line
@@ -152,6 +152,7 @@ config CPU_THERMAL
	bool "generic cpu cooling support"
	bool "generic cpu cooling support"
	depends on CPU_FREQ
	depends on CPU_FREQ
	depends on THERMAL_OF
	depends on THERMAL_OF
	depends on THERMAL=y
	help
	help
	  This implements the generic cpu cooling mechanism through frequency
	  This implements the generic cpu cooling mechanism through frequency
	  reduction. An ACPI version of this already exists
	  reduction. An ACPI version of this already exists