Re: [PATCH 2/2] cpufreq: simplify cpufreq_set_policy() interface
From: Zihuan Zhang
Date: Thu Aug 21 2025 - 04:30:01 EST
在 2025/8/20 13:47, Viresh Kumar 写道:
On 20-08-25, 13:42, Zihuan Zhang wrote:
You’re right, we didn’t really consider that case before.
The interface of cpufreq_set_policy() does look a bit odd:
- drivers using governors don’t really need the new_pol parameter
- while drivers using the setpolicy method don’t need the new_gov one.
Right, one argument is _always_ unused. If we could have handled that via a
single argument, it would have been nice.
Sounds great.
I guess this might be due to some historical reasons.
The question is whether it’s worth modifying this function, or if we should
just keep it as it is.
Unless there is a better way :)
If we change cpufreq_set_policy() to only take one parameter, then we
would need to add extra fields into struct cpufreq_policy to hold
temporary values,
in order to avoid the issue where verify may return early and leave the
policy in a partially updated state.
So maybe it is better not to modify it.