aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2017-12-05 00:32:45 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-12-07 16:52:01 -0500
commit3ebb62ffc4e4817c3288cdf7ed67ccaf453385e3 (patch)
treeda03e6ce681e3777478267971555d7e6646e6cf3
parentba0966da208ef0793486502a0e6b929fbd6d4223 (diff)
cpu_cooling: Keep only one of_cpufreq*cooling_register() helper
of_cpufreq_cooling_register() isn't used by anyone and so can be removed, but then we would be left with two routines: cpufreq_cooling_register() and of_cpufreq_power_cooling_register() that would look odd. Remove current implementation of of_cpufreq_cooling_register() and rename of_cpufreq_power_cooling_register() as of_cpufreq_cooling_register(). This simplifies lots of stuff. Acked-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--Documentation/thermal/cpu-cooling-api.txt14
-rw-r--r--drivers/cpufreq/arm_big_little.c2
-rw-r--r--drivers/cpufreq/cpufreq-dt.c2
-rw-r--r--drivers/cpufreq/mediatek-cpufreq.c2
-rw-r--r--drivers/cpufreq/qoriq-cpufreq.c2
-rw-r--r--drivers/thermal/cpu_cooling.c28
-rw-r--r--include/linux/cpu_cooling.h53
7 files changed, 23 insertions, 80 deletions
diff --git a/Documentation/thermal/cpu-cooling-api.txt b/Documentation/thermal/cpu-cooling-api.txt
index ea61e8bf7e2b..7a1c89db0419 100644
--- a/Documentation/thermal/cpu-cooling-api.txt
+++ b/Documentation/thermal/cpu-cooling-api.txt
@@ -26,24 +26,16 @@ the user. The registration APIs returns the cooling device pointer.
26 clip_cpus: cpumask of cpus where the frequency constraints will happen. 26 clip_cpus: cpumask of cpus where the frequency constraints will happen.
27 27
281.1.2 struct thermal_cooling_device *of_cpufreq_cooling_register( 281.1.2 struct thermal_cooling_device *of_cpufreq_cooling_register(
29 struct device_node *np, const struct cpumask *clip_cpus) 29 struct cpufreq_policy *policy)
30 30
31 This interface function registers the cpufreq cooling device with 31 This interface function registers the cpufreq cooling device with
32 the name "thermal-cpufreq-%x" linking it with a device tree node, in 32 the name "thermal-cpufreq-%x" linking it with a device tree node, in
33 order to bind it via the thermal DT code. This api can support multiple 33 order to bind it via the thermal DT code. This api can support multiple
34 instances of cpufreq cooling devices. 34 instances of cpufreq cooling devices.
35 35
36 np: pointer to the cooling device device tree node 36 policy: CPUFreq policy.
37 clip_cpus: cpumask of cpus where the frequency constraints will happen.
38
391.1.3 struct thermal_cooling_device *of_cpufreq_power_cooling_register(
40 struct cpufreq_policy *policy)
41
42Similar to cpufreq_cooling_register, this function register a
43cpufreq cooling device with power extensions using the device tree
44information supplied by the np parameter.
45 37
461.1.4 void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) 381.1.3 void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
47 39
48 This interface function unregisters the "thermal-cpufreq-%x" cooling device. 40 This interface function unregisters the "thermal-cpufreq-%x" cooling device.
49 41
diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c
index 3d5ed4ef3927..c56b57dcfda5 100644
--- a/drivers/cpufreq/arm_big_little.c
+++ b/drivers/cpufreq/arm_big_little.c
@@ -532,7 +532,7 @@ static void bL_cpufreq_ready(struct cpufreq_policy *policy)
532 if (cur_cluster >= MAX_CLUSTERS) 532 if (cur_cluster >= MAX_CLUSTERS)
533 return; 533 return;
534 534
535 cdev[cur_cluster] = of_cpufreq_power_cooling_register(policy); 535 cdev[cur_cluster] = of_cpufreq_cooling_register(policy);
536} 536}
537 537
538static struct cpufreq_driver bL_cpufreq_driver = { 538static struct cpufreq_driver bL_cpufreq_driver = {
diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
index 1e7bec7694ab..de3d104c25d7 100644
--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -320,7 +320,7 @@ static void cpufreq_ready(struct cpufreq_policy *policy)
320{ 320{
321 struct private_data *priv = policy->driver_data; 321 struct private_data *priv = policy->driver_data;
322 322
323 priv->cdev = of_cpufreq_power_cooling_register(policy); 323 priv->cdev = of_cpufreq_cooling_register(policy);
324} 324}
325 325
326static struct cpufreq_driver dt_cpufreq_driver = { 326static struct cpufreq_driver dt_cpufreq_driver = {
diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c
index 6ff783e1b18a..f95975b76d98 100644
--- a/drivers/cpufreq/mediatek-cpufreq.c
+++ b/drivers/cpufreq/mediatek-cpufreq.c
@@ -311,7 +311,7 @@ static void mtk_cpufreq_ready(struct cpufreq_policy *policy)
311{ 311{
312 struct mtk_cpu_dvfs_info *info = policy->driver_data; 312 struct mtk_cpu_dvfs_info *info = policy->driver_data;
313 313
314 info->cdev = of_cpufreq_power_cooling_register(policy); 314 info->cdev = of_cpufreq_cooling_register(policy);
315} 315}
316 316
317static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu) 317static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu)
diff --git a/drivers/cpufreq/qoriq-cpufreq.c b/drivers/cpufreq/qoriq-cpufreq.c
index 3a665c18e14e..0562761a3dec 100644
--- a/drivers/cpufreq/qoriq-cpufreq.c
+++ b/drivers/cpufreq/qoriq-cpufreq.c
@@ -276,7 +276,7 @@ static void qoriq_cpufreq_ready(struct cpufreq_policy *policy)
276{ 276{
277 struct cpu_data *cpud = policy->driver_data; 277 struct cpu_data *cpud = policy->driver_data;
278 278
279 cpud->cdev = of_cpufreq_power_cooling_register(policy); 279 cpud->cdev = of_cpufreq_cooling_register(policy);
280} 280}
281 281
282static struct cpufreq_driver qoriq_cpufreq_driver = { 282static struct cpufreq_driver qoriq_cpufreq_driver = {
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
index 10199f7e1196..3371caf3095c 100644
--- a/drivers/thermal/cpu_cooling.c
+++ b/drivers/thermal/cpu_cooling.c
@@ -819,7 +819,6 @@ EXPORT_SYMBOL_GPL(cpufreq_cooling_register);
819 819
820/** 820/**
821 * of_cpufreq_cooling_register - function to create cpufreq cooling device. 821 * of_cpufreq_cooling_register - function to create cpufreq cooling device.
822 * @np: a valid struct device_node to the cooling device device tree node
823 * @policy: cpufreq policy 822 * @policy: cpufreq policy
824 * 823 *
825 * This interface function registers the cpufreq cooling device with the name 824 * This interface function registers the cpufreq cooling device with the name
@@ -827,29 +826,6 @@ EXPORT_SYMBOL_GPL(cpufreq_cooling_register);
827 * cooling devices. Using this API, the cpufreq cooling device will be 826 * cooling devices. Using this API, the cpufreq cooling device will be
828 * linked to the device tree node provided. 827 * linked to the device tree node provided.
829 * 828 *
830 * Return: a valid struct thermal_cooling_device pointer on success,
831 * on failure, it returns a corresponding ERR_PTR().
832 */
833struct thermal_cooling_device *
834of_cpufreq_cooling_register(struct device_node *np,
835 struct cpufreq_policy *policy)
836{
837 if (!np)
838 return ERR_PTR(-EINVAL);
839
840 return __cpufreq_cooling_register(np, policy, 0, NULL);
841}
842EXPORT_SYMBOL_GPL(of_cpufreq_cooling_register);
843
844/**
845 * of_cpufreq_power_cooling_register() - create cpufreq cooling device with power extensions
846 * @policy: CPUFreq policy.
847 *
848 * This interface function registers the cpufreq cooling device with
849 * the name "thermal-cpufreq-%x". This api can support multiple
850 * instances of cpufreq cooling devices. Using this API, the cpufreq
851 * cooling device will be linked to the device tree node of the provided
852 * policy's CPU.
853 * Using this function, the cooling device will implement the power 829 * Using this function, the cooling device will implement the power
854 * extensions by using a simple cpu power model. The cpus must have 830 * extensions by using a simple cpu power model. The cpus must have
855 * registered their OPPs using the OPP library. 831 * registered their OPPs using the OPP library.
@@ -861,7 +837,7 @@ EXPORT_SYMBOL_GPL(of_cpufreq_cooling_register);
861 * and NULL on failure. 837 * and NULL on failure.
862 */ 838 */
863struct thermal_cooling_device * 839struct thermal_cooling_device *
864of_cpufreq_power_cooling_register(struct cpufreq_policy *policy) 840of_cpufreq_cooling_register(struct cpufreq_policy *policy)
865{ 841{
866 struct device_node *np = of_get_cpu_node(policy->cpu, NULL); 842 struct device_node *np = of_get_cpu_node(policy->cpu, NULL);
867 struct thermal_cooling_device *cdev = NULL; 843 struct thermal_cooling_device *cdev = NULL;
@@ -889,7 +865,7 @@ of_cpufreq_power_cooling_register(struct cpufreq_policy *policy)
889 of_node_put(np); 865 of_node_put(np);
890 return cdev; 866 return cdev;
891} 867}
892EXPORT_SYMBOL(of_cpufreq_power_cooling_register); 868EXPORT_SYMBOL_GPL(of_cpufreq_cooling_register);
893 869
894/** 870/**
895 * cpufreq_cooling_unregister - function to remove cpufreq cooling device. 871 * cpufreq_cooling_unregister - function to remove cpufreq cooling device.
diff --git a/include/linux/cpu_cooling.h b/include/linux/cpu_cooling.h
index c35778960a9c..fd0ea8ddca93 100644
--- a/include/linux/cpu_cooling.h
+++ b/include/linux/cpu_cooling.h
@@ -42,33 +42,6 @@ struct thermal_cooling_device *
42cpufreq_cooling_register(struct cpufreq_policy *policy); 42cpufreq_cooling_register(struct cpufreq_policy *policy);
43 43
44/** 44/**
45 * of_cpufreq_cooling_register - create cpufreq cooling device based on DT.
46 * @np: a valid struct device_node to the cooling device device tree node.
47 * @policy: cpufreq policy.
48 */
49#ifdef CONFIG_THERMAL_OF
50struct thermal_cooling_device *
51of_cpufreq_cooling_register(struct device_node *np,
52 struct cpufreq_policy *policy);
53
54struct thermal_cooling_device *
55of_cpufreq_power_cooling_register(struct cpufreq_policy *policy);
56#else
57static inline struct thermal_cooling_device *
58of_cpufreq_cooling_register(struct device_node *np,
59 struct cpufreq_policy *policy)
60{
61 return ERR_PTR(-ENOSYS);
62}
63
64static inline struct thermal_cooling_device *
65of_cpufreq_power_cooling_register(struct cpufreq_policy *policy)
66{
67 return NULL;
68}
69#endif
70
71/**
72 * cpufreq_cooling_unregister - function to remove cpufreq cooling device. 45 * cpufreq_cooling_unregister - function to remove cpufreq cooling device.
73 * @cdev: thermal cooling device pointer. 46 * @cdev: thermal cooling device pointer.
74 */ 47 */
@@ -81,24 +54,26 @@ cpufreq_cooling_register(struct cpufreq_policy *policy)
81 return ERR_PTR(-ENOSYS); 54 return ERR_PTR(-ENOSYS);
82} 55}
83 56
84static inline struct thermal_cooling_device * 57static inline
85of_cpufreq_cooling_register(struct device_node *np, 58void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
86 struct cpufreq_policy *policy)
87{ 59{
88 return ERR_PTR(-ENOSYS); 60 return;
89} 61}
62#endif /* CONFIG_CPU_THERMAL */
90 63
64#if defined(CONFIG_THERMAL_OF) && defined(CONFIG_CPU_THERMAL)
65/**
66 * of_cpufreq_cooling_register - create cpufreq cooling device based on DT.
67 * @policy: cpufreq policy.
68 */
69struct thermal_cooling_device *
70of_cpufreq_cooling_register(struct cpufreq_policy *policy);
71#else
91static inline struct thermal_cooling_device * 72static inline struct thermal_cooling_device *
92of_cpufreq_power_cooling_register(struct cpufreq_policy *policy) 73of_cpufreq_cooling_register(struct cpufreq_policy *policy)
93{ 74{
94 return NULL; 75 return NULL;
95} 76}
96 77#endif /* defined(CONFIG_THERMAL_OF) && defined(CONFIG_CPU_THERMAL) */
97static inline
98void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
99{
100 return;
101}
102#endif /* CONFIG_CPU_THERMAL */
103 78
104#endif /* __CPU_COOLING_H__ */ 79#endif /* __CPU_COOLING_H__ */