linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xiongfeng Wang <wangxiongfeng2@huawei.com>
To: <rjw@rjwysocki.net>, <viresh.kumar@linaro.org>,
	<Souvik.Chakravarty@arm.com>, <Thanu.Rangarajan@arm.com>
Cc: <Sudeep.Holla@arm.com>, <guohanjun@huawei.com>,
	<john.garry@huawei.com>, <jonathan.cameron@huawei.com>,
	<linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<wangxiongfeng2@huawei.com>
Subject: [RFC PATCH v2 2/3] cpufreq: export 'cpufreq_policy_list' and make macro 'for_each_*_policy' public
Date: Mon, 18 May 2020 15:10:07 +0800	[thread overview]
Message-ID: <1589785808-12138-3-git-send-email-wangxiongfeng2@huawei.com> (raw)
In-Reply-To: <1589785808-12138-1-git-send-email-wangxiongfeng2@huawei.com>

Export variable 'cpufreq_policy_list' and make macro 'for_each_*_policy"
public. This is preparation for adding SW BOOST support for CPPC.

Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
---
 drivers/cpufreq/cpufreq.c | 16 ++--------------
 include/linux/cpufreq.h   | 14 ++++++++++++++
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index bb6746e..953e163 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -30,20 +30,8 @@
 #include <linux/tick.h>
 #include <trace/events/power.h>
 
-static LIST_HEAD(cpufreq_policy_list);
-
-/* Macros to iterate over CPU policies */
-#define for_each_suitable_policy(__policy, __active)			 \
-	list_for_each_entry(__policy, &cpufreq_policy_list, policy_list) \
-		if ((__active) == !policy_is_inactive(__policy))
-
-#define for_each_active_policy(__policy)		\
-	for_each_suitable_policy(__policy, true)
-#define for_each_inactive_policy(__policy)		\
-	for_each_suitable_policy(__policy, false)
-
-#define for_each_policy(__policy)			\
-	list_for_each_entry(__policy, &cpufreq_policy_list, policy_list)
+LIST_HEAD(cpufreq_policy_list);
+EXPORT_SYMBOL_GPL(cpufreq_policy_list);
 
 /* Iterate over governors */
 static LIST_HEAD(cpufreq_governor_list);
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 018dce8..27a2a7f 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -222,6 +222,20 @@ static inline bool policy_is_shared(struct cpufreq_policy *policy)
 struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy);
 void cpufreq_enable_fast_switch(struct cpufreq_policy *policy);
 void cpufreq_disable_fast_switch(struct cpufreq_policy *policy);
+
+extern struct list_head cpufreq_policy_list;
+
+/* Macros to iterate over CPU policies */
+#define for_each_suitable_policy(__policy, __active)			 \
+	list_for_each_entry(__policy, &cpufreq_policy_list, policy_list) \
+		if ((__active) == !policy_is_inactive(__policy))
+#define for_each_active_policy(__policy)		\
+	for_each_suitable_policy(__policy, true)
+#define for_each_inactive_policy(__policy)		\
+	for_each_suitable_policy(__policy, false)
+#define for_each_policy(__policy)			\
+	list_for_each_entry(__policy, &cpufreq_policy_list, policy_list)
+
 #else
 static inline unsigned int cpufreq_get(unsigned int cpu)
 {
-- 
1.7.12.4


  parent reply	other threads:[~2020-05-18  7:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-18  7:10 [RFC PATCH v2 0/3] add SW BOOST support for CPPC Xiongfeng Wang
2020-05-18  7:10 ` [RFC PATCH v2 1/3] cpufreq: handle the return value of '.set_boost()' properly Xiongfeng Wang
2020-05-18  7:46   ` Viresh Kumar
2020-05-18 11:43     ` Viresh Kumar
2020-05-19  1:12       ` Xiongfeng Wang
2020-05-18  7:10 ` Xiongfeng Wang [this message]
2020-05-18  7:10 ` [RFC PATCH v2 3/3] CPPC: add support for SW BOOST Xiongfeng Wang

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=1589785808-12138-3-git-send-email-wangxiongfeng2@huawei.com \
    --to=wangxiongfeng2@huawei.com \
    --cc=Souvik.Chakravarty@arm.com \
    --cc=Sudeep.Holla@arm.com \
    --cc=Thanu.Rangarajan@arm.com \
    --cc=guohanjun@huawei.com \
    --cc=john.garry@huawei.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=viresh.kumar@linaro.org \
    /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).