From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-mips@vger.kernel.org
Subject: Re: [PATCH] MIPS: math-emu: Use the bitmap API to allocate bitmaps
Date: Mon, 11 Jul 2022 10:37:35 +0200 [thread overview]
Message-ID: <20220711083735.GA6084@alpha.franken.de> (raw)
In-Reply-To: <dd954ccb2472019c64da0dd3a90d7b39a2fadc98.1656960999.git.christophe.jaillet@wanadoo.fr>
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 ]
prev parent reply other threads:[~2022-07-11 8:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220711083735.GA6084@alpha.franken.de \
--to=tsbogend@alpha.franken.de \
--cc=christophe.jaillet@wanadoo.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox