Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a8e63b36 authored by Ruchi Kandoi's avatar Ruchi Kandoi
Browse files

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: default avatarEmilio López <elopez93@gmail.com>
Signed-off-by: default avatarRuchi Kandoi <kandoiruchi@google.com>
Change-Id: I4f3c74f0fac5e8d9449655b26bf3b407b0fe4290
parent 5bc08b27
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -266,19 +266,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);