mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 12:44:11 +08:00
perf/arm-cci: Use the bitmap API to allocate bitmaps
Use devm_bitmap_zalloc() instead of hand-writing it. It is less verbose and it improves the semantic. While at it, use bitmap_zero() instead of hand-writing it. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/fbde85a5e8ae99b10a2115d8ea1e69320a62947f.1657084786.git.christophe.jaillet@wanadoo.fr Signed-off-by: Will Deacon <will@kernel.org>
This commit is contained in:
parent
e9a023f2b7
commit
0e35850b34
@ -1261,7 +1261,7 @@ static int validate_group(struct perf_event *event)
|
||||
*/
|
||||
.used_mask = mask,
|
||||
};
|
||||
memset(mask, 0, BITS_TO_LONGS(cci_pmu->num_cntrs) * sizeof(unsigned long));
|
||||
bitmap_zero(mask, cci_pmu->num_cntrs);
|
||||
|
||||
if (!validate_event(event->pmu, &fake_pmu, leader))
|
||||
return -EINVAL;
|
||||
@ -1629,10 +1629,9 @@ static struct cci_pmu *cci_pmu_alloc(struct device *dev)
|
||||
GFP_KERNEL);
|
||||
if (!cci_pmu->hw_events.events)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
cci_pmu->hw_events.used_mask = devm_kcalloc(dev,
|
||||
BITS_TO_LONGS(CCI_PMU_MAX_HW_CNTRS(model)),
|
||||
sizeof(*cci_pmu->hw_events.used_mask),
|
||||
GFP_KERNEL);
|
||||
cci_pmu->hw_events.used_mask = devm_bitmap_zalloc(dev,
|
||||
CCI_PMU_MAX_HW_CNTRS(model),
|
||||
GFP_KERNEL);
|
||||
if (!cci_pmu->hw_events.used_mask)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user