net: bcmgenet: remove eee_enabled/eee_active in bcmgenet_get_eee()
bcmgenet_get_eee() sets edata->eee_active and edata->eee_enabled from its own copy, and then calls phy_ethtool_get_eee() which in turn will call genphy_c45_ethtool_get_eee(). genphy_c45_ethtool_get_eee() will overwrite eee_enabled and eee_active with its own interpretation from the PHYs settings and negotiation result. Therefore, setting these members in bcmgenet_get_eee() is redundant, and can be removed. This also makes priv->eee.eee_active unnecessary, so remove this and use a local variable where appropriate. Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Link: https://lore.kernel.org/r/E1rWbN7-002cCn-RO@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
b573cb0a55
commit
409359c1c2
@ -1313,7 +1313,6 @@ void bcmgenet_eee_enable_set(struct net_device *dev, bool enable,
|
||||
}
|
||||
|
||||
priv->eee.eee_enabled = enable;
|
||||
priv->eee.eee_active = enable;
|
||||
priv->eee.tx_lpi_enabled = tx_lpi_enabled;
|
||||
}
|
||||
|
||||
@ -1328,8 +1327,6 @@ static int bcmgenet_get_eee(struct net_device *dev, struct ethtool_keee *e)
|
||||
if (!dev->phydev)
|
||||
return -ENODEV;
|
||||
|
||||
e->eee_enabled = p->eee_enabled;
|
||||
e->eee_active = p->eee_active;
|
||||
e->tx_lpi_enabled = p->tx_lpi_enabled;
|
||||
e->tx_lpi_timer = bcmgenet_umac_readl(priv, UMAC_EEE_LPI_TIMER);
|
||||
|
||||
@ -1340,6 +1337,7 @@ static int bcmgenet_set_eee(struct net_device *dev, struct ethtool_keee *e)
|
||||
{
|
||||
struct bcmgenet_priv *priv = netdev_priv(dev);
|
||||
struct ethtool_keee *p = &priv->eee;
|
||||
bool active;
|
||||
|
||||
if (GENET_IS_V1(priv))
|
||||
return -EOPNOTSUPP;
|
||||
@ -1352,9 +1350,9 @@ static int bcmgenet_set_eee(struct net_device *dev, struct ethtool_keee *e)
|
||||
if (!p->eee_enabled) {
|
||||
bcmgenet_eee_enable_set(dev, false, false);
|
||||
} else {
|
||||
p->eee_active = phy_init_eee(dev->phydev, false) >= 0;
|
||||
active = phy_init_eee(dev->phydev, false) >= 0;
|
||||
bcmgenet_umac_writel(priv, e->tx_lpi_timer, UMAC_EEE_LPI_TIMER);
|
||||
bcmgenet_eee_enable_set(dev, p->eee_active, e->tx_lpi_enabled);
|
||||
bcmgenet_eee_enable_set(dev, active, e->tx_lpi_enabled);
|
||||
}
|
||||
|
||||
return phy_ethtool_set_eee(dev->phydev, e);
|
||||
|
@ -30,6 +30,7 @@ static void bcmgenet_mac_config(struct net_device *dev)
|
||||
struct bcmgenet_priv *priv = netdev_priv(dev);
|
||||
struct phy_device *phydev = dev->phydev;
|
||||
u32 reg, cmd_bits = 0;
|
||||
bool active;
|
||||
|
||||
/* speed */
|
||||
if (phydev->speed == SPEED_1000)
|
||||
@ -88,9 +89,9 @@ static void bcmgenet_mac_config(struct net_device *dev)
|
||||
}
|
||||
bcmgenet_umac_writel(priv, reg, UMAC_CMD);
|
||||
|
||||
priv->eee.eee_active = phy_init_eee(phydev, 0) >= 0;
|
||||
active = phy_init_eee(phydev, 0) >= 0;
|
||||
bcmgenet_eee_enable_set(dev,
|
||||
priv->eee.eee_enabled && priv->eee.eee_active,
|
||||
priv->eee.eee_enabled && active,
|
||||
priv->eee.tx_lpi_enabled);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user