cpufreq: stats: Remove redundant cpufreq_cpu_get() call
Subsystems (2)
PATCH v3 1/3 cpufreq: stats: Remove redundant cpufreq_cpu_get() call
__cpufreq_stats_create_table always gets pass the valid and real policy struct. So, there's no need to call cpufreq_cpu_get() to get the policy again.
--- drivers/cpufreq/cpufreq_stats.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/cpufreq/cpufreq_stats.c +1 -11
@@ -185,7 +185,6 @@ static int __cpufreq_stats_create_table(struct cpufreq_policy *policy, {unsigned int i, j, count =0 , ret =0 ;struct cpufreq_stats *stat; -struct cpufreq_policy *current_policy;unsigned int alloc_size;unsigned int cpu = policy->cpu;if (per_cpu (cpufreq_stats_table, cpu))
@@ -194,13 +193,7 @@ static int __cpufreq_stats_create_table(struct cpufreq_policy *policy,if ((stat) ==NULL )return -ENOMEM ; - current_policy =cpufreq_cpu_get (cpu); -if (current_policy ==NULL ) { - ret = -EINVAL ; - goto error_get_fail; - } - - ret =sysfs_create_group (¤t_policy->kobj, &stats_attr_group); + ret =sysfs_create_group (&policy->kobj, &stats_attr_group);if (ret) goto error_out;
@@ -243,11 +236,8 @@ static int __cpufreq_stats_create_table(struct cpufreq_policy *policy, stat->last_time =get_jiffies_64 (); stat->last_index =freq_table_get_index (stat, policy->cur);spin_unlock (&cpufreq_stats_lock); -cpufreq_cpu_put (current_policy);return 0 ; error_out: -cpufreq_cpu_put (current_policy); -error_get_fail:kfree (stat);per_cpu (cpufreq_stats_table, cpu) =NULL ;return ret;
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Viresh Kumar
maintainerQuoted 9 lines · Saravana Kannan
__cpufreq_stats_create_tablealways gets pass the valid and real policy struct. So, there's no need to callcpufreq_cpu_get()to get the policy again.Acked-by Viresh Kumar <[email protected]>Signed-off-by Saravana Kannan <[email protected]>--- drivers/cpufreq/cpufreq_stats.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
All patches look fine now. Rafael you can queue them up as per your convenience.
@Saravana: Though I am quite sure you still need my patches to get your initial issue fixed. So, can you please get them tested as early as possible, so that we can get them in for 3.14?
@Srivatsa: Your reviews will also help :)
Quoted 11 lines · Viresh Kumar
Quoted 9 lines · Saravana Kannan
__cpufreq_stats_create_tablealways gets pass the valid and real policy struct. So, there's no need to callcpufreq_cpu_get()to get the policy again.Acked-by Viresh Kumar <[email protected]>Signed-off-by Saravana Kannan <[email protected]>--- drivers/cpufreq/cpufreq_stats.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
Quoted 6 lines
All patches look fine now. Rafael you can queue them up as per your convenience.
@Saravana: Though I am quite sure you still need my patches to get your initial issue fixed. So, can you please get them tested as early as possible, so that we can get them in for 3.14?
That's a bit late ...
Quoted 1 line
@Srivatsa: Your reviews will also help :)
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.