From patchwork Fri Nov 25 12:23:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 25970 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3978710wrr; Fri, 25 Nov 2022 04:31:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf6KoDVdLdn5slPBRPMv/d8+rPjl0P3GsZuroS6r0wBgImam3i4AUFS5it81U6d24zyV27j2 X-Received: by 2002:a17:906:29cc:b0:78d:a836:1d88 with SMTP id y12-20020a17090629cc00b0078da8361d88mr16553694eje.470.1669379462804; Fri, 25 Nov 2022 04:31:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669379462; cv=none; d=google.com; s=arc-20160816; b=dopt5F+q+rx0tr/le4kBlZCOftm3cU3OPiUlKNV5vjTiFk34BMcCrv67H3VqPRRNTc 58eCxCCGxqixSKNjdMn/zswdYD0jEh+kFKpSQS0LoPbfcn8NYF04B5KwpmxcA5oWtVEO qWS986V5TCxCYWisM3bEYcEMdYTT7AEzXbabLfRvwP3mZcTd0s0ZcLg2dN1e3eTiKw6/ 2gpeuX3/ql76cfdjAzNBTg0LS2FX9Ukg1HJjNSVJ2eElbIyWqPbFh5xfofu5B2qS5gD6 p/3rDnKs2p5EbhUgmJPKcnrxtDfz496L4Y+Lb4BYpYe3CCBUgJatPgcNZGYnrEf53N/z TGcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=7R9mpIXHyBPeGtkxRESt6d6aXPmuP0MG/O2UNaCjUv4=; b=vekiNcCeQ4uRFNBpP5dF/DKHPbZ3pu9fHNT6aXWYJOkN5EJOaaEw/qN7SFNBoCd4EO SEVAEin/KZwuH/WqJ3/rte0CxGaa5q3O+1denUQtDDujFj9bcEQ3NCqfscbfgt2rnKxZ rJnAlHEat+n8SwzWJa2pvztG1TicsbC5OISpj53YJvgzFlAp76QD/bbAE6O31Z2YJPQT rVzJcKM9ptD5KInfe/ne5NEw3k2ImuZ5TR6uZQM1edCtgkmZ6EC3N+EklhKGOJCyz7UD ujlRvJVHpBdy2grgmURpuhm5QKfCbo1fA5TmPTMYxOtGxFsb8t53c2REVCwZ9xf1/2Wm +YnQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nd39-20020a17090762a700b0078dce2b1985si3300854ejc.134.2022.11.25.04.30.33; Fri, 25 Nov 2022 04:31:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229572AbiKYMYX (ORCPT + 99 others); Fri, 25 Nov 2022 07:24:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229883AbiKYMYL (ORCPT ); Fri, 25 Nov 2022 07:24:11 -0500 Received: from smtp.smtpout.orange.fr (smtp-13.smtpout.orange.fr [80.12.242.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30D9F4A071 for ; Fri, 25 Nov 2022 04:24:11 -0800 (PST) Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id yXkRoPBKkY4XVyXkXoE20c; Fri, 25 Nov 2022 13:24:09 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 25 Nov 2022 13:24:09 +0100 X-ME-IP: 86.243.100.34 From: Christophe JAILLET To: Sunil Goutham , Linu Cherian , Geetha sowjanya , Jerin Jacob , hariprasad , Subbaraya Sundeep , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , netdev@vger.kernel.org Subject: [PATCH 3/5] octeontx2-af: Use the bitmap API to allocate bitmaps Date: Fri, 25 Nov 2022 13:23:59 +0100 Message-Id: <24177a9ee7043259448b735263d9cfd6a70e89a4.1669378798.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750471239793056126?= X-GMAIL-MSGID: =?utf-8?q?1750471239793056126?= Use devm_bitmap_zalloc() instead of hand-writing it. This also makes the comment "Allocate bitmap for 32 entry mcam" more explicit because now 32 is really used in the allocation function, instead of an obscure 'sizeof(long)'. Signed-off-by: Christophe JAILLET --- drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c index c584680f2d2b..3f94b620ef5a 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c @@ -1898,15 +1898,15 @@ int rvu_npc_exact_init(struct rvu *rvu) table_size = table->mem_table.depth * table->mem_table.ways; /* Allocate bitmap for 4way 2K table */ - table->mem_table.bmap = devm_kcalloc(rvu->dev, BITS_TO_LONGS(table_size), - sizeof(long), GFP_KERNEL); + table->mem_table.bmap = devm_bitmap_zalloc(rvu->dev, table_size, + GFP_KERNEL); if (!table->mem_table.bmap) return -ENOMEM; dev_dbg(rvu->dev, "%s: Allocated bitmap for 4way 2K entry table\n", __func__); /* Allocate bitmap for 32 entry mcam */ - table->cam_table.bmap = devm_kcalloc(rvu->dev, 1, sizeof(long), GFP_KERNEL); + table->cam_table.bmap = devm_bitmap_zalloc(rvu->dev, 32, GFP_KERNEL); if (!table->cam_table.bmap) return -ENOMEM;