linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] qed: Use the bitmap API to allocate bitmaps
@ 2022-07-05 20:36 Christophe JAILLET
  2022-07-05 20:36 ` [PATCH 2/2] qed: Use bitmap_empty() Christophe JAILLET
  2022-07-07  3:00 ` [PATCH 1/2] qed: Use the bitmap API to allocate bitmaps patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2022-07-05 20:36 UTC (permalink / raw)
  To: Ariel Elior, Manish Chopra, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, netdev

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/net/ethernet/qlogic/qed/qed_rdma.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_rdma.c b/drivers/net/ethernet/qlogic/qed/qed_rdma.c
index 69b0ede75cae..689a7168448f 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_rdma.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_rdma.c
@@ -42,8 +42,7 @@ int qed_rdma_bmap_alloc(struct qed_hwfn *p_hwfn,
 
 	bmap->max_count = max_count;
 
-	bmap->bitmap = kcalloc(BITS_TO_LONGS(max_count), sizeof(long),
-			       GFP_KERNEL);
+	bmap->bitmap = bitmap_zalloc(max_count, GFP_KERNEL);
 	if (!bmap->bitmap)
 		return -ENOMEM;
 
@@ -343,7 +342,7 @@ void qed_rdma_bmap_free(struct qed_hwfn *p_hwfn,
 	}
 
 end:
-	kfree(bmap->bitmap);
+	bitmap_free(bmap->bitmap);
 	bmap->bitmap = NULL;
 }
 
-- 
2.34.1


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

* [PATCH 2/2] qed: Use bitmap_empty()
  2022-07-05 20:36 [PATCH 1/2] qed: Use the bitmap API to allocate bitmaps Christophe JAILLET
@ 2022-07-05 20:36 ` Christophe JAILLET
  2022-07-07  3:00 ` [PATCH 1/2] qed: Use the bitmap API to allocate bitmaps patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Christophe JAILLET @ 2022-07-05 20:36 UTC (permalink / raw)
  To: Ariel Elior, Manish Chopra, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, netdev

Use bitmap_empty() instead of hand-writing it.

It is less verbose and it improves the semantic.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/net/ethernet/qlogic/qed/qed_rdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_rdma.c b/drivers/net/ethernet/qlogic/qed/qed_rdma.c
index 689a7168448f..5a5dbbb8d8aa 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_rdma.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_rdma.c
@@ -106,7 +106,7 @@ int qed_bmap_test_id(struct qed_hwfn *p_hwfn,
 
 static bool qed_bmap_is_empty(struct qed_bmap *bmap)
 {
-	return bmap->max_count == find_first_bit(bmap->bitmap, bmap->max_count);
+	return bitmap_empty(bmap->bitmap, bmap->max_count);
 }
 
 static u32 qed_rdma_get_sb_id(void *p_hwfn, u32 rel_sb_id)
-- 
2.34.1


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

* Re: [PATCH 1/2] qed: Use the bitmap API to allocate bitmaps
  2022-07-05 20:36 [PATCH 1/2] qed: Use the bitmap API to allocate bitmaps Christophe JAILLET
  2022-07-05 20:36 ` [PATCH 2/2] qed: Use bitmap_empty() Christophe JAILLET
@ 2022-07-07  3:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-07-07  3:00 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: aelior, manishc, davem, edumazet, kuba, pabeni, linux-kernel,
	kernel-janitors, netdev

Hello:

This series was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Tue,  5 Jul 2022 22:36:16 +0200 you 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/net/ethernet/qlogic/qed/qed_rdma.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

Here is the summary with links:
  - [1/2] qed: Use the bitmap API to allocate bitmaps
    https://git.kernel.org/netdev/net-next/c/291dbea16c71
  - [2/2] qed: Use bitmap_empty()
    https://git.kernel.org/netdev/net-next/c/7ed5f2454acf

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2022-07-07  3:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-05 20:36 [PATCH 1/2] qed: Use the bitmap API to allocate bitmaps Christophe JAILLET
2022-07-05 20:36 ` [PATCH 2/2] qed: Use bitmap_empty() Christophe JAILLET
2022-07-07  3:00 ` [PATCH 1/2] qed: Use the bitmap API to allocate bitmaps patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).