netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sfc/siena: Use the bitmap API to allocate bitmaps
@ 2022-07-05 19:34 Christophe JAILLET
  2022-07-06  7:53 ` Martin Habets
  2022-07-07  3:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2022-07-05 19:34 UTC (permalink / raw)
  To: Edward Cree, Martin Habets, 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/sfc/siena/farch.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/sfc/siena/farch.c b/drivers/net/ethernet/sfc/siena/farch.c
index cce23803c652..89ccd65c978b 100644
--- a/drivers/net/ethernet/sfc/siena/farch.c
+++ b/drivers/net/ethernet/sfc/siena/farch.c
@@ -2778,7 +2778,7 @@ void efx_farch_filter_table_remove(struct efx_nic *efx)
 	enum efx_farch_filter_table_id table_id;
 
 	for (table_id = 0; table_id < EFX_FARCH_FILTER_TABLE_COUNT; table_id++) {
-		kfree(state->table[table_id].used_bitmap);
+		bitmap_free(state->table[table_id].used_bitmap);
 		vfree(state->table[table_id].spec);
 	}
 	kfree(state);
@@ -2822,9 +2822,7 @@ int efx_farch_filter_table_probe(struct efx_nic *efx)
 		table = &state->table[table_id];
 		if (table->size == 0)
 			continue;
-		table->used_bitmap = kcalloc(BITS_TO_LONGS(table->size),
-					     sizeof(unsigned long),
-					     GFP_KERNEL);
+		table->used_bitmap = bitmap_zalloc(table->size, GFP_KERNEL);
 		if (!table->used_bitmap)
 			goto fail;
 		table->spec = vzalloc(array_size(sizeof(*table->spec),
-- 
2.34.1


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

* Re: [PATCH] sfc/siena: Use the bitmap API to allocate bitmaps
  2022-07-05 19:34 [PATCH] sfc/siena: Use the bitmap API to allocate bitmaps Christophe JAILLET
@ 2022-07-06  7:53 ` Martin Habets
  2022-07-07  3:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Martin Habets @ 2022-07-06  7:53 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Edward Cree, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, linux-kernel, kernel-janitors, netdev

Please use "PATCH net-next" in these kind of patches for netdev.
See Documentation/process/maintainer-netdev.rst

On Tue, Jul 05, 2022 at 09:34:08PM +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>

Acked-by: Martin Habets <habetsm.xilinx@gmail.com>

> ---
>  drivers/net/ethernet/sfc/siena/farch.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/sfc/siena/farch.c b/drivers/net/ethernet/sfc/siena/farch.c
> index cce23803c652..89ccd65c978b 100644
> --- a/drivers/net/ethernet/sfc/siena/farch.c
> +++ b/drivers/net/ethernet/sfc/siena/farch.c
> @@ -2778,7 +2778,7 @@ void efx_farch_filter_table_remove(struct efx_nic *efx)
>  	enum efx_farch_filter_table_id table_id;
>  
>  	for (table_id = 0; table_id < EFX_FARCH_FILTER_TABLE_COUNT; table_id++) {
> -		kfree(state->table[table_id].used_bitmap);
> +		bitmap_free(state->table[table_id].used_bitmap);
>  		vfree(state->table[table_id].spec);
>  	}
>  	kfree(state);
> @@ -2822,9 +2822,7 @@ int efx_farch_filter_table_probe(struct efx_nic *efx)
>  		table = &state->table[table_id];
>  		if (table->size == 0)
>  			continue;
> -		table->used_bitmap = kcalloc(BITS_TO_LONGS(table->size),
> -					     sizeof(unsigned long),
> -					     GFP_KERNEL);
> +		table->used_bitmap = bitmap_zalloc(table->size, GFP_KERNEL);
>  		if (!table->used_bitmap)
>  			goto fail;
>  		table->spec = vzalloc(array_size(sizeof(*table->spec),
> -- 
> 2.34.1

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

* Re: [PATCH] sfc/siena: Use the bitmap API to allocate bitmaps
  2022-07-05 19:34 [PATCH] sfc/siena: Use the bitmap API to allocate bitmaps Christophe JAILLET
  2022-07-06  7:53 ` Martin Habets
@ 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: ecree.xilinx, habetsm.xilinx, davem, edumazet, kuba, pabeni,
	linux-kernel, kernel-janitors, netdev

Hello:

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

On Tue,  5 Jul 2022 21:34:08 +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/sfc/siena/farch.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)

Here is the summary with links:
  - sfc/siena: Use the bitmap API to allocate bitmaps
    https://git.kernel.org/netdev/net-next/c/820aceb53c75

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 19:34 [PATCH] sfc/siena: Use the bitmap API to allocate bitmaps Christophe JAILLET
2022-07-06  7:53 ` Martin Habets
2022-07-07  3:00 ` 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).