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

Commit d876dfbb authored by Thomas Renninger's avatar Thomas Renninger Committed by Len Brown
Browse files

acpi-cpufreq: Do not let get_measured perf depend on internal variable



Take already available policy->cpuinfo.max_freq and get rid of acpi-cpufreq
specific max_freq variable.

This implies that P0 is always the highest frequency which should always
be true as ACPI spec says:
As a result, the zeroth entry describes the highest performance state

Signed-off-by: default avatarThomas Renninger <trenn@suse.de>
Acked-by: default avatarVenkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent d91758f5
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -65,7 +65,6 @@ enum {
struct acpi_cpufreq_data {
struct acpi_cpufreq_data {
	struct acpi_processor_performance *acpi_data;
	struct acpi_processor_performance *acpi_data;
	struct cpufreq_frequency_table *freq_table;
	struct cpufreq_frequency_table *freq_table;
	unsigned int max_freq;
	unsigned int resume;
	unsigned int resume;
	unsigned int cpu_feature;
	unsigned int cpu_feature;
};
};
@@ -340,7 +339,7 @@ static unsigned int get_measured_perf(struct cpufreq_policy *policy,


#endif
#endif


	retval = (per_cpu(drv_data, policy->cpu)->max_freq * perf_percent) / 100;
	retval = (policy->cpuinfo.max_freq * perf_percent) / 100;


	return retval;
	return retval;
}
}
@@ -698,7 +697,6 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
				    " latency at 20 uS\n");
				    " latency at 20 uS\n");
	}
	}


	data->max_freq = perf->states[0].core_frequency * 1000;
	/* table init */
	/* table init */
	for (i = 0; i < perf->state_count; i++) {
	for (i = 0; i < perf->state_count; i++) {
		if (i > 0 && perf->states[i].core_frequency >=
		if (i > 0 && perf->states[i].core_frequency >=
@@ -717,6 +715,9 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
	if (result)
	if (result)
		goto err_freqfree;
		goto err_freqfree;


	if (perf->states[0].core_frequency * 1000 != policy->cpuinfo.max_freq)
		printk(KERN_WARNING FW_WARN "P-state 0 is not max freq\n");

	switch (perf->control_register.space_id) {
	switch (perf->control_register.space_id) {
	case ACPI_ADR_SPACE_SYSTEM_IO:
	case ACPI_ADR_SPACE_SYSTEM_IO:
		/* Current speed is unknown and not detectable by IO port */
		/* Current speed is unknown and not detectable by IO port */