From: Viresh Kumar <viresh.kumar@linaro.org>
To: Hector Yuan <hector.yuan@mediatek.com>
Cc: linux-mediatek@lists.infradead.org,
linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Rob Herring <robh+dt@kernel.org>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
wsd_upstream@mediatek.com
Subject: Re: [PATCH v15 2/3] cpufreq: Add of_perf_domain_get_sharing_cpumask
Date: Mon, 6 Sep 2021 15:13:09 +0530 [thread overview]
Message-ID: <20210906094309.rcacbme27zpvdd4a@vireshk-i7> (raw)
In-Reply-To: <1630658364-6192-3-git-send-email-hector.yuan@mediatek.com>
On 03-09-21, 16:39, Hector Yuan wrote:
> From: "Hector.Yuan" <hector.yuan@mediatek.com>
>
> Add of_perf_domain_get_sharing_cpumask function to group cpu
> to specific performance domain.
>
> Signed-off-by: Hector.Yuan <hector.yuan@mediatek.com>
> ---
> include/linux/cpufreq.h | 46 +++++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 45 insertions(+), 1 deletion(-)
To speed things up, I have applied this with following changes. Please
test my branch and see if something breaks:
https://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm.git/log/?h=cpufreq/arm/linux-next
--
viresh
-------------------------8<-------------------------
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 9eb1fa17a8a4..acd3ee5b8b0a 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -1006,37 +1006,49 @@ static inline int cpufreq_table_count_valid_entries(const struct cpufreq_policy
return count;
}
-static inline int of_perf_domain_get_sharing_cpumask(int pcpu, const char *list_name,
- const char *cell_name, struct cpumask *cpumask)
+static inline int parse_perf_domain(int cpu, const char *list_name,
+ const char *cell_name)
{
struct device_node *cpu_np;
struct of_phandle_args args;
+ int ret;
+
+ cpu_np = of_cpu_device_node_get(cpu);
+ if (!cpu_np)
+ return -ENODEV;
+
+ ret = of_parse_phandle_with_args(cpu_np, list_name, cell_name, 0,
+ &args);
+ if (ret < 0)
+ return ret;
+
+ of_node_put(cpu_np);
+
+ return args.args[0];
+}
+
+static inline int of_perf_domain_get_sharing_cpumask(int pcpu, const char *list_name,
+ const char *cell_name, struct cpumask *cpumask)
+{
int target_idx;
int cpu, ret;
- cpu_np = of_cpu_device_node_get(pcpu);
- of_parse_phandle_with_args(cpu_np, list_name,
- cell_name, 0, &args);
- of_node_put(cpu_np);
- target_idx = args.args[0];
+ ret = parse_perf_domain(pcpu, list_name, cell_name);
+ if (ret < 0)
+ return ret;
+
+ target_idx = ret;
+ cpumask_set_cpu(pcpu, cpumask);
for_each_possible_cpu(cpu) {
if (cpu == pcpu)
continue;
- cpu_np = of_cpu_device_node_get(cpu);
- if (!cpu_np)
- continue;
-
- ret = of_parse_phandle_with_args(cpu_np, list_name,
- cell_name, 0,
- &args);
-
- of_node_put(cpu_np);
+ ret = parse_perf_domain(pcpu, list_name, cell_name);
if (ret < 0)
continue;
- if (target_idx == args.args[0])
+ if (target_idx == ret)
cpumask_set_cpu(cpu, cpumask);
}
next prev parent reply other threads:[~2021-09-06 9:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-03 8:39 [PATCH v15] cpufreq: mediatek-hw: Add support for Mediatek cpufreq HW driver Hector Yuan
2021-09-03 8:39 ` [PATCH v15 1/3] dt-bindings: cpufreq: add bindings for MediaTek cpufreq HW Hector Yuan
2021-09-03 16:35 ` Rob Herring
2021-09-03 8:39 ` [PATCH v15 2/3] cpufreq: Add of_perf_domain_get_sharing_cpumask Hector Yuan
2021-09-04 22:32 ` kernel test robot
2021-09-06 9:43 ` Viresh Kumar [this message]
2021-09-06 13:11 ` Hector Yuan
2021-09-03 8:39 ` [PATCH v15 3/3] cpufreq: mediatek-hw: Add support for CPUFREQ HW Hector Yuan
2021-09-03 15:54 ` kernel test robot
2021-09-03 16:34 ` kernel test robot
2021-09-06 9:44 ` Viresh Kumar
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=20210906094309.rcacbme27zpvdd4a@vireshk-i7 \
--to=viresh.kumar@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=hector.yuan@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=robh+dt@kernel.org \
--cc=wsd_upstream@mediatek.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®