Commit ccf355e5 authored by Fuqian Huang's avatar Fuqian Huang Committed by David S. Miller

net: phy: Make use of linkmode_mod_bit helper

linkmode_mod_bit is introduced as a helper function to set/clear
bits in a linkmode.
Replace the if else code structure with a call to the helper
linkmode_mod_bit.
Signed-off-by: default avatarFuqian Huang <huangfq.daxian@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 88e2f284
...@@ -298,12 +298,8 @@ int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd) ...@@ -298,12 +298,8 @@ int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd)
linkmode_copy(phydev->advertising, advertising); linkmode_copy(phydev->advertising, advertising);
if (AUTONEG_ENABLE == cmd->autoneg) linkmode_mod_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
linkmode_set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->advertising, AUTONEG_ENABLE == cmd->autoneg);
phydev->advertising);
else
linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
phydev->advertising);
phydev->duplex = cmd->duplex; phydev->duplex = cmd->duplex;
...@@ -353,12 +349,8 @@ int phy_ethtool_ksettings_set(struct phy_device *phydev, ...@@ -353,12 +349,8 @@ int phy_ethtool_ksettings_set(struct phy_device *phydev,
linkmode_copy(phydev->advertising, advertising); linkmode_copy(phydev->advertising, advertising);
if (autoneg == AUTONEG_ENABLE) linkmode_mod_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
linkmode_set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->advertising, autoneg == AUTONEG_ENABLE);
phydev->advertising);
else
linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
phydev->advertising);
phydev->duplex = duplex; phydev->duplex = duplex;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment