* [PATCH] MIPS: math-emu: Use the bitmap API to allocate bitmaps
@ 2022-07-04 18:56 Christophe JAILLET
2022-07-11 8:37 ` Thomas Bogendoerfer
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2022-07-04 18:56 UTC (permalink / raw)
To: Thomas Bogendoerfer
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-mips
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>
---
arch/mips/math-emu/dsemul.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/arch/mips/math-emu/dsemul.c b/arch/mips/math-emu/dsemul.c
index e2d46cb93ca9..e02bd20b60a6 100644
--- a/arch/mips/math-emu/dsemul.c
+++ b/arch/mips/math-emu/dsemul.c
@@ -82,11 +82,8 @@ static int alloc_emuframe(void)
/* Ensure we have an allocation bitmap */
if (!mm_ctx->bd_emupage_allocmap) {
- mm_ctx->bd_emupage_allocmap =
- kcalloc(BITS_TO_LONGS(emupage_frame_count),
- sizeof(unsigned long),
- GFP_ATOMIC);
-
+ mm_ctx->bd_emupage_allocmap = bitmap_zalloc(emupage_frame_count,
+ GFP_ATOMIC);
if (!mm_ctx->bd_emupage_allocmap) {
idx = BD_EMUFRAME_NONE;
goto out_unlock;
@@ -206,7 +203,7 @@ void dsemul_mm_cleanup(struct mm_struct *mm)
{
mm_context_t *mm_ctx = &mm->context;
- kfree(mm_ctx->bd_emupage_allocmap);
+ bitmap_free(mm_ctx->bd_emupage_allocmap);
}
int mips_dsemul(struct pt_regs *regs, mips_instruction ir,
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] MIPS: math-emu: Use the bitmap API to allocate bitmaps
2022-07-04 18:56 [PATCH] MIPS: math-emu: Use the bitmap API to allocate bitmaps Christophe JAILLET
@ 2022-07-11 8:37 ` Thomas Bogendoerfer
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Bogendoerfer @ 2022-07-11 8:37 UTC (permalink / raw)
To: Christophe JAILLET; +Cc: linux-kernel, kernel-janitors, linux-mips
On Mon, Jul 04, 2022 at 08:56:52PM +0200, Christophe JAILLET wrote:
> 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>
> ---
> arch/mips/math-emu/dsemul.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/arch/mips/math-emu/dsemul.c b/arch/mips/math-emu/dsemul.c
> index e2d46cb93ca9..e02bd20b60a6 100644
> --- a/arch/mips/math-emu/dsemul.c
> +++ b/arch/mips/math-emu/dsemul.c
> @@ -82,11 +82,8 @@ static int alloc_emuframe(void)
>
> /* Ensure we have an allocation bitmap */
> if (!mm_ctx->bd_emupage_allocmap) {
> - mm_ctx->bd_emupage_allocmap =
> - kcalloc(BITS_TO_LONGS(emupage_frame_count),
> - sizeof(unsigned long),
> - GFP_ATOMIC);
> -
> + mm_ctx->bd_emupage_allocmap = bitmap_zalloc(emupage_frame_count,
> + GFP_ATOMIC);
> if (!mm_ctx->bd_emupage_allocmap) {
> idx = BD_EMUFRAME_NONE;
> goto out_unlock;
> @@ -206,7 +203,7 @@ void dsemul_mm_cleanup(struct mm_struct *mm)
> {
> mm_context_t *mm_ctx = &mm->context;
>
> - kfree(mm_ctx->bd_emupage_allocmap);
> + bitmap_free(mm_ctx->bd_emupage_allocmap);
> }
>
> int mips_dsemul(struct pt_regs *regs, mips_instruction ir,
> --
> 2.34.1
applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-11 8:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-04 18:56 [PATCH] MIPS: math-emu: Use the bitmap API to allocate bitmaps Christophe JAILLET
2022-07-11 8:37 ` Thomas Bogendoerfer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox