linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: rjw@sisk.pl
Cc: linaro-kernel@lists.linaro.org, patches@linaro.org,
	cpufreq@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, srivatsa.bhat@linux.vnet.ibm.com,
	l.majewski@samsung.com, Myungjoo Ham <myungjoo.ham@samsung.com>,
	Viresh Kumar <viresh.kumar@linaro.org>
Subject: [PATCH 06/10] cpufreq: Store cpufreq policies in a list
Date: Sat,  3 Aug 2013 17:19:24 +0530	[thread overview]
Message-ID: <c46357807ec1517cf90e3cece6edba31117a67a9.1375530162.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <cover.1375530162.git.viresh.kumar@linaro.org>
In-Reply-To: <cover.1375530162.git.viresh.kumar@linaro.org>

From: Lukasz Majewski <l.majewski@samsung.com>

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>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/cpufreq.c | 11 +++++++++++
 include/linux/cpufreq.h   |  1 +
 2 files changed, 12 insertions(+)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 496e31c..4c3aef0 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -39,6 +39,7 @@ static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data);
 static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data_fallback);
 static DEFINE_RWLOCK(cpufreq_driver_lock);
 static DEFINE_MUTEX(cpufreq_governor_lock);
+static LIST_HEAD(cpufreq_policy_list);
 
 #ifdef CONFIG_HOTPLUG_CPU
 /* This one keeps track of the previously set governor of a removed CPU */
@@ -963,6 +964,12 @@ err_free_policy:
 
 static void cpufreq_policy_free(struct cpufreq_policy *policy)
 {
+	unsigned long flags;
+
+	write_lock_irqsave(&cpufreq_driver_lock, flags);
+	list_del(&policy->policy_list);
+	write_unlock_irqrestore(&cpufreq_driver_lock, flags);
+
 	free_cpumask_var(policy->related_cpus);
 	free_cpumask_var(policy->cpus);
 	kfree(policy);
@@ -1076,6 +1083,10 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif,
 		ret = cpufreq_add_dev_interface(policy, dev);
 		if (ret)
 			goto err_out_unregister;
+
+		write_lock_irqsave(&cpufreq_driver_lock, flags);
+		list_add(&policy->policy_list, &cpufreq_policy_list);
+		write_unlock_irqrestore(&cpufreq_driver_lock, flags);
 	}
 
 	cpufreq_init_policy(policy);
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 9876712..d272fa4 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -82,6 +82,7 @@ struct cpufreq_policy {
 
 	struct cpufreq_real_policy	user_policy;
 
+	struct list_head        policy_list;
 	struct kobject		kobj;
 	struct completion	kobj_unregister;
 	int			transition_ongoing; /* Tracks transition status */
-- 
1.7.12.rc2.18.g61b472e

  parent reply	other threads:[~2013-08-03 11:49 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-03 11:49 [PATCH 00/10] CPUFreq: Fixes & Cleanups for 3.12 Viresh Kumar
2013-08-03 11:49 ` [PATCH 01/10] cpufreq: Cleanup header files included in core Viresh Kumar
2013-08-03 17:15   ` Viresh Kumar
2013-08-03 21:42     ` Rafael J. Wysocki
2013-08-03 11:49 ` [PATCH 02/10] cpufreq: Re-arrange declarations in cpufreq.h Viresh Kumar
2013-08-03 17:13   ` Viresh Kumar
2013-08-03 21:43     ` Rafael J. Wysocki
2013-08-03 11:49 ` [PATCH 03/10] cpufreq: Give consistent names for struct cpufreq_policy * Viresh Kumar
2013-08-06 13:38   ` Viresh Kumar
2013-08-06 14:02     ` Rafael J. Wysocki
2013-08-03 11:49 ` [PATCH 04/10] cpufreq: Use sizeof(*ptr) form for finding size of a struct Viresh Kumar
2013-08-03 11:49 ` [PATCH 05/10] cpufreq: Pass policy to cpufreq_add_policy_cpu() Viresh Kumar
2013-08-03 11:49 ` Viresh Kumar [this message]
2013-08-03 11:49 ` [PATCH 07/10] cpufreq: Use cpufreq_policy_list for iterating over policies Viresh Kumar
2013-08-03 11:49 ` [PATCH 08/10] cpufreq: Fix broken usage of governor->owner's refcount Viresh Kumar
2013-08-03 12:08   ` Rafael J. Wysocki
2013-08-03 13:27     ` Viresh Kumar
2013-08-03 22:06       ` Rafael J. Wysocki
2013-08-03 11:49 ` [PATCH 09/10] cpufreq: Don't use cpufreq_driver->owner's refcount to protect critical sections Viresh Kumar
2013-08-03 11:49 ` [PATCH 10/10] cpufreq: Remove struct cpufreq_driver's owner field Viresh Kumar
2013-08-03 12:07 ` [PATCH 00/10] CPUFreq: Fixes & Cleanups for 3.12 Rafael J. Wysocki
2013-08-03 13:28   ` Viresh Kumar
2013-08-03 22:02     ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c46357807ec1517cf90e3cece6edba31117a67a9.1375530162.git.viresh.kumar@linaro.org \
    --to=viresh.kumar@linaro.org \
    --cc=cpufreq@vger.kernel.org \
    --cc=l.majewski@samsung.com \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=patches@linaro.org \
    --cc=rjw@sisk.pl \
    --cc=srivatsa.bhat@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).