diff options
| author | Ruchi Kandoi <kandoiruchi@google.com> | 2014-10-21 13:55:04 -0700 |
|---|---|---|
| committer | Arvin Quilao <arquilao@gmail.com> | 2017-04-21 02:05:14 +0000 |
| commit | fb0f961a51caf88f818782ffb602da1d5e08f22a (patch) | |
| tree | f09f1abc0eeda31081986b700d94b77786aa9961 | |
| parent | e492369b0d52a74092b2f6b08ad0fae8d6f650f0 (diff) | |
cpufreq: Avoid using global variable total_cpus
The change is to compile on kernels where cpufreq stats are compiled as
a module (CONFIG_CPU_FREQ_STAT=m), because total_cpus is not exported for
module use.
Reported-By: Emilio López <elopez93@gmail.com>
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
Change-Id: I4f3c74f0fac5e8d9449655b26bf3b407b0fe4290
Git-commit: c8468201e5509fd4a942247d32d07904e15a57df
Git-repo: https://android.googlesource.com/kernel/msm/
Signed-off-by: Nirmal Abraham <nabrah@codeaurora.org>
| -rw-r--r-- | drivers/cpufreq/cpufreq_stats.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index abb902354cb..5f7923fb6cd 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c @@ -265,19 +265,19 @@ static void cpufreq_stats_free_table(unsigned int cpu) static void cpufreq_allstats_free(void) { - int i; + int cpu; struct all_cpufreq_stats *all_stat; sysfs_remove_file(cpufreq_global_kobject, &_attr_all_time_in_state.attr); - for (i = 0; i < total_cpus; i++) { - all_stat = per_cpu(all_cpufreq_stats, i); + for_each_possible_cpu(cpu) { + all_stat = per_cpu(all_cpufreq_stats, cpu); if (!all_stat) continue; kfree(all_stat->time_in_state); kfree(all_stat); - per_cpu(all_cpufreq_stats, i) = NULL; + per_cpu(all_cpufreq_stats, cpu) = NULL; } if (all_freq_table) { kfree(all_freq_table->freq_table); |
