OSDN Git Service

net: stmmac: Switch to linkmode_and()/linkmode_andnot()
authorJose Abreu <Jose.Abreu@synopsys.com>
Mon, 9 Mar 2020 08:36:21 +0000 (09:36 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 10 Mar 2020 03:13:16 +0000 (20:13 -0700)
Use the linkmode_and()/linkmode_andnot() helpers to simplify the code.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index cb7a5ba..cf18424 100644 (file)
@@ -858,14 +858,11 @@ static void stmmac_validate(struct phylink_config *config,
                phylink_set(mask, 1000baseT_Half);
        }
 
-       bitmap_and(supported, supported, mac_supported,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
-       bitmap_andnot(supported, supported, mask,
-                     __ETHTOOL_LINK_MODE_MASK_NBITS);
-       bitmap_and(state->advertising, state->advertising, mac_supported,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
-       bitmap_andnot(state->advertising, state->advertising, mask,
-                     __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_and(supported, supported, mac_supported);
+       linkmode_andnot(supported, supported, mask);
+
+       linkmode_and(state->advertising, state->advertising, mac_supported);
+       linkmode_andnot(state->advertising, state->advertising, mask);
 }
 
 static void stmmac_mac_pcs_get_state(struct phylink_config *config,