Skip to content

Commit ebe0582

Browse files
tititiou36davem330
authored andcommitted
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 <[email protected]> Reviewed-by: Igor Russkikh <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2afc3b5 commit ebe0582

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/net/ethernet/aquantia/atlantic/aq_filters.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,6 @@ int aq_filters_vlans_update(struct aq_nic_s *aq_nic)
826826
struct aq_hw_s *aq_hw = aq_nic->aq_hw;
827827
int hweight = 0;
828828
int err = 0;
829-
int i;
830829

831830
if (unlikely(!aq_hw_ops->hw_filter_vlan_set))
832831
return -EOPNOTSUPP;
@@ -837,8 +836,7 @@ int aq_filters_vlans_update(struct aq_nic_s *aq_nic)
837836
aq_nic->aq_hw_rx_fltrs.fl2.aq_vlans);
838837

839838
if (aq_nic->ndev->features & NETIF_F_HW_VLAN_CTAG_FILTER) {
840-
for (i = 0; i < BITS_TO_LONGS(VLAN_N_VID); i++)
841-
hweight += hweight_long(aq_nic->active_vlans[i]);
839+
hweight = bitmap_weight(aq_nic->active_vlans, VLAN_N_VID);
842840

843841
err = aq_hw_ops->hw_filter_vlan_ctrl(aq_hw, false);
844842
if (err)
@@ -871,7 +869,7 @@ int aq_filters_vlan_offload_off(struct aq_nic_s *aq_nic)
871869
struct aq_hw_s *aq_hw = aq_nic->aq_hw;
872870
int err = 0;
873871

874-
memset(aq_nic->active_vlans, 0, sizeof(aq_nic->active_vlans));
872+
bitmap_zero(aq_nic->active_vlans, VLAN_N_VID);
875873
aq_fvlan_rebuild(aq_nic, aq_nic->active_vlans,
876874
aq_nic->aq_hw_rx_fltrs.fl2.aq_vlans);
877875

0 commit comments

Comments
 (0)