Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Viresh Kumar and committed by
Rafael J. Wysocki
3ebb62ff ba0966da

+24 -81
+3 -11
Documentation/thermal/cpu-cooling-api.txt
··· 26 26 clip_cpus: cpumask of cpus where the frequency constraints will happen. 27 27 28 28 1.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 31 This interface function registers the cpufreq cooling device with 32 32 the name "thermal-cpufreq-%x" linking it with a device tree node, in 33 33 order to bind it via the thermal DT code. This api can support multiple 34 34 instances of cpufreq cooling devices. 35 35 36 - np: pointer to the cooling device device tree node 37 - clip_cpus: cpumask of cpus where the frequency constraints will happen. 36 + policy: CPUFreq policy. 38 37 39 - 1.1.3 struct thermal_cooling_device *of_cpufreq_power_cooling_register( 40 - struct cpufreq_policy *policy) 41 - 42 - Similar to cpufreq_cooling_register, this function register a 43 - cpufreq cooling device with power extensions using the device tree 44 - information supplied by the np parameter. 45 - 46 - 1.1.4 void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) 38 + 1.1.3 void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) 47 39 48 40 This interface function unregisters the "thermal-cpufreq-%x" cooling device. 49 41
+1 -1
drivers/cpufreq/arm_big_little.c
··· 532 532 if (cur_cluster >= MAX_CLUSTERS) 533 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 538 538 static struct cpufreq_driver bL_cpufreq_driver = {
+1 -1
drivers/cpufreq/cpufreq-dt.c
··· 320 320 { 321 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 326 326 static struct cpufreq_driver dt_cpufreq_driver = {
+1 -1
drivers/cpufreq/mediatek-cpufreq.c
··· 311 311 { 312 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 317 317 static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu)
+1 -1
drivers/cpufreq/qoriq-cpufreq.c
··· 276 276 { 277 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 282 282 static struct cpufreq_driver qoriq_cpufreq_driver = {
+2 -26
drivers/thermal/cpu_cooling.c
··· 819 819 820 820 /** 821 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 822 * @policy: cpufreq policy 824 823 * 825 824 * This interface function registers the cpufreq cooling device with the name ··· 826 827 * cooling devices. Using this API, the cpufreq cooling device will be 827 828 * linked to the device tree node provided. 828 829 * 829 - * Return: a valid struct thermal_cooling_device pointer on success, 830 - * on failure, it returns a corresponding ERR_PTR(). 831 - */ 832 - struct thermal_cooling_device * 833 - of_cpufreq_cooling_register(struct device_node *np, 834 - struct cpufreq_policy *policy) 835 - { 836 - if (!np) 837 - return ERR_PTR(-EINVAL); 838 - 839 - return __cpufreq_cooling_register(np, policy, 0, NULL); 840 - } 841 - EXPORT_SYMBOL_GPL(of_cpufreq_cooling_register); 842 - 843 - /** 844 - * of_cpufreq_power_cooling_register() - create cpufreq cooling device with power extensions 845 - * @policy: CPUFreq policy. 846 - * 847 - * This interface function registers the cpufreq cooling device with 848 - * the name "thermal-cpufreq-%x". This api can support multiple 849 - * instances of cpufreq cooling devices. Using this API, the cpufreq 850 - * cooling device will be linked to the device tree node of the provided 851 - * policy's CPU. 852 830 * Using this function, the cooling device will implement the power 853 831 * extensions by using a simple cpu power model. The cpus must have 854 832 * registered their OPPs using the OPP library. ··· 837 861 * and NULL on failure. 838 862 */ 839 863 struct thermal_cooling_device * 840 - of_cpufreq_power_cooling_register(struct cpufreq_policy *policy) 864 + of_cpufreq_cooling_register(struct cpufreq_policy *policy) 841 865 { 842 866 struct device_node *np = of_get_cpu_node(policy->cpu, NULL); 843 867 struct thermal_cooling_device *cdev = NULL; ··· 865 889 of_node_put(np); 866 890 return cdev; 867 891 } 868 - EXPORT_SYMBOL(of_cpufreq_power_cooling_register); 892 + EXPORT_SYMBOL_GPL(of_cpufreq_cooling_register); 869 893 870 894 /** 871 895 * cpufreq_cooling_unregister - function to remove cpufreq cooling device.
+15 -40
include/linux/cpu_cooling.h
··· 42 42 cpufreq_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 50 - struct thermal_cooling_device * 51 - of_cpufreq_cooling_register(struct device_node *np, 52 - struct cpufreq_policy *policy); 53 - 54 - struct thermal_cooling_device * 55 - of_cpufreq_power_cooling_register(struct cpufreq_policy *policy); 56 - #else 57 - static inline struct thermal_cooling_device * 58 - of_cpufreq_cooling_register(struct device_node *np, 59 - struct cpufreq_policy *policy) 60 - { 61 - return ERR_PTR(-ENOSYS); 62 - } 63 - 64 - static inline struct thermal_cooling_device * 65 - of_cpufreq_power_cooling_register(struct cpufreq_policy *policy) 66 - { 67 - return NULL; 68 - } 69 - #endif 70 - 71 - /** 72 45 * cpufreq_cooling_unregister - function to remove cpufreq cooling device. 73 46 * @cdev: thermal cooling device pointer. 74 47 */ ··· 54 81 return ERR_PTR(-ENOSYS); 55 82 } 56 83 57 - static inline struct thermal_cooling_device * 58 - of_cpufreq_cooling_register(struct device_node *np, 59 - struct cpufreq_policy *policy) 60 - { 61 - return ERR_PTR(-ENOSYS); 62 - } 63 - 64 - static inline struct thermal_cooling_device * 65 - of_cpufreq_power_cooling_register(struct cpufreq_policy *policy) 66 - { 67 - return NULL; 68 - } 69 - 70 84 static inline 71 85 void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) 72 86 { 73 87 return; 74 88 } 75 89 #endif /* CONFIG_CPU_THERMAL */ 90 + 91 + #if defined(CONFIG_THERMAL_OF) && defined(CONFIG_CPU_THERMAL) 92 + /** 93 + * of_cpufreq_cooling_register - create cpufreq cooling device based on DT. 94 + * @policy: cpufreq policy. 95 + */ 96 + struct thermal_cooling_device * 97 + of_cpufreq_cooling_register(struct cpufreq_policy *policy); 98 + #else 99 + static inline struct thermal_cooling_device * 100 + of_cpufreq_cooling_register(struct cpufreq_policy *policy) 101 + { 102 + return NULL; 103 + } 104 + #endif /* defined(CONFIG_THERMAL_OF) && defined(CONFIG_CPU_THERMAL) */ 76 105 77 106 #endif /* __CPU_COOLING_H__ */