Skip to content

Commit

Permalink
cpufreq: powernv: Remove flag use-case of policy->driver_data
Browse files Browse the repository at this point in the history
commit 1b02898 ("cpufreq: powernv: Add sysfs attributes to show
throttle stats") used policy->driver_data as a flag for one-time creation
of throttle sysfs files. Instead of this use 'kernfs_find_and_get()' to
check if the attribute already exists. This is required as
policy->driver_data is used for other purposes in the later patch.

Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
Signed-off-by: Akshay Adiga <akshay.adiga@linux.vnet.ibm.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Shilpasri G Bhat authored and Rafael J. Wysocki committed Apr 27, 2016
1 parent 6de0dc4 commit 2920e9c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions drivers/cpufreq/powernv-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,13 +455,15 @@ static int powernv_cpufreq_target_index(struct cpufreq_policy *policy,
static int powernv_cpufreq_cpu_init(struct cpufreq_policy *policy)
{
int base, i;
struct kernfs_node *kn;

base = cpu_first_thread_sibling(policy->cpu);

for (i = 0; i < threads_per_core; i++)
cpumask_set_cpu(base + i, policy->cpus);

if (!policy->driver_data) {
kn = kernfs_find_and_get(policy->kobj.sd, throttle_attr_grp.name);
if (!kn) {
int ret;

ret = sysfs_create_group(&policy->kobj, &throttle_attr_grp);
Expand All @@ -470,11 +472,8 @@ static int powernv_cpufreq_cpu_init(struct cpufreq_policy *policy)
policy->cpu);
return ret;
}
/*
* policy->driver_data is used as a flag for one-time
* creation of throttle sysfs files.
*/
policy->driver_data = policy;
} else {
kernfs_put(kn);
}
return cpufreq_table_validate_and_show(policy, powernv_freqs);
}
Expand Down

0 comments on commit 2920e9c

Please sign in to comment.