lkml.org 
[lkml]   [2020]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH v2 2/3] cpufreq: export 'cpufreq_policy_list' and make macro 'for_each_*_policy' public
Date
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
\
 
 \ /
  Last update: 2020-05-18 09:17    [W:0.100 / U:0.000 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site