From nobody Sun Apr 19 07:30:00 2026 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 01C77CCA479 for ; Mon, 4 Jul 2022 20:31:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233502AbiGDUb6 (ORCPT ); Mon, 4 Jul 2022 16:31:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230210AbiGDUb5 (ORCPT ); Mon, 4 Jul 2022 16:31:57 -0400 Received: from smtp.smtpout.orange.fr (smtp08.smtpout.orange.fr [80.12.242.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1884D655C for ; Mon, 4 Jul 2022 13:31:56 -0700 (PDT) Received: from pop-os.home ([90.11.190.129]) by smtp.orange.fr with ESMTPA id 8SjZo3fqFNUm18SjZokYxx; Mon, 04 Jul 2022 22:31:54 +0200 X-ME-Helo: pop-os.home X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Mon, 04 Jul 2022 22:31:54 +0200 X-ME-IP: 90.11.190.129 From: Christophe JAILLET To: Thierry Reding , David Airlie , Daniel Vetter Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org Subject: [PATCH] gpu: host1x: Use the bitmap API to allocate bitmaps Date: Mon, 4 Jul 2022 22:31:51 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use bitmap_zalloc()/bitmap_free() instead of hand-writing them. It is less verbose and it improves the semantic. While at it, remove a useless bitmap_zero() call. The bitmap is already zero'ed when allocated. Signed-off-by: Christophe JAILLET --- drivers/gpu/host1x/channel.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/host1x/channel.c b/drivers/gpu/host1x/channel.c index 2a9a3a8d5931..2d0051d6314c 100644 --- a/drivers/gpu/host1x/channel.c +++ b/drivers/gpu/host1x/channel.c @@ -21,22 +21,18 @@ int host1x_channel_list_init(struct host1x_channel_list= *chlist, if (!chlist->channels) return -ENOMEM; =20 - chlist->allocated_channels =3D - kcalloc(BITS_TO_LONGS(num_channels), sizeof(unsigned long), - GFP_KERNEL); + chlist->allocated_channels =3D bitmap_zalloc(num_channels, GFP_KERNEL); if (!chlist->allocated_channels) { kfree(chlist->channels); return -ENOMEM; } =20 - bitmap_zero(chlist->allocated_channels, num_channels); - return 0; } =20 void host1x_channel_list_free(struct host1x_channel_list *chlist) { - kfree(chlist->allocated_channels); + bitmap_free(chlist->allocated_channels); kfree(chlist->channels); } =20 --=20 2.34.1