thermal: cpu_cooling: add function which copies cpumask
authorLukasz Luba <l.luba@partner.samsung.com>
Tue, 6 Nov 2018 16:45:49 +0000 (17:45 +0100)
committerLukasz Luba <l.luba@partner.samsung.com>
Fri, 17 May 2019 07:15:44 +0000 (09:15 +0200)
The patch add fnction which provides information which CPUs
are pinned to the related cpufreq cooling device.

Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
drivers/thermal/cpu_cooling.c
include/linux/cpu_cooling.h

index 0360cdd0826bb92ac57ff65eeada81ebcac6ab1a..f27f1636803c9a697bdc39ae98fb43a25796551b 100644 (file)
@@ -755,6 +755,22 @@ bool cpufreq_cooling_test_related_cpu(struct thermal_cooling_device *cdev,
 }
 EXPORT_SYMBOL_GPL(cpufreq_cooling_test_related_cpu);
 
+void cpufreq_cooling_copy_cpumask(struct thermal_cooling_device *cdev,
+                                 struct cpumask *dstmask)
+{
+       struct cpufreq_cooling_device *cpufreq_cdev;
+       struct cpufreq_policy *policy;
+
+       if (cdev && cdev->devdata) {
+               cpufreq_cdev = cdev->devdata;
+               if (cpufreq_cdev->policy) {
+                       policy = cpufreq_cdev->policy;
+                       cpumask_copy(dstmask, policy->related_cpus);
+               }
+       }
+}
+EXPORT_SYMBOL_GPL(cpufreq_cooling_copy_cpumask);
+
 /**
  * of_cpufreq_cooling_register - function to create cpufreq cooling device.
  * @policy: cpufreq policy
index ea609f7bdf55f55fcbe2b56d6b1a9a5b4bed3329..fee20e0a5fed07ef385ab66869edae5406f0ce7a 100644 (file)
@@ -50,6 +50,9 @@ bool cpufreq_cooling_test_related_cpu(struct thermal_cooling_device *cdev,
 struct cpumask
 *cpufreq_cooling_get_related_cpumask(struct thermal_cooling_device *cdev);
 
+void cpufreq_cooling_copy_cpumask(struct thermal_cooling_device *cdev,
+                                 struct cpumask *dstmask);
+
 #else /* !CONFIG_CPU_THERMAL */
 static inline struct thermal_cooling_device *
 cpufreq_cooling_register(struct cpufreq_policy *policy)
@@ -75,6 +78,9 @@ struct cpumask
 {
        return NULL;
 }
+
+void cpufreq_cooling_copy_cpumask(struct thermal_cooling_device *cdev,
+                                 struct cpumask *dstmask) {}
 #endif /* CONFIG_CPU_THERMAL */
 
 #if defined(CONFIG_THERMAL_OF) && defined(CONFIG_CPU_THERMAL)