* [PATCH 07/54] gpu: drm: replace bitmap_weight with bitmap_empty where appropriate
[not found] <20220123183925.1052919-1-yury.norov@gmail.com>
@ 2022-01-23 18:38 ` Yury Norov
2022-01-23 18:38 ` [PATCH 16/54] cpufreq: replace cpumask_weight with cpumask_empty " Yury Norov
1 sibling, 0 replies; 4+ messages in thread
From: Yury Norov @ 2022-01-23 18:38 UTC (permalink / raw)
To: Yury Norov, Andy Shevchenko, Rasmus Villemoes, Andrew Morton,
Michał Mirosław, Greg Kroah-Hartman, Peter Zijlstra,
David Laight, Joe Perches, Dennis Zhou, Emil Renner Berthing,
Nicholas Piggin, Matti Vaittinen, Alexey Klimov, linux-kernel,
Rob Clark, Sean Paul, Abhinav Kumar, David Airlie, Daniel Vetter,
linux-arm-msm, dri-devel, freedreno
smp_request_block() in drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c calls
bitmap_weight() to check if any bit of a given bitmap is set. It's
better to use bitmap_empty() in that case because bitmap_empty() stops
traversing the bitmap as soon as it finds first set bit, while
bitmap_weight() counts all bits unconditionally.
Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c
index d7fa2c49e741..56a3063545ec 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c
@@ -68,7 +68,7 @@ static int smp_request_block(struct mdp5_smp *smp,
uint8_t reserved;
/* we shouldn't be requesting blocks for an in-use client: */
- WARN_ON(bitmap_weight(cs, cnt) > 0);
+ WARN_ON(!bitmap_empty(cs, cnt));
reserved = smp->reserved[cid];
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 16/54] cpufreq: replace cpumask_weight with cpumask_empty where appropriate
[not found] <20220123183925.1052919-1-yury.norov@gmail.com>
2022-01-23 18:38 ` [PATCH 07/54] gpu: drm: replace bitmap_weight with bitmap_empty where appropriate Yury Norov
@ 2022-01-23 18:38 ` Yury Norov
2022-01-24 10:41 ` Sudeep Holla
2022-02-09 6:15 ` Viresh Kumar
1 sibling, 2 replies; 4+ messages in thread
From: Yury Norov @ 2022-01-23 18:38 UTC (permalink / raw)
To: Yury Norov, Andy Shevchenko, Rasmus Villemoes, Andrew Morton,
Michał Mirosław, Greg Kroah-Hartman, Peter Zijlstra,
David Laight, Joe Perches, Dennis Zhou, Emil Renner Berthing,
Nicholas Piggin, Matti Vaittinen, Alexey Klimov, linux-kernel,
Andy Gross, Bjorn Andersson, Rafael J. Wysocki, Viresh Kumar,
Sudeep Holla, Cristian Marussi, linux-arm-msm, linux-pm,
linux-arm-kernel
drivers/cpufreq calls cpumask_weight() to check if any bit of a given
cpumask is set. We can do it more efficiently with cpumask_empty() because
cpumask_empty() stops traversing the cpumask as soon as it finds first set
bit, while cpumask_weight() counts all bits unconditionally.
Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
drivers/cpufreq/qcom-cpufreq-hw.c | 2 +-
drivers/cpufreq/scmi-cpufreq.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c
index 05f3d7876e44..95a0c57ab5bb 100644
--- a/drivers/cpufreq/qcom-cpufreq-hw.c
+++ b/drivers/cpufreq/qcom-cpufreq-hw.c
@@ -482,7 +482,7 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
}
qcom_get_related_cpus(index, policy->cpus);
- if (!cpumask_weight(policy->cpus)) {
+ if (cpumask_empty(policy->cpus)) {
dev_err(dev, "Domain-%d failed to get related CPUs\n", index);
ret = -ENOENT;
goto error;
diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c
index 1e0cd4d165f0..919fa6e3f462 100644
--- a/drivers/cpufreq/scmi-cpufreq.c
+++ b/drivers/cpufreq/scmi-cpufreq.c
@@ -154,7 +154,7 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy)
* table and opp-shared.
*/
ret = dev_pm_opp_of_get_sharing_cpus(cpu_dev, priv->opp_shared_cpus);
- if (ret || !cpumask_weight(priv->opp_shared_cpus)) {
+ if (ret || cpumask_empty(priv->opp_shared_cpus)) {
/*
* Either opp-table is not set or no opp-shared was found.
* Use the CPU mask from SCMI to designate CPUs sharing an OPP
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 16/54] cpufreq: replace cpumask_weight with cpumask_empty where appropriate
2022-01-23 18:38 ` [PATCH 16/54] cpufreq: replace cpumask_weight with cpumask_empty " Yury Norov
@ 2022-01-24 10:41 ` Sudeep Holla
2022-02-09 6:15 ` Viresh Kumar
1 sibling, 0 replies; 4+ messages in thread
From: Sudeep Holla @ 2022-01-24 10:41 UTC (permalink / raw)
To: Yury Norov
Cc: Andy Shevchenko, Rasmus Villemoes, Andrew Morton,
Michał Mirosław, Greg Kroah-Hartman, Sudeep Holla,
Peter Zijlstra, David Laight, Joe Perches, Dennis Zhou,
Emil Renner Berthing, Nicholas Piggin, Matti Vaittinen,
Alexey Klimov, linux-kernel, Andy Gross, Bjorn Andersson,
Rafael J. Wysocki, Viresh Kumar, Cristian Marussi, linux-arm-msm,
linux-pm, linux-arm-kernel
On Sun, Jan 23, 2022 at 10:38:47AM -0800, Yury Norov wrote:
> drivers/cpufreq calls cpumask_weight() to check if any bit of a given
> cpumask is set. We can do it more efficiently with cpumask_empty() because
> cpumask_empty() stops traversing the cpumask as soon as it finds first set
> bit, while cpumask_weight() counts all bits unconditionally.
>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com> (for SCMI cpufreq driver)
--
Regards,
Sudeep
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 16/54] cpufreq: replace cpumask_weight with cpumask_empty where appropriate
2022-01-23 18:38 ` [PATCH 16/54] cpufreq: replace cpumask_weight with cpumask_empty " Yury Norov
2022-01-24 10:41 ` Sudeep Holla
@ 2022-02-09 6:15 ` Viresh Kumar
1 sibling, 0 replies; 4+ messages in thread
From: Viresh Kumar @ 2022-02-09 6:15 UTC (permalink / raw)
To: Yury Norov
Cc: Andy Shevchenko, Rasmus Villemoes, Andrew Morton,
Michał Mirosław, Greg Kroah-Hartman, Peter Zijlstra,
David Laight, Joe Perches, Dennis Zhou, Emil Renner Berthing,
Nicholas Piggin, Matti Vaittinen, Alexey Klimov, linux-kernel,
Andy Gross, Bjorn Andersson, Rafael J. Wysocki, Sudeep Holla,
Cristian Marussi, linux-arm-msm, linux-pm, linux-arm-kernel
On 23-01-22, 10:38, Yury Norov wrote:
> drivers/cpufreq calls cpumask_weight() to check if any bit of a given
> cpumask is set. We can do it more efficiently with cpumask_empty() because
> cpumask_empty() stops traversing the cpumask as soon as it finds first set
> bit, while cpumask_weight() counts all bits unconditionally.
>
> Signed-off-by: Yury Norov <yury.norov@gmail.com>
> ---
> drivers/cpufreq/qcom-cpufreq-hw.c | 2 +-
> drivers/cpufreq/scmi-cpufreq.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
Applied. Thanks.
--
viresh
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-02-09 6:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20220123183925.1052919-1-yury.norov@gmail.com>
2022-01-23 18:38 ` [PATCH 07/54] gpu: drm: replace bitmap_weight with bitmap_empty where appropriate Yury Norov
2022-01-23 18:38 ` [PATCH 16/54] cpufreq: replace cpumask_weight with cpumask_empty " Yury Norov
2022-01-24 10:41 ` Sudeep Holla
2022-02-09 6:15 ` Viresh Kumar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox