cpufreq: Move the IS_ENABLED(CPU_THERMAL) macro into a stub
cpufreq_online() and cpufreq_offline() [un]register the driver as a cooling device. This is done if the driver is flagged as a cooling device in addition with an IS_ENABLED() check to compile out the branching code. Group this test in a stub function added in the cpufreq header instead of having the IS_ENABLED() in the code. Suggested-by: Rafael J. Wysocki <rafael@kernel.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
fba7402017
commit
bcc6156999
|
@ -1378,8 +1378,7 @@ static int cpufreq_online(unsigned int cpu)
|
||||||
if (cpufreq_driver->ready)
|
if (cpufreq_driver->ready)
|
||||||
cpufreq_driver->ready(policy);
|
cpufreq_driver->ready(policy);
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_CPU_THERMAL) &&
|
if (cpufreq_thermal_control_enabled(cpufreq_driver))
|
||||||
cpufreq_driver->flags & CPUFREQ_IS_COOLING_DEV)
|
|
||||||
policy->cdev = of_cpufreq_cooling_register(policy);
|
policy->cdev = of_cpufreq_cooling_register(policy);
|
||||||
|
|
||||||
pr_debug("initialization complete\n");
|
pr_debug("initialization complete\n");
|
||||||
|
@ -1469,8 +1468,7 @@ static int cpufreq_offline(unsigned int cpu)
|
||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_CPU_THERMAL) &&
|
if (cpufreq_thermal_control_enabled(cpufreq_driver)) {
|
||||||
cpufreq_driver->flags & CPUFREQ_IS_COOLING_DEV) {
|
|
||||||
cpufreq_cooling_unregister(policy->cdev);
|
cpufreq_cooling_unregister(policy->cdev);
|
||||||
policy->cdev = NULL;
|
policy->cdev = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -409,6 +409,12 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);
|
||||||
const char *cpufreq_get_current_driver(void);
|
const char *cpufreq_get_current_driver(void);
|
||||||
void *cpufreq_get_driver_data(void);
|
void *cpufreq_get_driver_data(void);
|
||||||
|
|
||||||
|
static inline int cpufreq_thermal_control_enabled(struct cpufreq_driver *drv)
|
||||||
|
{
|
||||||
|
return IS_ENABLED(CONFIG_CPU_THERMAL) &&
|
||||||
|
(drv->flags & CPUFREQ_IS_COOLING_DEV);
|
||||||
|
}
|
||||||
|
|
||||||
static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy,
|
static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy,
|
||||||
unsigned int min, unsigned int max)
|
unsigned int min, unsigned int max)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue