summaryrefslogtreecommitdiff
path: root/drivers/misc
diff options
context:
space:
mode:
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>2022-07-03 23:36:30 +0300
committerOded Gabbay <ogabbay@kernel.org>2022-07-12 09:09:30 +0300
commit6d24b4d17df714c4a75255d5f18b1ec9007d13b5 (patch)
treec2413d6a79df28a51e2e17aaeb35b7c0574fc649 /drivers/misc
parentead36b198147711ec2f8fe83b66ec8e30de732db (diff)
downloadlinux-6d24b4d17df714c4a75255d5f18b1ec9007d13b5.tar.xz
habanalabs: 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. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/habanalabs/common/asid.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/misc/habanalabs/common/asid.c b/drivers/misc/habanalabs/common/asid.c
index ede04c032b6e..c9c2619cc43d 100644
--- a/drivers/misc/habanalabs/common/asid.c
+++ b/drivers/misc/habanalabs/common/asid.c
@@ -11,8 +11,7 @@
int hl_asid_init(struct hl_device *hdev)
{
- hdev->asid_bitmap = kcalloc(BITS_TO_LONGS(hdev->asic_prop.max_asid),
- sizeof(*hdev->asid_bitmap), GFP_KERNEL);
+ hdev->asid_bitmap = bitmap_zalloc(hdev->asic_prop.max_asid, GFP_KERNEL);
if (!hdev->asid_bitmap)
return -ENOMEM;
@@ -27,7 +26,7 @@ int hl_asid_init(struct hl_device *hdev)
void hl_asid_fini(struct hl_device *hdev)
{
mutex_destroy(&hdev->asid_mutex);
- kfree(hdev->asid_bitmap);
+ bitmap_free(hdev->asid_bitmap);
}
unsigned long hl_asid_alloc(struct hl_device *hdev)