Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1681461imw; Sat, 9 Jul 2022 09:20:19 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tRUGbqmYbWfY30q7YoXTwJLprpMhZC0JUo0WChDIVlVPAOR+rLl/DtHR/QdsTU3baLOmvT X-Received: by 2002:a63:6a43:0:b0:411:4fd7:c381 with SMTP id f64-20020a636a43000000b004114fd7c381mr8246615pgc.46.1657383619464; Sat, 09 Jul 2022 09:20:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657383619; cv=none; d=google.com; s=arc-20160816; b=ahWZiPBLe1+xmcqw5wsEfhpDpbvVawYy93r9R5Otyd6vlsYWl5wwjoTAjMPuRN2tL7 gruVKQrb062Yijqno+JEOThBWy2VPW6hHYbLD42YX2aGEcIfDuxz5wwEGtia4P/QicN5 aejdCpW4pkdb1V+W+II37YAhig/zc8c4mNnhp5yv41LeFf+iDpo93B0tGfADM09q9gJs rGUp/a3EQ8WOMELrPXyxsZwclZP+8bHFi1k92oZfYsrzokZxQFw0CVBLQe7IWwnSoAlD NxEC3jaTxieJV5WuK+hGeXrnr1BRKzLl23baMXRfvx9xwgiCki1BuMPeE96Ot0dgsfuY l1AQ== 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=9lOkIB1V9TUaMNLH3mO0Qxek9chehmKJ1jhLqDtUjy8=; b=Iuv4YNEMwx0e7Diwo1IaiJdGbc6s/PBI/c6euY7+KVUKy+ywlKOYswm249H1+KxRCy 6jP/eMbk1KyTjxCRykfoWViPDx4dKBCLwF+bvxlmXB2mLmu9/hQBTBgKGBDL/+QW2TbY xcG4r3MbVtc0FkeIEA6OqAZGENbF81TkKrZAqj194pfjVyb/nl5oZFyxDLyY+UQmQ8KY jtZPAC7ZkYpYVmHjw2eTcKZqxC88HZ9e7vk6wk7yFg1r0VLtL8n6x90h+K/t4MlGaQU6 0hTO5RjCTIxutD10pUG08fNIYnccykDLWLZkxhErX9ehIZzjIiKZOObfDEyF8+cVZv8C 8/nQ== 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 g21-20020a170902869500b0016a308ea9d6si2589418plo.427.2022.07.09.09.20.04; Sat, 09 Jul 2022 09:20:19 -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 S229537AbiGIQLe (ORCPT + 99 others); Sat, 9 Jul 2022 12:11:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229488AbiGIQLd (ORCPT ); Sat, 9 Jul 2022 12:11:33 -0400 Received: from smtp.smtpout.orange.fr (smtp03.smtpout.orange.fr [80.12.242.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3054F2CCAA for ; Sat, 9 Jul 2022 09:11:32 -0700 (PDT) Received: from pop-os.home ([90.11.190.129]) by smtp.orange.fr with ESMTPA id AD3JoHrjCJXxRAD3Kol9tD; Sat, 09 Jul 2022 18:11:30 +0200 X-ME-Helo: pop-os.home X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Sat, 09 Jul 2022 18:11:30 +0200 X-ME-IP: 90.11.190.129 From: Christophe JAILLET To: Niklas Schnelle , Gerald Schaefer , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-s390@vger.kernel.org Subject: [PATCH] s390/pci: Use the bitmap API to allocate bitmaps Date: Sat, 9 Jul 2022 18:11:28 +0200 Message-Id: <8d35e482f710889a45d46f808155738ef87d46c4.1657383052.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,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 --- I don't know why commit c506fff3d3a8 ("s390/pci: resize iomap") has turned this bitmap from a statically defined bitmap to a runtime-allocated one. Going back to a: static DECLARE_BITMAP(zpci_iomap_bitmap, ZPCI_IOMAP_ENTRIES); would slightly simply code. --- arch/s390/pci/pci.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c index bc980fd313d5..b965553de143 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c @@ -1059,8 +1059,7 @@ static int zpci_mem_init(void) if (!zpci_iomap_start) goto error_iomap; - zpci_iomap_bitmap = kcalloc(BITS_TO_LONGS(ZPCI_IOMAP_ENTRIES), - sizeof(*zpci_iomap_bitmap), GFP_KERNEL); + zpci_iomap_bitmap = bitmap_zalloc(ZPCI_IOMAP_ENTRIES, GFP_KERNEL); if (!zpci_iomap_bitmap) goto error_iomap_bitmap; @@ -1078,7 +1077,7 @@ static int zpci_mem_init(void) static void zpci_mem_exit(void) { - kfree(zpci_iomap_bitmap); + bitmap_free(zpci_iomap_bitmap); kfree(zpci_iomap_start); kmem_cache_destroy(zdev_fmb_cache); } -- 2.34.1