diff options
author | Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> | 2016-04-19 05:58:00 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-04-27 17:56:58 -0400 |
commit | 2920e9ce8f43a946e3c257a7c0ee35b02149fca7 (patch) | |
tree | 484f63d6567bcdc435b8a49b9ae88ee3e20f0dc9 /drivers/cpufreq/powernv-cpufreq.c | |
parent | 6de0dc4b536110d63a83021b7e6dce3e1955297b (diff) |
cpufreq: powernv: Remove flag use-case of policy->driver_data
commit 1b0289848d5d ("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>
Diffstat (limited to 'drivers/cpufreq/powernv-cpufreq.c')
-rw-r--r-- | drivers/cpufreq/powernv-cpufreq.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c index 39ac78c94be0..e2e221904d25 100644 --- a/drivers/cpufreq/powernv-cpufreq.c +++ b/drivers/cpufreq/powernv-cpufreq.c | |||
@@ -455,13 +455,15 @@ static int powernv_cpufreq_target_index(struct cpufreq_policy *policy, | |||
455 | static int powernv_cpufreq_cpu_init(struct cpufreq_policy *policy) | 455 | static int powernv_cpufreq_cpu_init(struct cpufreq_policy *policy) |
456 | { | 456 | { |
457 | int base, i; | 457 | int base, i; |
458 | struct kernfs_node *kn; | ||
458 | 459 | ||
459 | base = cpu_first_thread_sibling(policy->cpu); | 460 | base = cpu_first_thread_sibling(policy->cpu); |
460 | 461 | ||
461 | for (i = 0; i < threads_per_core; i++) | 462 | for (i = 0; i < threads_per_core; i++) |
462 | cpumask_set_cpu(base + i, policy->cpus); | 463 | cpumask_set_cpu(base + i, policy->cpus); |
463 | 464 | ||
464 | if (!policy->driver_data) { | 465 | kn = kernfs_find_and_get(policy->kobj.sd, throttle_attr_grp.name); |
466 | if (!kn) { | ||
465 | int ret; | 467 | int ret; |
466 | 468 | ||
467 | ret = sysfs_create_group(&policy->kobj, &throttle_attr_grp); | 469 | ret = sysfs_create_group(&policy->kobj, &throttle_attr_grp); |
@@ -470,11 +472,8 @@ static int powernv_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
470 | policy->cpu); | 472 | policy->cpu); |
471 | return ret; | 473 | return ret; |
472 | } | 474 | } |
473 | /* | 475 | } else { |
474 | * policy->driver_data is used as a flag for one-time | 476 | kernfs_put(kn); |
475 | * creation of throttle sysfs files. | ||
476 | */ | ||
477 | policy->driver_data = policy; | ||
478 | } | 477 | } |
479 | return cpufreq_table_validate_and_show(policy, powernv_freqs); | 478 | return cpufreq_table_validate_and_show(policy, powernv_freqs); |
480 | } | 479 | } |