Commit 2d60eca5 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by John Paul Adrian Glaubitz

sh: sq: Use the bitmap API when applicable

Using the bitmap API is less verbose than hand writing it.
It also improves the semantic.
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: default avatarJohn Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Link: https://lore.kernel.org/r/a51e9f32c19a007f4922943282cb12c89064440d.1681671848.git.christophe.jaillet@wanadoo.frSigned-off-by: default avatarJohn Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
parent 80f746e2
......@@ -372,7 +372,6 @@ static struct subsys_interface sq_interface = {
static int __init sq_api_init(void)
{
unsigned int nr_pages = 0x04000000 >> PAGE_SHIFT;
unsigned int size = (nr_pages + (BITS_PER_LONG - 1)) / BITS_PER_LONG;
int ret = -ENOMEM;
printk(KERN_NOTICE "sq: Registering store queue API.\n");
......@@ -382,7 +381,7 @@ static int __init sq_api_init(void)
if (unlikely(!sq_cache))
return ret;
sq_bitmap = kcalloc(size, sizeof(long), GFP_KERNEL);
sq_bitmap = bitmap_zalloc(nr_pages, GFP_KERNEL);
if (unlikely(!sq_bitmap))
goto out;
......@@ -393,7 +392,7 @@ static int __init sq_api_init(void)
return 0;
out:
kfree(sq_bitmap);
bitmap_free(sq_bitmap);
kmem_cache_destroy(sq_cache);
return ret;
......@@ -402,7 +401,7 @@ static int __init sq_api_init(void)
static void __exit sq_api_exit(void)
{
subsys_interface_unregister(&sq_interface);
kfree(sq_bitmap);
bitmap_free(sq_bitmap);
kmem_cache_destroy(sq_cache);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment