summaryrefslogtreecommitdiff
path: root/include/linux/mii.h
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2018-12-05 23:49:41 +0300
committerDavid S. Miller <davem@davemloft.net>2018-12-06 03:26:16 +0300
commit78a24df370072ea3b7c0a466efd776fc8f87c73a (patch)
treeff4b6299aaccca612d270b23fcf4674ae216c8d3 /include/linux/mii.h
parent5f15eed245bc6d7c82d44f0ebcaf62071a9d55bd (diff)
downloadlinux-78a24df370072ea3b7c0a466efd776fc8f87c73a.tar.xz
net: mii: Rename mii_stat1000_to_linkmode_lpa_t
Rename mii_stat1000_to_linkmode_lpa_t to mii_stat1000_mod_linkmode_lpa_t to indicate it modifies the passed linkmode bitmap, without clearing any other bits. Add a helper to set/clear bits in a linkmode. Use this helper to ensure bit are clear which the stat1000 indicates should not be set. Fixes: c0ec3c273677 ("net: phy: Convert u32 phydev->lp_advertising to linkmode") Suggested-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/mii.h')
-rw-r--r--include/linux/mii.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/include/linux/mii.h b/include/linux/mii.h
index 57365224306c..b915ef6c3692 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -288,22 +288,22 @@ static inline u32 mii_stat1000_to_ethtool_lpa_t(u32 lpa)
}
/**
- * mii_stat1000_to_linkmode_lpa_t
+ * mii_stat1000_mod_linkmode_lpa_t
* @advertising: target the linkmode advertisement settings
* @adv: value of the MII_STAT1000 register
*
* A small helper function that translates MII_STAT1000 bits, when in
- * 1000Base-T mode, to linkmode advertisement settings.
+ * 1000Base-T mode, to linkmode advertisement settings. Other bits in
+ * advertising are not changes.
*/
-static inline void mii_stat1000_to_linkmode_lpa_t(unsigned long *advertising,
- u32 lpa)
+static inline void mii_stat1000_mod_linkmode_lpa_t(unsigned long *advertising,
+ u32 lpa)
{
- if (lpa & LPA_1000HALF)
- linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT,
- advertising);
- if (lpa & LPA_1000FULL)
- linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT,
- advertising);
+ linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT,
+ advertising, lpa & LPA_1000HALF);
+
+ linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT,
+ advertising, lpa & LPA_1000FULL);
}
/**