Commit 3e60b748 authored by Sean Wang's avatar Sean Wang Committed by David S. Miller

net: ethernet: mediatek: use [get|set]_link_ksettings

1) use new api [get|set]_link_ksettings instead
of [get|set]_settings old ones.

2) dev->phydev is sure being ready before calling
these callbacks, so removing all the sanity check
if it is existing.
Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a2b2a19f
...@@ -2034,35 +2034,26 @@ static int mtk_cleanup(struct mtk_eth *eth) ...@@ -2034,35 +2034,26 @@ static int mtk_cleanup(struct mtk_eth *eth)
return 0; return 0;
} }
static int mtk_get_settings(struct net_device *dev, int mtk_get_link_ksettings(struct net_device *ndev,
struct ethtool_cmd *cmd) struct ethtool_link_ksettings *cmd)
{ {
struct mtk_mac *mac = netdev_priv(dev); struct mtk_mac *mac = netdev_priv(ndev);
int err;
if (unlikely(test_bit(MTK_RESETTING, &mac->hw->state))) if (unlikely(test_bit(MTK_RESETTING, &mac->hw->state)))
return -EBUSY; return -EBUSY;
err = phy_read_status(dev->phydev); return phy_ethtool_ksettings_get(ndev->phydev, cmd);
if (err)
return -ENODEV;
return phy_ethtool_gset(dev->phydev, cmd);
} }
static int mtk_set_settings(struct net_device *dev, int mtk_set_link_ksettings(struct net_device *ndev,
struct ethtool_cmd *cmd) const struct ethtool_link_ksettings *cmd)
{ {
struct mtk_mac *mac = netdev_priv(dev); struct mtk_mac *mac = netdev_priv(ndev);
if (cmd->phy_address != dev->phydev->mdio.addr) { if (unlikely(test_bit(MTK_RESETTING, &mac->hw->state)))
dev->phydev = mdiobus_get_phy(mac->hw->mii_bus, return -EBUSY;
cmd->phy_address);
if (!dev->phydev)
return -ENODEV;
}
return phy_ethtool_sset(dev->phydev, cmd); return phy_ethtool_ksettings_set(ndev->phydev, cmd);
} }
static void mtk_get_drvinfo(struct net_device *dev, static void mtk_get_drvinfo(struct net_device *dev,
...@@ -2225,8 +2216,8 @@ static int mtk_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd) ...@@ -2225,8 +2216,8 @@ static int mtk_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
} }
static const struct ethtool_ops mtk_ethtool_ops = { static const struct ethtool_ops mtk_ethtool_ops = {
.get_settings = mtk_get_settings, .get_link_ksettings = mtk_get_link_ksettings,
.set_settings = mtk_set_settings, .set_link_ksettings = mtk_set_link_ksettings,
.get_drvinfo = mtk_get_drvinfo, .get_drvinfo = mtk_get_drvinfo,
.get_msglevel = mtk_get_msglevel, .get_msglevel = mtk_get_msglevel,
.set_msglevel = mtk_set_msglevel, .set_msglevel = mtk_set_msglevel,
......
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