Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jie Zhan <zhanjie9@hisilicon.com>
To: Yaxiong Tian <tianyaxiong@kylinos.cn>, <cwchoi00@gmail.com>,
	<cw00.choi@samsung.com>, <myungjoo.ham@samsung.com>,
	<kyungmin.park@samsung.com>, <linux-pm@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>
Cc: <linuxarm@huawei.com>, <zhenglifeng1@huawei.com>,
	<zhangpengjie2@huawei.com>, <lihuisong@huawei.com>,
	<prime.zeng@hisilicon.com>
Subject: Re: [PATCH v2 3/6] devfreq: Factor out devfreq_set_governor()
Date: Fri, 15 May 2026 18:32:01 +0800	[thread overview]
Message-ID: <93cbb609-9b90-4551-8bf9-19e9ca657baf@hisilicon.com> (raw)
In-Reply-To: <418993e5-ae44-48a4-98d7-250d0f359b0a@kylinos.cn>



On 5/14/2026 2:09 PM, Yaxiong Tian wrote:
> 
> 在 2026/5/13 17:38, Jie Zhan 写道:
>> Factor out common governor setting logic into devfreq_set_governor() so as
>> to consolidate the code in governor_store() and devfreq_add_device().
>>
>> The caller is expected to hold 'devfreq_list_lock', enforced via
>> lockdep_assert_held().  This is required because devfreq_add_device() must
>> hold the lock from setting governor until the device is added to
>> 'devfreq_list', so that a concurrent devfreq_remove_governor() cannot free
>> the governor in between.
>>
>> Signed-off-by: Jie Zhan <zhanjie9@hisilicon.com>
> 
> I'm a bit unclear about the purpose of this commit, or the problem it solves. Can you explain it more clearly?
> 
> 
`governor_store()` and `devfreq_add_device()` share the similar governor
setting code when `devfreq->governor` can be NULL, so unifying and
factoring out the common governor setting logic with two main purposes:
1. Reduce code duplication.
2. Prepare for the next few patches which add refcounting for the governor
modules -- There would be less `try_module_get()` and `module_put()` by
factoring out `devfreq_set_governor()`.

I'll explain this more in the commit log.

Thanks,
Jie
>> ---
>>   drivers/devfreq/devfreq.c | 117 ++++++++++++++++++--------------------
>>   1 file changed, 56 insertions(+), 61 deletions(-)
[ ... ]


  reply	other threads:[~2026-05-15 10:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-13  9:38 [PATCH v2 0/6] devfreq: Add refcounts for governor modules Jie Zhan
2026-05-13  9:38 ` [PATCH v2 1/6] devfreq: Use mutex guard in governor_store() Jie Zhan
2026-05-14  6:02   ` Yaxiong Tian
2026-05-13  9:38 ` [PATCH v2 2/6] devfreq: Use mutex guard in devfreq_add/remove_governor() Jie Zhan
2026-05-14  6:02   ` Yaxiong Tian
2026-05-13  9:38 ` [PATCH v2 3/6] devfreq: Factor out devfreq_set_governor() Jie Zhan
2026-05-14  6:09   ` Yaxiong Tian
2026-05-15 10:32     ` Jie Zhan [this message]
2026-05-13  9:38 ` [PATCH v2 4/6] devfreq: Add module owner to devfreq governor Jie Zhan
2026-05-14  6:14   ` Yaxiong Tian
2026-05-15 10:32     ` Jie Zhan
2026-05-13  9:38 ` [PATCH v2 5/6] devfreq: Get and put module refcount when switching governor Jie Zhan
2026-05-14  6:50   ` Yaxiong Tian
2026-05-15 10:39     ` Jie Zhan
2026-05-13  9:38 ` [PATCH v2 6/6] devfreq: Get module refcount in try_then_request_governor() Jie Zhan

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=93cbb609-9b90-4551-8bf9-19e9ca657baf@hisilicon.com \
    --to=zhanjie9@hisilicon.com \
    --cc=cw00.choi@samsung.com \
    --cc=cwchoi00@gmail.com \
    --cc=kyungmin.park@samsung.com \
    --cc=lihuisong@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=myungjoo.ham@samsung.com \
    --cc=prime.zeng@hisilicon.com \
    --cc=tianyaxiong@kylinos.cn \
    --cc=zhangpengjie2@huawei.com \
    --cc=zhenglifeng1@huawei.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