Commit 6d24b4d1 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Oded Gabbay
Browse files

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: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: default avatarOded Gabbay <ogabbay@kernel.org>
Signed-off-by: default avatarOded Gabbay <ogabbay@kernel.org>
parent ead36b19
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -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)