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

net: phy: bcm87xx: improve bcm87xx_config_init and feature detection

PHY drivers don't have to and shouldn't fiddle with phylib internals.
Most of the code in bcm87xx_config_init() can be removed because
phylib takes care.

In addition I replaced usage of PHY_10GBIT_FEC_FEATURES with an
implementation of the get_features callback. PHY_10GBIT_FEC_FEATURES
is used by this driver only and it's questionable whether there
will be any other PHY supporting this mode only. Having said that
in one of the next kernel versions we may decide to remove it.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Heiner Kallweit and committed by
David S. Miller
476cc6c9 8fb91c35

+8 -12
+8 -12
drivers/net/phy/bcm87xx.c
··· 81 81 } 82 82 #endif /* CONFIG_OF_MDIO */ 83 83 84 - static int bcm87xx_config_init(struct phy_device *phydev) 84 + static int bcm87xx_get_features(struct phy_device *phydev) 85 85 { 86 - linkmode_zero(phydev->supported); 87 86 linkmode_set_bit(ETHTOOL_LINK_MODE_10000baseR_FEC_BIT, 88 87 phydev->supported); 89 - linkmode_zero(phydev->advertising); 90 - linkmode_set_bit(ETHTOOL_LINK_MODE_10000baseR_FEC_BIT, 91 - phydev->advertising); 92 - phydev->state = PHY_NOLINK; 93 - phydev->autoneg = AUTONEG_DISABLE; 94 - 95 - bcm87xx_of_reg_init(phydev); 96 - 97 88 return 0; 89 + } 90 + 91 + static int bcm87xx_config_init(struct phy_device *phydev) 92 + { 93 + return bcm87xx_of_reg_init(phydev); 98 94 } 99 95 100 96 static int bcm87xx_config_aneg(struct phy_device *phydev) ··· 190 194 .phy_id = PHY_ID_BCM8706, 191 195 .phy_id_mask = 0xffffffff, 192 196 .name = "Broadcom BCM8706", 193 - .features = PHY_10GBIT_FEC_FEATURES, 197 + .get_features = bcm87xx_get_features, 194 198 .config_init = bcm87xx_config_init, 195 199 .config_aneg = bcm87xx_config_aneg, 196 200 .read_status = bcm87xx_read_status, ··· 202 206 .phy_id = PHY_ID_BCM8727, 203 207 .phy_id_mask = 0xffffffff, 204 208 .name = "Broadcom BCM8727", 205 - .features = PHY_10GBIT_FEC_FEATURES, 209 + .get_features = bcm87xx_get_features, 206 210 .config_init = bcm87xx_config_init, 207 211 .config_aneg = bcm87xx_config_aneg, 208 212 .read_status = bcm87xx_read_status,