From patchwork Mon Jul 4 18:56:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 12905788 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4BDFC43334 for ; Mon, 4 Jul 2022 18:56:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232641AbiGDS47 (ORCPT ); Mon, 4 Jul 2022 14:56:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231281AbiGDS46 (ORCPT ); Mon, 4 Jul 2022 14:56:58 -0400 Received: from smtp.smtpout.orange.fr (smtp04.smtpout.orange.fr [80.12.242.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67FB910554 for ; Mon, 4 Jul 2022 11:56:56 -0700 (PDT) Received: from pop-os.home ([90.11.190.129]) by smtp.orange.fr with ESMTPA id 8RFdoQHoiIaWO8RFeo2rr9; Mon, 04 Jul 2022 20:56:54 +0200 X-ME-Helo: pop-os.home X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Mon, 04 Jul 2022 20:56:54 +0200 X-ME-IP: 90.11.190.129 From: Christophe JAILLET To: Thomas Bogendoerfer Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-mips@vger.kernel.org Subject: [PATCH] MIPS: math-emu: Use the bitmap API to allocate bitmaps Date: Mon, 4 Jul 2022 20:56:52 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Use bitmap_zalloc()/bitmap_free() instead of hand-writing them. It is less verbose and it improves the semantic. Signed-off-by: Christophe JAILLET --- 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,