In message: [linux-yocto][v5.4/standard/base][PATCH] cpufreq: Fix policy 
initialization for internal governor drivers
on 03/03/2020 Yongxin Liu wrote:

> From: "Rafael J. Wysocki" <rafael.j.wyso...@intel.com>
> 
> commit f5739cb0b56590d68d8df8a44659893b6d0084c3 upstream.
> 
> Before commit 1e4f63aecb53 ("cpufreq: Avoid creating excessively
> large stack frames") the initial value of the policy field in struct
> cpufreq_policy set by the driver's ->init() callback was implicitly
> passed from cpufreq_init_policy() to cpufreq_set_policy() if the
> default governor was neither "performance" nor "powersave".  After
> that commit, however, cpufreq_init_policy() must take that case into
> consideration explicitly and handle it as appropriate, so make that
> happen.
> 
> Fixes: 1e4f63aecb53 ("cpufreq: Avoid creating excessively large stack frames")
> Link: 
> https://lore.kernel.org/linux-pm/39fb762880c27da110086741315ca8b111d781cd.ca...@gmail.com/
> Reported-by: Artem Bityutskiy <dedeki...@gmail.com>
> Cc: 5.4+ <sta...@vger.kernel.org> # 5.4+

I've merged this change, rather than waiting for -stable to loop
it around.

Bruce

> Signed-off-by: Rafael J. Wysocki <rafael.j.wyso...@intel.com>
> Acked-by: Viresh Kumar <viresh.ku...@linaro.org>
> Signed-off-by: Yongxin Liu <yongxin....@windriver.com>
> ---
>  drivers/cpufreq/cpufreq.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 7679f8a91745..35f8e098e9fa 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1071,9 +1071,17 @@ static int cpufreq_init_policy(struct cpufreq_policy 
> *policy)
>                       pol = policy->last_policy;
>               } else if (def_gov) {
>                       pol = cpufreq_parse_policy(def_gov->name);
> -             } else {
> -                     return -ENODATA;
> +                     /*
> +                      * In case the default governor is neiter "performance"
> +                      * nor "powersave", fall back to the initial policy
> +                      * value set by the driver.
> +                      */
> +                     if (pol == CPUFREQ_POLICY_UNKNOWN)
> +                             pol = policy->policy;
>               }
> +             if (pol != CPUFREQ_POLICY_PERFORMANCE &&
> +                 pol != CPUFREQ_POLICY_POWERSAVE)
> +                     return -ENODATA;
>       }
>  
>       return cpufreq_set_policy(policy, gov, pol);
> -- 
> 2.14.4
> 
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#8435): 
https://lists.yoctoproject.org/g/linux-yocto/message/8435
Mute This Topic: https://lists.yoctoproject.org/mt/71697497/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub  
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to