[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250811165130.37552-2-yury.norov@gmail.com>
Date: Mon, 11 Aug 2025 12:51:27 -0400
From: Yury Norov <yury.norov@...il.com>
To: "Jiri Slaby (SUSE)" <jirislaby@...nel.org>,
Madhavan Srinivasan <maddy@...ux.ibm.com>,
Michael Ellerman <mpe@...erman.id.au>,
Nicholas Piggin <npiggin@...il.com>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Thomas Gleixner <tglx@...utronix.de>,
Frederic Barrat <fbarrat@...ux.ibm.com>,
Andrew Donnellan <ajd@...ux.ibm.com>,
Yury Norov <yury.norov@...il.com>,
linuxppc-dev@...ts.ozlabs.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v2 1/2] powerpc: pci-ioda: use bitmap_alloc() in pnv_ioda_pick_m64_pe()
From: "Yury Norov (NVIDIA)" <yury.norov@...il.com>
Use the dedicated bitmap_alloc() in pnv_ioda_pick_m64_pe() and drop
some housekeeping code.
Because pe_alloc is local, annotate it with __free() and get rid of
the explicit kfree() calls.
Suggested-by: Jiri Slaby <jirislaby@...nel.org>
Signed-off-by: Yury Norov (NVIDIA) <yury.norov@...il.com>
---
arch/powerpc/platforms/powernv/pci-ioda.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index d8ccf2c9b98a..e2b0132fb6a1 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -292,18 +292,16 @@ static void pnv_ioda_reserve_m64_pe(struct pci_bus *bus,
static struct pnv_ioda_pe *pnv_ioda_pick_m64_pe(struct pci_bus *bus, bool all)
{
+ unsigned long *pe_alloc __free(bitmap) = NULL;
struct pnv_phb *phb = pci_bus_to_pnvhb(bus);
struct pnv_ioda_pe *master_pe, *pe;
- unsigned long size, *pe_alloc;
int i;
/* Root bus shouldn't use M64 */
if (pci_is_root_bus(bus))
return NULL;
- /* Allocate bitmap */
- size = ALIGN(phb->ioda.total_pe_num / 8, sizeof(unsigned long));
- pe_alloc = kzalloc(size, GFP_KERNEL);
+ pe_alloc = bitmap_alloc(phb->ioda.total_pe_num, GFP_KERNEL);
if (!pe_alloc) {
pr_warn("%s: Out of memory !\n",
__func__);
@@ -319,7 +317,6 @@ static struct pnv_ioda_pe *pnv_ioda_pick_m64_pe(struct pci_bus *bus, bool all)
* pick M64 dependent PE#.
*/
if (bitmap_empty(pe_alloc, phb->ioda.total_pe_num)) {
- kfree(pe_alloc);
return NULL;
}
@@ -345,7 +342,6 @@ static struct pnv_ioda_pe *pnv_ioda_pick_m64_pe(struct pci_bus *bus, bool all)
}
}
- kfree(pe_alloc);
return master_pe;
}
--
2.43.0
Powered by blists - more mailing lists