thermal: cpu_cooling: add function showing CPUs in cooling dev
authorLukasz Luba <l.luba@partner.samsung.com>
Tue, 30 Oct 2018 12:22:15 +0000 (13:22 +0100)
committerLukasz Luba <l.luba@partner.samsung.com>
Fri, 17 May 2019 07:15:40 +0000 (09:15 +0200)
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
include/linux/cpu_cooling.h

index 7b998297db2057703b73e2f889a19dd438fe05c6..ecff9740cbf02963c8708454abe03ec625184271 100644 (file)
@@ -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
index c875cde35879e02a7106f2dab87da52352925b85..ea609f7bdf55f55fcbe2b56d6b1a9a5b4bed3329 100644 (file)
@@ -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)