Skip to content

Commit 3ebb62f

Browse files
vireshkrafaeljw
authored andcommitted
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>
1 parent ba0966d commit 3ebb62f

File tree

7 files changed

+23
-80
lines changed

7 files changed

+23
-80
lines changed

Documentation/thermal/cpu-cooling-api.txt

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,16 @@ the user. The registration APIs returns the cooling device pointer.
2626
clip_cpus: cpumask of cpus where the frequency constraints will happen.
2727

2828
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)
3030

3131
This interface function registers the cpufreq cooling device with
3232
the name "thermal-cpufreq-%x" linking it with a device tree node, in
3333
order to bind it via the thermal DT code. This api can support multiple
3434
instances of cpufreq cooling devices.
3535

36-
np: pointer to the cooling device device tree node
37-
clip_cpus: cpumask of cpus where the frequency constraints will happen.
38-
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.
36+
policy: CPUFreq policy.
4537

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)
4739

4840
This interface function unregisters the "thermal-cpufreq-%x" cooling device.
4941

drivers/cpufreq/arm_big_little.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ static void bL_cpufreq_ready(struct cpufreq_policy *policy)
532532
if (cur_cluster >= MAX_CLUSTERS)
533533
return;
534534

535-
cdev[cur_cluster] = of_cpufreq_power_cooling_register(policy);
535+
cdev[cur_cluster] = of_cpufreq_cooling_register(policy);
536536
}
537537

538538
static struct cpufreq_driver bL_cpufreq_driver = {

drivers/cpufreq/cpufreq-dt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ static void cpufreq_ready(struct cpufreq_policy *policy)
320320
{
321321
struct private_data *priv = policy->driver_data;
322322

323-
priv->cdev = of_cpufreq_power_cooling_register(policy);
323+
priv->cdev = of_cpufreq_cooling_register(policy);
324324
}
325325

326326
static struct cpufreq_driver dt_cpufreq_driver = {

drivers/cpufreq/mediatek-cpufreq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ static void mtk_cpufreq_ready(struct cpufreq_policy *policy)
311311
{
312312
struct mtk_cpu_dvfs_info *info = policy->driver_data;
313313

314-
info->cdev = of_cpufreq_power_cooling_register(policy);
314+
info->cdev = of_cpufreq_cooling_register(policy);
315315
}
316316

317317
static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu)

drivers/cpufreq/qoriq-cpufreq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ static void qoriq_cpufreq_ready(struct cpufreq_policy *policy)
276276
{
277277
struct cpu_data *cpud = policy->driver_data;
278278

279-
cpud->cdev = of_cpufreq_power_cooling_register(policy);
279+
cpud->cdev = of_cpufreq_cooling_register(policy);
280280
}
281281

282282
static struct cpufreq_driver qoriq_cpufreq_driver = {

drivers/thermal/cpu_cooling.c

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -819,37 +819,13 @@ EXPORT_SYMBOL_GPL(cpufreq_cooling_register);
819819

820820
/**
821821
* of_cpufreq_cooling_register - function to create cpufreq cooling device.
822-
* @np: a valid struct device_node to the cooling device device tree node
823822
* @policy: cpufreq policy
824823
*
825824
* This interface function registers the cpufreq cooling device with the name
826825
* "thermal-cpufreq-%x". This api can support multiple instances of cpufreq
827826
* cooling devices. Using this API, the cpufreq cooling device will be
828827
* linked to the device tree node provided.
829828
*
830-
* Return: a valid struct thermal_cooling_device pointer on success,
831-
* on failure, it returns a corresponding ERR_PTR().
832-
*/
833-
struct thermal_cooling_device *
834-
of_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-
}
842-
EXPORT_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.
853829
* Using this function, the cooling device will implement the power
854830
* extensions by using a simple cpu power model. The cpus must have
855831
* registered their OPPs using the OPP library.
@@ -861,7 +837,7 @@ EXPORT_SYMBOL_GPL(of_cpufreq_cooling_register);
861837
* and NULL on failure.
862838
*/
863839
struct thermal_cooling_device *
864-
of_cpufreq_power_cooling_register(struct cpufreq_policy *policy)
840+
of_cpufreq_cooling_register(struct cpufreq_policy *policy)
865841
{
866842
struct device_node *np = of_get_cpu_node(policy->cpu, NULL);
867843
struct thermal_cooling_device *cdev = NULL;
@@ -889,7 +865,7 @@ of_cpufreq_power_cooling_register(struct cpufreq_policy *policy)
889865
of_node_put(np);
890866
return cdev;
891867
}
892-
EXPORT_SYMBOL(of_cpufreq_power_cooling_register);
868+
EXPORT_SYMBOL_GPL(of_cpufreq_cooling_register);
893869

894870
/**
895871
* cpufreq_cooling_unregister - function to remove cpufreq cooling device.

include/linux/cpu_cooling.h

Lines changed: 14 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -41,33 +41,6 @@ typedef int (*get_static_t)(cpumask_t *cpumask, int interval,
4141
struct thermal_cooling_device *
4242
cpufreq_cooling_register(struct cpufreq_policy *policy);
4343

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-
7144
/**
7245
* cpufreq_cooling_unregister - function to remove cpufreq cooling device.
7346
* @cdev: thermal cooling device pointer.
@@ -81,24 +54,26 @@ cpufreq_cooling_register(struct cpufreq_policy *policy)
8154
return ERR_PTR(-ENOSYS);
8255
}
8356

84-
static inline struct thermal_cooling_device *
85-
of_cpufreq_cooling_register(struct device_node *np,
86-
struct cpufreq_policy *policy)
57+
static inline
58+
void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
8759
{
88-
return ERR_PTR(-ENOSYS);
60+
return;
8961
}
62+
#endif /* CONFIG_CPU_THERMAL */
9063

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+
*/
69+
struct thermal_cooling_device *
70+
of_cpufreq_cooling_register(struct cpufreq_policy *policy);
71+
#else
9172
static inline struct thermal_cooling_device *
92-
of_cpufreq_power_cooling_register(struct cpufreq_policy *policy)
73+
of_cpufreq_cooling_register(struct cpufreq_policy *policy)
9374
{
9475
return NULL;
9576
}
96-
97-
static inline
98-
void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
99-
{
100-
return;
101-
}
102-
#endif /* CONFIG_CPU_THERMAL */
77+
#endif /* defined(CONFIG_THERMAL_OF) && defined(CONFIG_CPU_THERMAL) */
10378

10479
#endif /* __CPU_COOLING_H__ */

0 commit comments

Comments
 (0)