cpufreq: Store cpufreq policies in a list
authorLukasz Majewski <l.majewski@samsung.com>
Tue, 2 Jul 2013 16:01:10 +0000 (18:01 +0200)
committerChanho Park <chanho61.park@samsung.com>
Tue, 18 Nov 2014 02:45:03 +0000 (11:45 +0900)
Policies available in a cpufreq framework are now linked together. They are
accessible via cpufreq_policy_list defined at cpufreq core.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Changes for v6:
- Move policy list entry delete code to __cpufreq_remove_dev()

Changes for v5:
- Call list_add() only when device successfully added

Changes for v4:
- New patch

drivers/cpufreq/cpufreq.c
include/linux/cpufreq.h

index 365d263..7a64d8b 100644 (file)
@@ -47,6 +47,7 @@ static DEFINE_PER_CPU(char[CPUFREQ_NAME_LEN], cpufreq_cpu_governor);
 #endif
 static DEFINE_RWLOCK(cpufreq_driver_lock);
 static DEFINE_MUTEX(cpufreq_governor_lock);
+static LIST_HEAD(cpufreq_policy_list);
 
 /*
  * cpu_policy_rwsem is a per CPU reader-writer semaphore designed to cure
@@ -994,6 +995,7 @@ static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif)
        if (ret)
                goto err_out_unregister;
 
+       list_add(&policy->policy_list, &cpufreq_policy_list);
        kobject_uevent(&policy->kobj, KOBJ_ADD);
        module_put(cpufreq_driver->owner);
        pr_debug("initialization complete\n");
@@ -1138,6 +1140,7 @@ static int __cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif
                if (cpufreq_driver->exit)
                        cpufreq_driver->exit(data);
 
+               list_del(&data->policy_list);
                free_cpumask_var(data->related_cpus);
                free_cpumask_var(data->cpus);
                kfree(data);
index a8d1369..baa3045 100644 (file)
@@ -118,6 +118,7 @@ struct cpufreq_policy {
 
        struct cpufreq_real_policy      user_policy;
 
+       struct list_head        policy_list;
        struct kobject          kobj;
        struct completion       kobj_unregister;
 };