Skip to content

Commit 49a1a3c

Browse files
tititiou36guoren83
authored andcommitted
csky: Use the bitmap API to allocate bitmaps
Use bitmap_zalloc()/bitmap_free() instead of hand-writing them. It is less verbose and it improves the semantic. While at it, turn a bitmap_clear() into an equivalent bitmap_zero(). It is also less verbose. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Guo Ren <guoren@kernel.org>
1 parent a2310c7 commit 49a1a3c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

arch/csky/mm/asid.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ static void flush_context(struct asid_info *info)
2727
u64 asid;
2828

2929
/* Update the list of reserved ASIDs and the ASID bitmap. */
30-
bitmap_clear(info->map, 0, NUM_CTXT_ASIDS(info));
30+
bitmap_zero(info->map, NUM_CTXT_ASIDS(info));
3131

3232
for_each_possible_cpu(i) {
3333
asid = atomic64_xchg_relaxed(&active_asid(info, i), 0);
@@ -178,8 +178,7 @@ int asid_allocator_init(struct asid_info *info,
178178
*/
179179
WARN_ON(NUM_CTXT_ASIDS(info) - 1 <= num_possible_cpus());
180180
atomic64_set(&info->generation, ASID_FIRST_VERSION(info));
181-
info->map = kcalloc(BITS_TO_LONGS(NUM_CTXT_ASIDS(info)),
182-
sizeof(*info->map), GFP_KERNEL);
181+
info->map = bitmap_zalloc(NUM_CTXT_ASIDS(info), GFP_KERNEL);
183182
if (!info->map)
184183
return -ENOMEM;
185184

0 commit comments

Comments
 (0)