Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: atlantic: Use the bitmap API instead of hand-writing it

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>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Christophe JAILLET and committed by
David S. Miller
ebe0582b 2afc3b5a

+2 -4
+2 -4
drivers/net/ethernet/aquantia/atlantic/aq_filters.c
··· 826 826 struct aq_hw_s *aq_hw = aq_nic->aq_hw; 827 827 int hweight = 0; 828 828 int err = 0; 829 - int i; 830 829 831 830 if (unlikely(!aq_hw_ops->hw_filter_vlan_set)) 832 831 return -EOPNOTSUPP; ··· 836 837 aq_nic->aq_hw_rx_fltrs.fl2.aq_vlans); 837 838 838 839 if (aq_nic->ndev->features & NETIF_F_HW_VLAN_CTAG_FILTER) { 839 - for (i = 0; i < BITS_TO_LONGS(VLAN_N_VID); i++) 840 - hweight += hweight_long(aq_nic->active_vlans[i]); 840 + hweight = bitmap_weight(aq_nic->active_vlans, VLAN_N_VID); 841 841 842 842 err = aq_hw_ops->hw_filter_vlan_ctrl(aq_hw, false); 843 843 if (err) ··· 869 871 struct aq_hw_s *aq_hw = aq_nic->aq_hw; 870 872 int err = 0; 871 873 872 - memset(aq_nic->active_vlans, 0, sizeof(aq_nic->active_vlans)); 874 + bitmap_zero(aq_nic->active_vlans, VLAN_N_VID); 873 875 aq_fvlan_rebuild(aq_nic, aq_nic->active_vlans, 874 876 aq_nic->aq_hw_rx_fltrs.fl2.aq_vlans); 875 877