Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5733078imw; Wed, 20 Jul 2022 11:20:36 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vSsqi1M+37ZFKXmOnzoD+Xu9eQhAjhhos9DemIfFWxTNJyIP7uPYCerRlXKay5IYENg3+r X-Received: by 2002:a05:6a00:2495:b0:52b:7a9:9c72 with SMTP id c21-20020a056a00249500b0052b07a99c72mr40097531pfv.46.1658341236256; Wed, 20 Jul 2022 11:20:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658341236; cv=none; d=google.com; s=arc-20160816; b=lbYoqzasmhcYjCGhJyDcnkHYbUpMfdzoYoR7NAWMPuILT1pSrU5fM+aRJa88ULrdpH U5rOr2q7UfPyvYIyz25QWOJU6UL5NV967/NBpDBXtZeiSru1MkwJNPAkjHobl6u41kxI JALkgpB0XjM6ibiw9msYjJkVLKTPvFeLDKj+FOiK6cfkRaMq84CwaFOH8PKB34mW+JoF 9dQ2bvUTagUUUDOXa6k0JBVl2VPscOf59h8F1rddh2gY7cKz0IQPZS236aHTpK6qcLID HVXardNVQtclaVKOTTrgaq7VEdmBHiWEXTMx5WAlighlU7AxJ2fWHjlLwUhR2VdS/Suw qsnw== 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 :message-id:date:subject:cc:to:from; bh=8zqW8BRAyOijBCTdLrkZuZRJcxguTeLFQ4Bo8T9UuEc=; b=R+eQi5qyT57ZdtzVh3cNgOodOQkgLsAQFJKNs6W+qdyoIEJ42jlBFeNQ2t7VuUC8eP 58LQzTrFRWRRVwuaix26EWrw4sYuuA93gRLy/dIHH6qmC4XepclPMjYGHeOLg/+2+k4A 2bHSpY/VHmXVYDF6H4y9VBAVY7Lga7UFlGBw/EJWi6pzau5swTQ+nOPgk3JXchi/xrD9 MTmwNRMSKEqi0Bsv1j5TwFuybMqX42QVyb878h5Iy8QfcEWgg0WgMOmuYdJJrNY6Sf0z 3Z/mds8jYieNqnBSoHdCo5YHF+VZfVGYFZpeArOYpSDjk1Gcpph6pZaTFI5dFh0s9GJ2 F3hw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bh10-20020a056a02020a00b0041635b11675si9978505pgb.728.2022.07.20.11.20.20; Wed, 20 Jul 2022 11:20:36 -0700 (PDT) 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 S234553AbiGTSOC (ORCPT + 99 others); Wed, 20 Jul 2022 14:14:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238448AbiGTSOB (ORCPT ); Wed, 20 Jul 2022 14:14:01 -0400 Received: from smtp.smtpout.orange.fr (smtp-12.smtpout.orange.fr [80.12.242.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 248F465D4A for ; Wed, 20 Jul 2022 11:13:59 -0700 (PDT) Received: from pop-os.home ([90.11.190.129]) by smtp.orange.fr with ESMTPA id EECpoJI9YvbzbEECpo9R0Y; Wed, 20 Jul 2022 20:13:57 +0200 X-ME-Helo: pop-os.home X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Wed, 20 Jul 2022 20:13:57 +0200 X-ME-IP: 90.11.190.129 From: Christophe JAILLET To: Don Brace , "James E.J. Bottomley" , "Martin K. Petersen" Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , storagedev@microchip.com, linux-scsi@vger.kernel.org Subject: [PATCH 1/2] scsi: hpsa: Use the bitmap API to allocate bitmaps Date: Wed, 20 Jul 2022 20:13:54 +0200 Message-Id: <5f975ef43f8b7306e4ac4e2e8ce4bcd53f6092bb.1658340441.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, 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 Use bitmap_zalloc()/bitmap_free() instead of hand-writing them. It is less verbose and it improves the semantic. Signed-off-by: Christophe JAILLET --- drivers/scsi/hpsa.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index a47bcce3c9c7..0612ca681200 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -8030,7 +8030,7 @@ static int hpsa_init_reset_devices(struct pci_dev *pdev, u32 board_id) static void hpsa_free_cmd_pool(struct ctlr_info *h) { - kfree(h->cmd_pool_bits); + bitmap_free(h->cmd_pool_bits); h->cmd_pool_bits = NULL; if (h->cmd_pool) { dma_free_coherent(&h->pdev->dev, @@ -8052,9 +8052,7 @@ static void hpsa_free_cmd_pool(struct ctlr_info *h) static int hpsa_alloc_cmd_pool(struct ctlr_info *h) { - h->cmd_pool_bits = kcalloc(DIV_ROUND_UP(h->nr_cmds, BITS_PER_LONG), - sizeof(unsigned long), - GFP_KERNEL); + h->cmd_pool_bits = bitmap_zalloc(h->nr_cmds, GFP_KERNEL); h->cmd_pool = dma_alloc_coherent(&h->pdev->dev, h->nr_cmds * sizeof(*h->cmd_pool), &h->cmd_pool_dhandle, GFP_KERNEL); -- 2.34.1