netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] p54: Use the bitmap API to allocate bitmaps
@ 2022-07-04 13:02 Christophe JAILLET
  2022-07-07  9:13 ` [RESEND] " Christian Lamparter
  2022-07-18 11:52 ` wifi: " Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2022-07-04 13:02 UTC (permalink / raw)
  To: Christian Lamparter, Kalle Valo, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET,
	linux-wireless, 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/wireless/intersil/p54/fwio.c | 6 ++----
 drivers/net/wireless/intersil/p54/main.c | 2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/intersil/p54/fwio.c b/drivers/net/wireless/intersil/p54/fwio.c
index bece14e4ff0d..b52cce38115d 100644
--- a/drivers/net/wireless/intersil/p54/fwio.c
+++ b/drivers/net/wireless/intersil/p54/fwio.c
@@ -173,10 +173,8 @@ int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw)
 		 * keeping a extra list for uploaded keys.
 		 */
 
-		priv->used_rxkeys = kcalloc(BITS_TO_LONGS(priv->rx_keycache_size),
-					    sizeof(long),
-					    GFP_KERNEL);
-
+		priv->used_rxkeys = bitmap_zalloc(priv->rx_keycache_size,
+						  GFP_KERNEL);
 		if (!priv->used_rxkeys)
 			return -ENOMEM;
 	}
diff --git a/drivers/net/wireless/intersil/p54/main.c b/drivers/net/wireless/intersil/p54/main.c
index 115be1f3f33d..c1e1711382a7 100644
--- a/drivers/net/wireless/intersil/p54/main.c
+++ b/drivers/net/wireless/intersil/p54/main.c
@@ -830,7 +830,7 @@ void p54_free_common(struct ieee80211_hw *dev)
 	kfree(priv->output_limit);
 	kfree(priv->curve_data);
 	kfree(priv->rssi_db);
-	kfree(priv->used_rxkeys);
+	bitmap_free(priv->used_rxkeys);
 	kfree(priv->survey);
 	priv->iq_autocal = NULL;
 	priv->output_limit = NULL;
-- 
2.34.1


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

* Re: [RESEND] [PATCH] p54: Use the bitmap API to allocate bitmaps
  2022-07-04 13:02 [PATCH] p54: Use the bitmap API to allocate bitmaps Christophe JAILLET
@ 2022-07-07  9:13 ` Christian Lamparter
  2022-07-18 11:52 ` wifi: " Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Christian Lamparter @ 2022-07-07  9:13 UTC (permalink / raw)
  To: Christophe JAILLET, Christian Lamparter, Kalle Valo,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: linux-kernel, kernel-janitors, linux-wireless, netdev

Hi,

I'm sending this again because Android added HTML. Sorry for that.

On 04/07/2022 15:02, 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: Christian Lamparter <chunkeey@gmail.com>

> ---
>   drivers/net/wireless/intersil/p54/fwio.c | 6 ++----
>   drivers/net/wireless/intersil/p54/main.c | 2 +-
>   2 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/wireless/intersil/p54/fwio.c b/drivers/net/wireless/intersil/p54/fwio.c
> index bece14e4ff0d..b52cce38115d 100644
> --- a/drivers/net/wireless/intersil/p54/fwio.c
> +++ b/drivers/net/wireless/intersil/p54/fwio.c
> @@ -173,10 +173,8 @@ int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw)
>   		 * keeping a extra list for uploaded keys.
>   		 */
>   
> -		priv->used_rxkeys = kcalloc(BITS_TO_LONGS(priv->rx_keycache_size),
> -					    sizeof(long),
> -					    GFP_KERNEL);
> -
> +		priv->used_rxkeys = bitmap_zalloc(priv->rx_keycache_size,
> +						  GFP_KERNEL);
>   		if (!priv->used_rxkeys)
>   			return -ENOMEM;
>   	}
> diff --git a/drivers/net/wireless/intersil/p54/main.c b/drivers/net/wireless/intersil/p54/main.c
> index 115be1f3f33d..c1e1711382a7 100644
> --- a/drivers/net/wireless/intersil/p54/main.c
> +++ b/drivers/net/wireless/intersil/p54/main.c
> @@ -830,7 +830,7 @@ void p54_free_common(struct ieee80211_hw *dev)
>   	kfree(priv->output_limit);
>   	kfree(priv->curve_data);
>   	kfree(priv->rssi_db);
> -	kfree(priv->used_rxkeys);
> +	bitmap_free(priv->used_rxkeys);
>   	kfree(priv->survey);
>   	priv->iq_autocal = NULL;
>   	priv->output_limit = NULL;


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

* Re: wifi: p54: Use the bitmap API to allocate bitmaps
  2022-07-04 13:02 [PATCH] p54: Use the bitmap API to allocate bitmaps Christophe JAILLET
  2022-07-07  9:13 ` [RESEND] " Christian Lamparter
@ 2022-07-18 11:52 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2022-07-18 11:52 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Christian Lamparter, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, linux-kernel, kernel-janitors,
	Christophe JAILLET, linux-wireless, netdev

Christophe JAILLET <christophe.jaillet@wanadoo.fr> 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: Christian Lamparter <chunkeey@gmail.com>

Patch applied to wireless-next.git, thanks.

0c574060060a wifi: p54: Use the bitmap API to allocate bitmaps

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/2755b8b7d85a2db0663d39ea6df823f94f3401b3.1656939750.git.christophe.jaillet@wanadoo.fr/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-04 13:02 [PATCH] p54: Use the bitmap API to allocate bitmaps Christophe JAILLET
2022-07-07  9:13 ` [RESEND] " Christian Lamparter
2022-07-18 11:52 ` wifi: " Kalle Valo

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).