[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0huLAM5XaGr1MWOwL5V-p7KX-ea7FYGx70GPwyVHETnHg@mail.gmail.com>
Date: Mon, 23 Jun 2025 17:13:11 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Lifeng Zheng <zhenglifeng1@...wei.com>
Cc: rafael@...nel.org, viresh.kumar@...aro.org, ionela.voinescu@....com,
linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org, linuxarm@...wei.com,
jonathan.cameron@...wei.com, zhanjie9@...ilicon.com, lihuisong@...wei.com,
yubowen8@...wei.com
Subject: Re: [PATCH 6/7] cpufreq: Refactor code about starting governor in cpufreq_set_policy()
On Mon, Jun 23, 2025 at 3:34 PM Lifeng Zheng <zhenglifeng1@...wei.com> wrote:
>
> Refactor code about starting governor without functional change in
> cpufreq_set_policy() to make it more readable.
Sorry, but I don't see the point.
> Signed-off-by: Lifeng Zheng <zhenglifeng1@...wei.com>
> ---
> drivers/cpufreq/cpufreq.c | 16 ++++++++++------
> 1 file changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 9b2578b905a5..7b82ffb50283 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -2698,15 +2698,19 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
> /* start new governor */
> policy->governor = new_gov;
> ret = cpufreq_init_governor(policy);
> - if (!ret) {
> - ret = cpufreq_start_governor(policy);
> - if (!ret) {
> - pr_debug("governor change\n");
> - return 0;
> - }
> + if (ret)
> + goto start_old_gov;
> +
> + ret = cpufreq_start_governor(policy);
> + if (ret) {
> cpufreq_exit_governor(policy);
> + goto start_old_gov;
> }
>
> + pr_debug("governor change\n");
> + return 0;
> +
> +start_old_gov:
> /* new governor failed, so re-start old one */
> pr_debug("starting governor %s failed\n", policy->governor->name);
> if (old_gov) {
> --
Powered by blists - more mailing lists