summaryrefslogtreecommitdiffstats
path: root/drivers/perf/hisilicon/hisi_uncore_pmu.c
diff options
context:
space:
mode:
authorYury Norov <yury.norov@gmail.com>2022-02-10 14:48:56 -0800
committerWill Deacon <will@kernel.org>2022-02-15 14:38:57 +0000
commit95ed57c73bbcffa02cbb1d61c19484c2ec6de094 (patch)
tree868ab4d1a7d99ade05dc3729f5dc705d10387d87 /drivers/perf/hisilicon/hisi_uncore_pmu.c
parent602c873eb52e5717057eb0971258c8eb7440c4a5 (diff)
downloadlinux-95ed57c73bbcffa02cbb1d61c19484c2ec6de094.tar.bz2
perf: replace bitmap_weight with bitmap_empty where appropriate
In some places, drivers/perf code 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> Acked-by: Mark Rutland <mark.rutland@arm.com> Link: https://lore.kernel.org/r/20220210224933.379149-13-yury.norov@gmail.com Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'drivers/perf/hisilicon/hisi_uncore_pmu.c')
-rw-r--r--drivers/perf/hisilicon/hisi_uncore_pmu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/perf/hisilicon/hisi_uncore_pmu.c b/drivers/perf/hisilicon/hisi_uncore_pmu.c
index a738aeab5c04..358e4e284a62 100644
--- a/drivers/perf/hisilicon/hisi_uncore_pmu.c
+++ b/drivers/perf/hisilicon/hisi_uncore_pmu.c
@@ -393,7 +393,7 @@ EXPORT_SYMBOL_GPL(hisi_uncore_pmu_read);
void hisi_uncore_pmu_enable(struct pmu *pmu)
{
struct hisi_pmu *hisi_pmu = to_hisi_pmu(pmu);
- int enabled = bitmap_weight(hisi_pmu->pmu_events.used_mask,
+ bool enabled = !bitmap_empty(hisi_pmu->pmu_events.used_mask,
hisi_pmu->num_counters);
if (!enabled)