mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "zhenglifeng (A)" <zhenglifeng1@huawei.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: <viresh.kumar@linaro.org>, <ionela.voinescu@arm.com>,
	<linux-kernel@vger.kernel.org>, <linux-pm@vger.kernel.org>,
	<linuxarm@huawei.com>, <jonathan.cameron@huawei.com>,
	<zhanjie9@hisilicon.com>, <lihuisong@huawei.com>,
	<yubowen8@huawei.com>
Subject: Re: [PATCH 6/7] cpufreq: Refactor code about starting governor in cpufreq_set_policy()
Date: Fri, 4 Jul 2025 17:37:15 +0800	[thread overview]
Message-ID: <ea80d7ce-4e5b-4817-a795-6400835c252d@huawei.com> (raw)
In-Reply-To: <CAJZ5v0huLAM5XaGr1MWOwL5V-p7KX-ea7FYGx70GPwyVHETnHg@mail.gmail.com>

On 2025/6/23 23:13, Rafael J. Wysocki wrote:

> On Mon, Jun 23, 2025 at 3:34 PM Lifeng Zheng <zhenglifeng1@huawei.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.

Just some refactoring to reduce nest level and make the style more similar
to other code in this file. If you don't like it, I'll drop it.

> 
>> Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.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) {
>> --
> 


  reply	other threads:[~2025-07-04  9:37 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-23 13:33 [PATCH 0/7] cpufreq: Some optimizations for cpufreq.c Lifeng Zheng
2025-06-23 13:33 ` [PATCH 1/7] cpufreq: Disable cpufreq-based invariance when fail to register driver Lifeng Zheng
2025-06-23 15:27   ` Rafael J. Wysocki
2025-07-04  9:03     ` zhenglifeng (A)
2025-06-23 13:33 ` [PATCH 2/7] cpufreq: Init policy->rwsem before it may be possibly used Lifeng Zheng
2025-06-23 15:29   ` Rafael J. Wysocki
2025-07-04  9:04     ` zhenglifeng (A)
2025-06-23 13:33 ` [PATCH 3/7] cpufreq: Contain scaling_cur_freq.attr in cpufreq_attrs Lifeng Zheng
2025-06-23 15:30   ` Rafael J. Wysocki
2025-07-03 14:59     ` Rafael J. Wysocki
2025-07-04  9:07       ` zhenglifeng (A)
2025-06-23 13:33 ` [PATCH 4/7] cpufreq: Remove duplicate check in __cpufreq_offline() Lifeng Zheng
2025-06-23 15:31   ` Rafael J. Wysocki
2025-06-23 13:34 ` [PATCH 5/7] cpufreq: Move the check of cpufreq_driver->get into cpufreq_verify_current_freq() Lifeng Zheng
2025-06-23 15:35   ` Rafael J. Wysocki
2025-07-04  9:16     ` zhenglifeng (A)
2025-06-23 13:34 ` [PATCH 6/7] cpufreq: Refactor code about starting governor in cpufreq_set_policy() Lifeng Zheng
2025-06-23 15:13   ` Rafael J. Wysocki
2025-07-04  9:37     ` zhenglifeng (A) [this message]
2025-06-23 13:34 ` [PATCH 7/7] cpufreq: Exit governor when failed to start old governor Lifeng Zheng
2025-06-23 15:12   ` Rafael J. Wysocki
2025-07-04  9:38     ` zhenglifeng (A)
2025-07-04  9:48       ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ea80d7ce-4e5b-4817-a795-6400835c252d@huawei.com \
    --to=zhenglifeng1@huawei.com \
    --cc=ionela.voinescu@arm.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=lihuisong@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=rafael@kernel.org \
    --cc=viresh.kumar@linaro.org \
    --cc=yubowen8@huawei.com \
    --cc=zhanjie9@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®