diff mbox

[21/26] cpu_cooling: create list of cpufreq_cooling_devices

Message ID 451cea6e5f417b0e76747ea8d8f3aa852f8bbf54.1417167599.git.viresh.kumar@linaro.org (mailing list archive)
State Changes Requested
Delegated to: Eduardo Valentin
Headers show

Commit Message

Viresh Kumar Nov. 28, 2014, 9:44 a.m. UTC
That will be used by later patches to iterate over all cpufreq cooling devices.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/thermal/cpu_cooling.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Eduardo Valentin Dec. 2, 2014, 11:12 p.m. UTC | #1
Viresh,

On Fri, Nov 28, 2014 at 03:14:15PM +0530, Viresh Kumar wrote:
> That will be used by later patches to iterate over all cpufreq cooling devices.
> 

Can you please refresh the series on top of latest Linus tree (material
for 3.18-rc7) ?


> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
>  drivers/thermal/cpu_cooling.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
> index ddb97aa..f76a665 100644
> --- a/drivers/thermal/cpu_cooling.c
> +++ b/drivers/thermal/cpu_cooling.c
> @@ -66,8 +66,11 @@ struct cpufreq_cooling_device {
>  	unsigned int cpufreq_val;
>  	unsigned int max_level;
>  	struct cpumask allowed_cpus;
> +	struct list_head head;

Yadwinder has already introduced a list of cpu cooling devs:
commit 2dcd851fe4b4fe60c2f8520bf7668d7e9b2dd76b
Author: Yadwinder Singh Brar <yadi.brar@samsung.com>
Date:   Fri Nov 7 19:12:29 2014 +0530

    thermal: cpu_cooling: Update always cpufreq policy with thermal
    constraints
        
>  };
> +
>  static DEFINE_IDR(cpufreq_idr);
> +static LIST_HEAD(cpufreq_dev_list);
>  static DEFINE_MUTEX(cooling_cpufreq_lock);
>  
>  static unsigned int cpufreq_dev_count;
> @@ -372,6 +375,7 @@ __cpufreq_cooling_register(struct device_node *np,
>  		goto remove_idr;
>  
>  	cpufreq_dev->cool_dev = cool_dev;
> +	INIT_LIST_HEAD(&cpufreq_dev->head);
>  
>  	mutex_lock(&cooling_cpufreq_lock);
>  
> @@ -381,6 +385,7 @@ __cpufreq_cooling_register(struct device_node *np,
>  					  CPUFREQ_POLICY_NOTIFIER);
>  	cpufreq_dev_count++;
>  
> +	list_add(&cpufreq_dev->head, &cpufreq_dev_list);
>  	mutex_unlock(&cooling_cpufreq_lock);
>  
>  	return cool_dev;
> @@ -451,6 +456,7 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
>  	cpufreq_dev = cdev->devdata;
>  	mutex_lock(&cooling_cpufreq_lock);
>  	cpufreq_dev_count--;
> +	list_del(&cpufreq_dev->head);
>  
>  	/* Unregister the notifier for the last cpufreq cooling device */
>  	if (cpufreq_dev_count == 0)
> -- 
> 2.0.3.693.g996b0fd
>
diff mbox

Patch

diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
index ddb97aa..f76a665 100644
--- a/drivers/thermal/cpu_cooling.c
+++ b/drivers/thermal/cpu_cooling.c
@@ -66,8 +66,11 @@  struct cpufreq_cooling_device {
 	unsigned int cpufreq_val;
 	unsigned int max_level;
 	struct cpumask allowed_cpus;
+	struct list_head head;
 };
+
 static DEFINE_IDR(cpufreq_idr);
+static LIST_HEAD(cpufreq_dev_list);
 static DEFINE_MUTEX(cooling_cpufreq_lock);
 
 static unsigned int cpufreq_dev_count;
@@ -372,6 +375,7 @@  __cpufreq_cooling_register(struct device_node *np,
 		goto remove_idr;
 
 	cpufreq_dev->cool_dev = cool_dev;
+	INIT_LIST_HEAD(&cpufreq_dev->head);
 
 	mutex_lock(&cooling_cpufreq_lock);
 
@@ -381,6 +385,7 @@  __cpufreq_cooling_register(struct device_node *np,
 					  CPUFREQ_POLICY_NOTIFIER);
 	cpufreq_dev_count++;
 
+	list_add(&cpufreq_dev->head, &cpufreq_dev_list);
 	mutex_unlock(&cooling_cpufreq_lock);
 
 	return cool_dev;
@@ -451,6 +456,7 @@  void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
 	cpufreq_dev = cdev->devdata;
 	mutex_lock(&cooling_cpufreq_lock);
 	cpufreq_dev_count--;
+	list_del(&cpufreq_dev->head);
 
 	/* Unregister the notifier for the last cpufreq cooling device */
 	if (cpufreq_dev_count == 0)