All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RDMA/qib: Use the bitmap API to allocate bitmaps
@ 2022-07-08 17:20 Christophe JAILLET
  2022-07-11 12:08 ` Dennis Dalessandro
  2022-07-18  9:02 ` Leon Romanovsky
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2022-07-08 17:20 UTC (permalink / raw)
  To: Dennis Dalessandro, Jason Gunthorpe, Leon Romanovsky
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-rdma

Use bitmap_zalloc()/bitmap_free() instead of hand-writing them.

It is less verbose and it improves the semantic.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/infiniband/hw/qib/qib_init.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c
index d1a72e89e297..45211008449f 100644
--- a/drivers/infiniband/hw/qib/qib_init.c
+++ b/drivers/infiniband/hw/qib/qib_init.c
@@ -1106,8 +1106,7 @@ struct qib_devdata *qib_alloc_devdata(struct pci_dev *pdev, size_t extra)
 	if (!qib_cpulist_count) {
 		u32 count = num_online_cpus();
 
-		qib_cpulist = kcalloc(BITS_TO_LONGS(count), sizeof(long),
-				      GFP_KERNEL);
+		qib_cpulist = bitmap_zalloc(count, GFP_KERNEL);
 		if (qib_cpulist)
 			qib_cpulist_count = count;
 	}
@@ -1279,7 +1278,7 @@ static void __exit qib_ib_cleanup(void)
 #endif
 
 	qib_cpulist_count = 0;
-	kfree(qib_cpulist);
+	bitmap_free(qib_cpulist);
 
 	WARN_ON(!xa_empty(&qib_dev_table));
 	qib_dev_cleanup();
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] RDMA/qib: Use the bitmap API to allocate bitmaps
  2022-07-08 17:20 [PATCH] RDMA/qib: Use the bitmap API to allocate bitmaps Christophe JAILLET
@ 2022-07-11 12:08 ` Dennis Dalessandro
  2022-07-18  9:02 ` Leon Romanovsky
  1 sibling, 0 replies; 3+ messages in thread
From: Dennis Dalessandro @ 2022-07-11 12:08 UTC (permalink / raw)
  To: Christophe JAILLET, Jason Gunthorpe, Leon Romanovsky
  Cc: linux-kernel, kernel-janitors, linux-rdma

On 7/8/22 1:20 PM, Christophe JAILLET wrote:
> Use bitmap_zalloc()/bitmap_free() instead of hand-writing them.
> 
> It is less verbose and it improves the semantic.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/infiniband/hw/qib/qib_init.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c
> index d1a72e89e297..45211008449f 100644
> --- a/drivers/infiniband/hw/qib/qib_init.c
> +++ b/drivers/infiniband/hw/qib/qib_init.c
> @@ -1106,8 +1106,7 @@ struct qib_devdata *qib_alloc_devdata(struct pci_dev *pdev, size_t extra)
>  	if (!qib_cpulist_count) {
>  		u32 count = num_online_cpus();
>  
> -		qib_cpulist = kcalloc(BITS_TO_LONGS(count), sizeof(long),
> -				      GFP_KERNEL);
> +		qib_cpulist = bitmap_zalloc(count, GFP_KERNEL);
>  		if (qib_cpulist)
>  			qib_cpulist_count = count;
>  	}
> @@ -1279,7 +1278,7 @@ static void __exit qib_ib_cleanup(void)
>  #endif
>  
>  	qib_cpulist_count = 0;
> -	kfree(qib_cpulist);
> +	bitmap_free(qib_cpulist);
>  
>  	WARN_ON(!xa_empty(&qib_dev_table));
>  	qib_dev_cleanup();

Looks OK to me.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RDMA/qib: Use the bitmap API to allocate bitmaps
  2022-07-08 17:20 [PATCH] RDMA/qib: Use the bitmap API to allocate bitmaps Christophe JAILLET
  2022-07-11 12:08 ` Dennis Dalessandro
@ 2022-07-18  9:02 ` Leon Romanovsky
  1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2022-07-18  9:02 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Dennis Dalessandro, Jason Gunthorpe, linux-kernel,
	kernel-janitors, linux-rdma

On Fri, Jul 08, 2022 at 07:20:39PM +0200, Christophe JAILLET wrote:
> Use bitmap_zalloc()/bitmap_free() instead of hand-writing them.
> 
> It is less verbose and it improves the semantic.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/infiniband/hw/qib/qib_init.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 

Thanks, applied

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-18  9:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-08 17:20 [PATCH] RDMA/qib: Use the bitmap API to allocate bitmaps Christophe JAILLET
2022-07-11 12:08 ` Dennis Dalessandro
2022-07-18  9:02 ` Leon Romanovsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.