2021-12-01 06:47:24

by Tang Yizhou

[permalink] [raw]
Subject: [PATCH v2 0/2] cpufreq: Update function comment and document

v2:
1. Take viresh's advice and update the comments in cpufreq.c
2. Add an Acked-by tag in Patch 2.

Tang Yizhou (2):
cpufreq: Fix a comment in cpufreq_policy_free
doc/cpufreq: Update core.rst

Documentation/cpu-freq/core.rst | 6 +++---
drivers/cpufreq/cpufreq.c | 9 +++++++--
2 files changed, 10 insertions(+), 5 deletions(-)

--
2.17.1



2021-12-01 06:47:26

by Tang Yizhou

[permalink] [raw]
Subject: [PATCH v2 1/2] cpufreq: Fix a comment in cpufreq_policy_free

Comment both when CPUFREQ_CREATE_POLICY and CPUFREQ_REMOVE_POLICY
notification are sent.

Signed-off-by: Tang Yizhou <[email protected]>
---
drivers/cpufreq/cpufreq.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index e338d2f010fe..e76777881739 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1296,8 +1296,9 @@ static void cpufreq_policy_free(struct cpufreq_policy *policy)

if (policy->max_freq_req) {
/*
- * CPUFREQ_CREATE_POLICY notification is sent only after
- * successfully adding max_freq_req request.
+ * Need to send CPUFREQ_REMOVE_POLICY notification if
+ * max_freq_req request is successfully added.
+ * See also: CPUFREQ_CREATE_POLICY notification.
*/
blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
CPUFREQ_REMOVE_POLICY, policy);
@@ -1429,6 +1430,10 @@ static int cpufreq_online(unsigned int cpu)
goto out_destroy_policy;
}

+ /*
+ * CPUFREQ_CREATE_POLICY notification is sent only after
+ * successfully adding max_freq_req request.
+ */
blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
CPUFREQ_CREATE_POLICY, policy);
}
--
2.17.1


2021-12-01 06:47:27

by Tang Yizhou

[permalink] [raw]
Subject: [PATCH v2 2/2] doc/cpufreq: Update core.rst

As the definition of struct cpufreq_freqs has changed, update core.rst
with the new first member of struct cpufreq_freqs.

Signed-off-by: Tang Yizhou <[email protected]>
Acked-by: Viresh Kumar <[email protected]>
---
Documentation/cpu-freq/core.rst | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/cpu-freq/core.rst b/Documentation/cpu-freq/core.rst
index 33cb90bd1d8f..4ceef8e7217c 100644
--- a/Documentation/cpu-freq/core.rst
+++ b/Documentation/cpu-freq/core.rst
@@ -73,12 +73,12 @@ CPUFREQ_POSTCHANGE.
The third argument is a struct cpufreq_freqs with the following
values:

-===== ===========================
-cpu number of the affected CPU
+====== ======================================
+policy a pointer to the struct cpufreq_policy
old old frequency
new new frequency
flags flags of the cpufreq driver
-===== ===========================
+====== ======================================

3. CPUFreq Table Generation with Operating Performance Point (OPP)
==================================================================
--
2.17.1


2021-12-01 06:51:18

by Viresh Kumar

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] cpufreq: Fix a comment in cpufreq_policy_free

On 01-12-21, 15:14, Tang Yizhou wrote:
> Comment both when CPUFREQ_CREATE_POLICY and CPUFREQ_REMOVE_POLICY
> notification are sent.
>
> Signed-off-by: Tang Yizhou <[email protected]>
> ---
> drivers/cpufreq/cpufreq.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index e338d2f010fe..e76777881739 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1296,8 +1296,9 @@ static void cpufreq_policy_free(struct cpufreq_policy *policy)
>
> if (policy->max_freq_req) {
> /*
> - * CPUFREQ_CREATE_POLICY notification is sent only after
> - * successfully adding max_freq_req request.
> + * Need to send CPUFREQ_REMOVE_POLICY notification if
> + * max_freq_req request is successfully added.
> + * See also: CPUFREQ_CREATE_POLICY notification.

I will rather write this as:

/*
* Remove max_freq_req after sending CPUFREQ_REMOVE_POLICY
* notification, since CPUFREQ_CREATE_POLICY notification was
* sent after adding max_freq_req earlier.
*/

> */
> blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
> CPUFREQ_REMOVE_POLICY, policy);
> @@ -1429,6 +1430,10 @@ static int cpufreq_online(unsigned int cpu)
> goto out_destroy_policy;
> }
>
> + /*
> + * CPUFREQ_CREATE_POLICY notification is sent only after
> + * successfully adding max_freq_req request.
> + */

This is obvious, we don't need a comment here.

> blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
> CPUFREQ_CREATE_POLICY, policy);
> }
> --
> 2.17.1

--
viresh