Re: [PATCH 1/3] ACPI: CPPC: Refactor boost ratio handling

K Prateek Nayak <[email protected]>
Newsgroups org.kernel.vger.linux-acpi,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pm
Message-ID <[email protected]>
On 9/1/2026 1:14 AM, Mario Limonciello wrote:
> +int amd_get_max_frequency(unsigned int cpu)
> +{
> +	enum x86_topology_cpu_type type = cpu_data(cpu).topo.cpu_type;
> +	const struct x86_cpu_id *id = x86_match_cpu(amd_zen6_client_ids);
> +	const struct amd_max_freq *max_freq;
> +
> +	if (!id)
> +		return -ENODEV;
> +
> +	max_freq = (const struct amd_max_freq *)id->driver_data;
> +
> +	switch (type) {
> +	case TOPO_CPU_TYPE_PERFORMANCE:
> +		return max_freq->performance;
> +	case TOPO_CPU_TYPE_EFFICIENCY:
> +		return max_freq->efficiency;
> +	case TOPO_CPU_TYPE_LOW_POWER:
> +		return max_freq->low_power;
> +	default:
> +		break;
> +	}
> +
> +	return -EINVAL;

nit. Since we don't really propagate the error codes returned
by amd_get_max_frequency(), maybe we can return 0 instead of
-ENODEV, -EINVAL and the callers can simply do:

    max_freq = amd_get_max_frequency(cpu);
    if (!max_freq)
         max_freq = /* Fallback */;

similar to get_max_boost_ratio() pattern. No strong feelings
either way.

> +}
> +EXPORT_SYMBOL_GPL(amd_get_max_frequency);
-- 
Thanks and Regards,
Prateek
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.