Implent basic function which returns affected CPUs mask for a given CPU in the cooling device.
Signed-off-by: Lukasz Luba l.luba@partner.samsung.com --- drivers/thermal/thermal_core.c | 18 ++++++++++++++++++ include/linux/cpu_cooling.h | 8 ++++++++ 2 files changed, 26 insertions(+)
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 7b998297db20..ecff9740cbf0 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -844,6 +844,24 @@ static void thermal_cpu_cdev_init_weight(int cpu, unsigned int weight) sched_power_cpu_reinit_weight(cpu, weight); }
+struct cpumask *thermal_cpu_cooling_get_cpumask(int cpu) +{ + struct cpumask *cpus = NULL; + struct thermal_cooling_device *cdev; + struct thermal_instance *instance; + struct thermal_zone_device *tz; + + mutex_lock(&thermal_list_lock); + list_for_each_entry(cdev, &thermal_cdev_list, node) { + if (cpufreq_cooling_test_related_cpu(cdev, cpu)) { + /* cpus = cpufreq_cooling_get_related_cpumask(cdev); */ + break; + } + } + + mutex_unlock(&thermal_list_lock); + return cpus; +}
/** * thermal_zone_unbind_cooling_device() - unbind a cooling device from a diff --git a/include/linux/cpu_cooling.h b/include/linux/cpu_cooling.h index c875cde35879..ea609f7bdf55 100644 --- a/include/linux/cpu_cooling.h +++ b/include/linux/cpu_cooling.h @@ -47,6 +47,8 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev);
bool cpufreq_cooling_test_related_cpu(struct thermal_cooling_device *cdev, int cpu); +struct cpumask +*cpufreq_cooling_get_related_cpumask(struct thermal_cooling_device *cdev);
#else /* !CONFIG_CPU_THERMAL */ static inline struct thermal_cooling_device * @@ -67,6 +69,12 @@ bool cpufreq_cooling_test_related_cpu(struct thermal_cooling_device *cdev, { return false; } + +struct cpumask +*cpufreq_cooling_get_related_cpumask(struct thermal_cooling_device *cdev) +{ + return NULL; +} #endif /* CONFIG_CPU_THERMAL */
#if defined(CONFIG_THERMAL_OF) && defined(CONFIG_CPU_THERMAL)