thermal: cpu_cooling: Require thermal core to be compiled in
authorAmit Kucheria <amit.kucheria@linaro.org>
Tue, 29 Jan 2019 04:55:07 +0000 (10:25 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 29 Jan 2019 10:46:31 +0000 (11:46 +0100)
commitafa1f2ab43d48d0e1fa1bda524a0cf53e4cd6c87
tree5b2e70efe058376f7d3a50c3c4b83b27e273d00f
parent625c85a62cb7d3c79f6e16de3cfa972033658250
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: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/Kconfig
drivers/cpufreq/Kconfig.arm
drivers/thermal/Kconfig