Commit 3ebb62ff authored by Viresh Kumar's avatar Viresh Kumar Committed by Rafael J. Wysocki

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: default avatarEduardo Valentin <edubezval@gmail.com>
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent ba0966da
...@@ -26,24 +26,16 @@ the user. The registration APIs returns the cooling device pointer. ...@@ -26,24 +26,16 @@ the user. The registration APIs returns the cooling device pointer.
clip_cpus: cpumask of cpus where the frequency constraints will happen. clip_cpus: cpumask of cpus where the frequency constraints will happen.
1.1.2 struct thermal_cooling_device *of_cpufreq_cooling_register( 1.1.2 struct thermal_cooling_device *of_cpufreq_cooling_register(
struct device_node *np, const struct cpumask *clip_cpus) struct cpufreq_policy *policy)
This interface function registers the cpufreq cooling device with This interface function registers the cpufreq cooling device with
the name "thermal-cpufreq-%x" linking it with a device tree node, in the name "thermal-cpufreq-%x" linking it with a device tree node, in
order to bind it via the thermal DT code. This api can support multiple order to bind it via the thermal DT code. This api can support multiple
instances of cpufreq cooling devices. instances of cpufreq cooling devices.
np: pointer to the cooling device device tree node policy: CPUFreq policy.
clip_cpus: cpumask of cpus where the frequency constraints will happen.
1.1.3 struct thermal_cooling_device *of_cpufreq_power_cooling_register(
struct cpufreq_policy *policy)
Similar to cpufreq_cooling_register, this function register a
cpufreq cooling device with power extensions using the device tree
information supplied by the np parameter.
1.1.4 void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) 1.1.3 void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
This interface function unregisters the "thermal-cpufreq-%x" cooling device. This interface function unregisters the "thermal-cpufreq-%x" cooling device.
......
...@@ -532,7 +532,7 @@ static void bL_cpufreq_ready(struct cpufreq_policy *policy) ...@@ -532,7 +532,7 @@ static void bL_cpufreq_ready(struct cpufreq_policy *policy)
if (cur_cluster >= MAX_CLUSTERS) if (cur_cluster >= MAX_CLUSTERS)
return; return;
cdev[cur_cluster] = of_cpufreq_power_cooling_register(policy); cdev[cur_cluster] = of_cpufreq_cooling_register(policy);
} }
static struct cpufreq_driver bL_cpufreq_driver = { static struct cpufreq_driver bL_cpufreq_driver = {
......
...@@ -320,7 +320,7 @@ static void cpufreq_ready(struct cpufreq_policy *policy) ...@@ -320,7 +320,7 @@ static void cpufreq_ready(struct cpufreq_policy *policy)
{ {
struct private_data *priv = policy->driver_data; struct private_data *priv = policy->driver_data;
priv->cdev = of_cpufreq_power_cooling_register(policy); priv->cdev = of_cpufreq_cooling_register(policy);
} }
static struct cpufreq_driver dt_cpufreq_driver = { static struct cpufreq_driver dt_cpufreq_driver = {
......
...@@ -311,7 +311,7 @@ static void mtk_cpufreq_ready(struct cpufreq_policy *policy) ...@@ -311,7 +311,7 @@ static void mtk_cpufreq_ready(struct cpufreq_policy *policy)
{ {
struct mtk_cpu_dvfs_info *info = policy->driver_data; struct mtk_cpu_dvfs_info *info = policy->driver_data;
info->cdev = of_cpufreq_power_cooling_register(policy); info->cdev = of_cpufreq_cooling_register(policy);
} }
static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu) static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu)
......
...@@ -276,7 +276,7 @@ static void qoriq_cpufreq_ready(struct cpufreq_policy *policy) ...@@ -276,7 +276,7 @@ static void qoriq_cpufreq_ready(struct cpufreq_policy *policy)
{ {
struct cpu_data *cpud = policy->driver_data; struct cpu_data *cpud = policy->driver_data;
cpud->cdev = of_cpufreq_power_cooling_register(policy); cpud->cdev = of_cpufreq_cooling_register(policy);
} }
static struct cpufreq_driver qoriq_cpufreq_driver = { static struct cpufreq_driver qoriq_cpufreq_driver = {
......
...@@ -819,7 +819,6 @@ EXPORT_SYMBOL_GPL(cpufreq_cooling_register); ...@@ -819,7 +819,6 @@ EXPORT_SYMBOL_GPL(cpufreq_cooling_register);
/** /**
* of_cpufreq_cooling_register - function to create cpufreq cooling device. * of_cpufreq_cooling_register - function to create cpufreq cooling device.
* @np: a valid struct device_node to the cooling device device tree node
* @policy: cpufreq policy * @policy: cpufreq policy
* *
* This interface function registers the cpufreq cooling device with the name * This interface function registers the cpufreq cooling device with the name
...@@ -827,29 +826,6 @@ EXPORT_SYMBOL_GPL(cpufreq_cooling_register); ...@@ -827,29 +826,6 @@ EXPORT_SYMBOL_GPL(cpufreq_cooling_register);
* cooling devices. Using this API, the cpufreq cooling device will be * cooling devices. Using this API, the cpufreq cooling device will be
* linked to the device tree node provided. * linked to the device tree node provided.
* *
* Return: a valid struct thermal_cooling_device pointer on success,
* on failure, it returns a corresponding ERR_PTR().
*/
struct thermal_cooling_device *
of_cpufreq_cooling_register(struct device_node *np,
struct cpufreq_policy *policy)
{
if (!np)
return ERR_PTR(-EINVAL);
return __cpufreq_cooling_register(np, policy, 0, NULL);
}
EXPORT_SYMBOL_GPL(of_cpufreq_cooling_register);
/**
* of_cpufreq_power_cooling_register() - create cpufreq cooling device with power extensions
* @policy: CPUFreq policy.
*
* This interface function registers the cpufreq cooling device with
* the name "thermal-cpufreq-%x". This api can support multiple
* instances of cpufreq cooling devices. Using this API, the cpufreq
* cooling device will be linked to the device tree node of the provided
* policy's CPU.
* Using this function, the cooling device will implement the power * Using this function, the cooling device will implement the power
* extensions by using a simple cpu power model. The cpus must have * extensions by using a simple cpu power model. The cpus must have
* registered their OPPs using the OPP library. * registered their OPPs using the OPP library.
...@@ -861,7 +837,7 @@ EXPORT_SYMBOL_GPL(of_cpufreq_cooling_register); ...@@ -861,7 +837,7 @@ EXPORT_SYMBOL_GPL(of_cpufreq_cooling_register);
* and NULL on failure. * and NULL on failure.
*/ */
struct thermal_cooling_device * struct thermal_cooling_device *
of_cpufreq_power_cooling_register(struct cpufreq_policy *policy) of_cpufreq_cooling_register(struct cpufreq_policy *policy)
{ {
struct device_node *np = of_get_cpu_node(policy->cpu, NULL); struct device_node *np = of_get_cpu_node(policy->cpu, NULL);
struct thermal_cooling_device *cdev = NULL; struct thermal_cooling_device *cdev = NULL;
...@@ -889,7 +865,7 @@ of_cpufreq_power_cooling_register(struct cpufreq_policy *policy) ...@@ -889,7 +865,7 @@ of_cpufreq_power_cooling_register(struct cpufreq_policy *policy)
of_node_put(np); of_node_put(np);
return cdev; return cdev;
} }
EXPORT_SYMBOL(of_cpufreq_power_cooling_register); EXPORT_SYMBOL_GPL(of_cpufreq_cooling_register);
/** /**
* cpufreq_cooling_unregister - function to remove cpufreq cooling device. * cpufreq_cooling_unregister - function to remove cpufreq cooling device.
......
...@@ -41,33 +41,6 @@ typedef int (*get_static_t)(cpumask_t *cpumask, int interval, ...@@ -41,33 +41,6 @@ typedef int (*get_static_t)(cpumask_t *cpumask, int interval,
struct thermal_cooling_device * struct thermal_cooling_device *
cpufreq_cooling_register(struct cpufreq_policy *policy); cpufreq_cooling_register(struct cpufreq_policy *policy);
/**
* of_cpufreq_cooling_register - create cpufreq cooling device based on DT.
* @np: a valid struct device_node to the cooling device device tree node.
* @policy: cpufreq policy.
*/
#ifdef CONFIG_THERMAL_OF
struct thermal_cooling_device *
of_cpufreq_cooling_register(struct device_node *np,
struct cpufreq_policy *policy);
struct thermal_cooling_device *
of_cpufreq_power_cooling_register(struct cpufreq_policy *policy);
#else
static inline struct thermal_cooling_device *
of_cpufreq_cooling_register(struct device_node *np,
struct cpufreq_policy *policy)
{
return ERR_PTR(-ENOSYS);
}
static inline struct thermal_cooling_device *
of_cpufreq_power_cooling_register(struct cpufreq_policy *policy)
{
return NULL;
}
#endif
/** /**
* cpufreq_cooling_unregister - function to remove cpufreq cooling device. * cpufreq_cooling_unregister - function to remove cpufreq cooling device.
* @cdev: thermal cooling device pointer. * @cdev: thermal cooling device pointer.
...@@ -81,24 +54,26 @@ cpufreq_cooling_register(struct cpufreq_policy *policy) ...@@ -81,24 +54,26 @@ cpufreq_cooling_register(struct cpufreq_policy *policy)
return ERR_PTR(-ENOSYS); return ERR_PTR(-ENOSYS);
} }
static inline struct thermal_cooling_device * static inline
of_cpufreq_cooling_register(struct device_node *np, void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
struct cpufreq_policy *policy)
{ {
return ERR_PTR(-ENOSYS); return;
} }
#endif /* CONFIG_CPU_THERMAL */
#if defined(CONFIG_THERMAL_OF) && defined(CONFIG_CPU_THERMAL)
/**
* of_cpufreq_cooling_register - create cpufreq cooling device based on DT.
* @policy: cpufreq policy.
*/
struct thermal_cooling_device *
of_cpufreq_cooling_register(struct cpufreq_policy *policy);
#else
static inline struct thermal_cooling_device * static inline struct thermal_cooling_device *
of_cpufreq_power_cooling_register(struct cpufreq_policy *policy) of_cpufreq_cooling_register(struct cpufreq_policy *policy)
{ {
return NULL; return NULL;
} }
#endif /* defined(CONFIG_THERMAL_OF) && defined(CONFIG_CPU_THERMAL) */
static inline
void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
{
return;
}
#endif /* CONFIG_CPU_THERMAL */
#endif /* __CPU_COOLING_H__ */ #endif /* __CPU_COOLING_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment