b/drivers/cpufreq/cpufreq_governor.c
@@ -300,7 +300,7 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy,
dbs_data->cdata->gov_dbs_timer);
}
- rc = sysfs_create_group(&policy->kobj,
+ rc = sysfs_create_group(get_governor_parent_kobj(policy),
dbs_data->cdata->attr_group);
if (rc) {
mutex_unlock(&dbs_data->mutex);
@@ -107,6 +107,11 @@ struct cpufreq_policy {
unsigned int policy; /* see above */
struct cpufreq_governor *governor; /* see below */
void *governor_data;
+ /* This should be set by init() of platforms having multiple
+ * clock-domains, i.e. supporting multiple policies. With this sysfs
+ * directories of governor would be created in cpu/cpu<num>/cpufreq/
+ * directory */
+ bool have_multiple_policies;
struct work_struct update; /* if update_policy() needs to be
* called, but you're in IRQ context */
@@ -134,6 +139,15 @@ static inline bool policy_is_shared(struct
cpufreq_policy *policy)
return cpumask_weight(policy->cpus) > 1;
}
+static inline struct kobject *
+get_governor_parent_kobj(struct cpufreq_policy *policy)
+{
+ if (policy->have_multiple_policies)
+ return &policy->kobj;
+ else
+ return cpufreq_global_kobject;
+}
+
/******************** cpufreq transition notifiers *******************/
#define CPUFREQ_PRECHANGE (0)
--------------x------------------x-------------------
Plus the following patch, though i am still not in favor of this patch.
@Rafael: Please share your opinion too on this one. :)
--------------x------------------x-------------------
commit 1c7e9871fce7388136eda1c86ca75a520e4d3b9d
Author: Viresh Kumar <viresh.kumar@linaro.org>
Date: Tue Feb 5 21:41:40 2013 +0530
cpufreq: Add Kconfig option to enable/disable have_multiple_policies
have_multiple_policies is required by platforms having multiple
clock-domains
for cpus, i.e. supporting multiple policies for cpus. This patch adds in a
Kconfig option for enabling execution of this code.
Requested-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/cpufreq/Kconfig | 3 +++
include/linux/cpufreq.h | 4 ++++
2 files changed, 7 insertions(+)
@@ -23,6 +23,9 @@ config CPU_FREQ_TABLE
config CPU_FREQ_GOV_COMMON
bool
+config CPU_FREQ_HAVE_MULTIPLE_POLICIES
+ bool
+
config CPU_FREQ_STAT
tristate "CPU frequency translation statistics"
select CPU_FREQ_TABLE
@@ -107,11 +107,13 @@ struct cpufreq_policy {
unsigned int policy; /* see above */
struct cpufreq_governor *governor; /* see below */
void *governor_data;
+#ifdef CONFIG_CPU_FREQ_HAVE_MULTIPLE_POLICIES
/* This should be set by init() of platforms having multiple
* clock-domains, i.e. supporting multiple policies. With this sysfs
* directories of governor would be created in cpu/cpu<num>/cpufreq/
* directory */
bool have_multiple_policies;
+#endif
struct work_struct update; /* if update_policy() needs to be
* called, but you're in IRQ context */
@@ -142,9 +144,11 @@ static inline bool policy_is_shared(struct
cpufreq_policy *policy)
static inline struct kobject *
get_governor_parent_kobj(struct cpufreq_policy *policy)
{
+#ifdef CONFIG_CPU_FREQ_HAVE_MULTIPLE_POLICIES
if (policy->have_multiple_policies)
return &policy->kobj;
else
+#endif
return cpufreq_global_kobject;
}