Re: [PATCH v2 4/4] cpufreq: Use policy->min/max init as QoS request
From: Viresh Kumar
Date: Wed May 20 2026 - 06:09:17 EST
On 11-05-26, 15:55, Pierre Gondois wrote:
> @@ -1399,8 +1399,16 @@ static void cpufreq_policy_free(struct cpufreq_policy *policy)
>
> static int cpufreq_policy_init_qos(struct cpufreq_policy *policy)
> {
> + unsigned int min_freq, max_freq;
> int ret;
>
> + /* Use policy->min/max set by the driver as QoS requests. */
> + min_freq = max(FREQ_QOS_MIN_DEFAULT_VALUE, policy->min);
> + if (policy->max)
> + max_freq = min(FREQ_QOS_MAX_DEFAULT_VALUE, policy->max);
> + else
> + max_freq = FREQ_QOS_MAX_DEFAULT_VALUE;
> +
Why is this required to be done before setting policy->min/max ? And
so I don't think patch 1/4 is required at all.
> /*
> * If the driver didn't set policy->min/max, set them as
> * they are used to clamp frequency requests.
> @@ -1418,12 +1426,12 @@ static int cpufreq_policy_init_qos(struct cpufreq_policy *policy)
> }
>
> ret = freq_qos_add_request(&policy->constraints, &policy->min_freq_req,
> - FREQ_QOS_MIN, FREQ_QOS_MIN_DEFAULT_VALUE);
> + FREQ_QOS_MIN, min_freq);
> if (ret < 0)
> return ret;
>
> ret = freq_qos_add_request(&policy->constraints, &policy->max_freq_req,
> - FREQ_QOS_MAX, FREQ_QOS_MAX_DEFAULT_VALUE);
> + FREQ_QOS_MAX, max_freq);
> if (ret < 0)
> return ret;
>
> --
> 2.43.0
--
viresh