netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: atlantic: Use the bitmap API instead of hand-writing it
@ 2022-01-23  6:53 Christophe JAILLET
  2022-01-24  7:33 ` [EXT] " Igor Russkikh
  2022-01-24 13:02 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2022-01-23  6:53 UTC (permalink / raw)
  To: Igor Russkikh, David S. Miller, Jakub Kicinski
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, netdev

Simplify code by using bitmap_weight() and bitmap_zero() instead of
hand-writing these functions.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/net/ethernet/aquantia/atlantic/aq_filters.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_filters.c b/drivers/net/ethernet/aquantia/atlantic/aq_filters.c
index 1bc4d33a0ce5..30a573db02bb 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_filters.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_filters.c
@@ -826,7 +826,6 @@ int aq_filters_vlans_update(struct aq_nic_s *aq_nic)
 	struct aq_hw_s *aq_hw = aq_nic->aq_hw;
 	int hweight = 0;
 	int err = 0;
-	int i;
 
 	if (unlikely(!aq_hw_ops->hw_filter_vlan_set))
 		return -EOPNOTSUPP;
@@ -837,8 +836,7 @@ int aq_filters_vlans_update(struct aq_nic_s *aq_nic)
 			 aq_nic->aq_hw_rx_fltrs.fl2.aq_vlans);
 
 	if (aq_nic->ndev->features & NETIF_F_HW_VLAN_CTAG_FILTER) {
-		for (i = 0; i < BITS_TO_LONGS(VLAN_N_VID); i++)
-			hweight += hweight_long(aq_nic->active_vlans[i]);
+		hweight = bitmap_weight(aq_nic->active_vlans, VLAN_N_VID);
 
 		err = aq_hw_ops->hw_filter_vlan_ctrl(aq_hw, false);
 		if (err)
@@ -871,7 +869,7 @@ int aq_filters_vlan_offload_off(struct aq_nic_s *aq_nic)
 	struct aq_hw_s *aq_hw = aq_nic->aq_hw;
 	int err = 0;
 
-	memset(aq_nic->active_vlans, 0, sizeof(aq_nic->active_vlans));
+	bitmap_zero(aq_nic->active_vlans, VLAN_N_VID);
 	aq_fvlan_rebuild(aq_nic, aq_nic->active_vlans,
 			 aq_nic->aq_hw_rx_fltrs.fl2.aq_vlans);
 
-- 
2.32.0


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

* Re: [EXT] [PATCH] net: atlantic: Use the bitmap API instead of hand-writing it
  2022-01-23  6:53 [PATCH] net: atlantic: Use the bitmap API instead of hand-writing it Christophe JAILLET
@ 2022-01-24  7:33 ` Igor Russkikh
  2022-01-24 13:02 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Igor Russkikh @ 2022-01-24  7:33 UTC (permalink / raw)
  To: Christophe JAILLET, David S. Miller, Jakub Kicinski
  Cc: linux-kernel, kernel-janitors, netdev


Thanks, Christophe,

> Simplify code by using bitmap_weight() and bitmap_zero() instead of
> hand-writing these functions.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Reviewed-by: Igor Russkikh <irusskikh@marvell.com>

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

* Re: [PATCH] net: atlantic: Use the bitmap API instead of hand-writing it
  2022-01-23  6:53 [PATCH] net: atlantic: Use the bitmap API instead of hand-writing it Christophe JAILLET
  2022-01-24  7:33 ` [EXT] " Igor Russkikh
@ 2022-01-24 13:02 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-01-24 13:02 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: irusskikh, davem, kuba, linux-kernel, kernel-janitors, netdev

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Sun, 23 Jan 2022 07:53:46 +0100 you wrote:
> Simplify code by using bitmap_weight() and bitmap_zero() instead of
> hand-writing these functions.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/net/ethernet/aquantia/atlantic/aq_filters.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)

Here is the summary with links:
  - net: atlantic: Use the bitmap API instead of hand-writing it
    https://git.kernel.org/netdev/net/c/ebe0582bee78

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-01-24 13:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-23  6:53 [PATCH] net: atlantic: Use the bitmap API instead of hand-writing it Christophe JAILLET
2022-01-24  7:33 ` [EXT] " Igor Russkikh
2022-01-24 13:02 ` 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).