Skip to content

Commit 2d60eca

Browse files
tititiou36glaubitz
authored andcommitted
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: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Link: https://lore.kernel.org/r/a51e9f32c19a007f4922943282cb12c89064440d.1681671848.git.christophe.jaillet@wanadoo.fr Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
1 parent 80f746e commit 2d60eca

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

  • arch/sh/kernel/cpu/sh4

arch/sh/kernel/cpu/sh4/sq.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,6 @@ static struct subsys_interface sq_interface = {
372372
static int __init sq_api_init(void)
373373
{
374374
unsigned int nr_pages = 0x04000000 >> PAGE_SHIFT;
375-
unsigned int size = (nr_pages + (BITS_PER_LONG - 1)) / BITS_PER_LONG;
376375
int ret = -ENOMEM;
377376

378377
printk(KERN_NOTICE "sq: Registering store queue API.\n");
@@ -382,7 +381,7 @@ static int __init sq_api_init(void)
382381
if (unlikely(!sq_cache))
383382
return ret;
384383

385-
sq_bitmap = kcalloc(size, sizeof(long), GFP_KERNEL);
384+
sq_bitmap = bitmap_zalloc(nr_pages, GFP_KERNEL);
386385
if (unlikely(!sq_bitmap))
387386
goto out;
388387

@@ -393,7 +392,7 @@ static int __init sq_api_init(void)
393392
return 0;
394393

395394
out:
396-
kfree(sq_bitmap);
395+
bitmap_free(sq_bitmap);
397396
kmem_cache_destroy(sq_cache);
398397

399398
return ret;
@@ -402,7 +401,7 @@ static int __init sq_api_init(void)
402401
static void __exit sq_api_exit(void)
403402
{
404403
subsys_interface_unregister(&sq_interface);
405-
kfree(sq_bitmap);
404+
bitmap_free(sq_bitmap);
406405
kmem_cache_destroy(sq_cache);
407406
}
408407

0 commit comments

Comments
 (0)