mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
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>
This commit is contained in:
parent
a2310c74d4
commit
49a1a3cf73
1 changed files with 2 additions and 3 deletions
|
@ -27,7 +27,7 @@ static void flush_context(struct asid_info *info)
|
||||||
u64 asid;
|
u64 asid;
|
||||||
|
|
||||||
/* Update the list of reserved ASIDs and the ASID bitmap. */
|
/* Update the list of reserved ASIDs and the ASID bitmap. */
|
||||||
bitmap_clear(info->map, 0, NUM_CTXT_ASIDS(info));
|
bitmap_zero(info->map, NUM_CTXT_ASIDS(info));
|
||||||
|
|
||||||
for_each_possible_cpu(i) {
|
for_each_possible_cpu(i) {
|
||||||
asid = atomic64_xchg_relaxed(&active_asid(info, i), 0);
|
asid = atomic64_xchg_relaxed(&active_asid(info, i), 0);
|
||||||
|
@ -178,8 +178,7 @@ int asid_allocator_init(struct asid_info *info,
|
||||||
*/
|
*/
|
||||||
WARN_ON(NUM_CTXT_ASIDS(info) - 1 <= num_possible_cpus());
|
WARN_ON(NUM_CTXT_ASIDS(info) - 1 <= num_possible_cpus());
|
||||||
atomic64_set(&info->generation, ASID_FIRST_VERSION(info));
|
atomic64_set(&info->generation, ASID_FIRST_VERSION(info));
|
||||||
info->map = kcalloc(BITS_TO_LONGS(NUM_CTXT_ASIDS(info)),
|
info->map = bitmap_zalloc(NUM_CTXT_ASIDS(info), GFP_KERNEL);
|
||||||
sizeof(*info->map), GFP_KERNEL);
|
|
||||||
if (!info->map)
|
if (!info->map)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue